drag_drop_client.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef UI_AURA_CLIENT_DRAG_DROP_CLIENT_H_
  5. #define UI_AURA_CLIENT_DRAG_DROP_CLIENT_H_
  6. #include <memory>
  7. #include "ui/aura/aura_export.h"
  8. #include "ui/base/dragdrop/mojom/drag_drop_types.mojom-forward.h"
  9. #include "ui/gfx/native_widget_types.h"
  10. namespace gfx {
  11. class Point;
  12. }
  13. namespace ui {
  14. class OSExchangeData;
  15. }
  16. namespace aura {
  17. class Window;
  18. namespace client {
  19. class DragDropClientObserver;
  20. // An interface implemented by an object that controls a drag and drop session.
  21. class AURA_EXPORT DragDropClient {
  22. public:
  23. virtual ~DragDropClient() {}
  24. // Initiates a drag and drop session. Returns the drag operation that was
  25. // applied at the end of the drag drop session. |screen_location| is in
  26. // screen coordinates. At most one drag and drop operation is allowed.
  27. // It must not start drag operation while |IsDragDropInProgress| returns true.
  28. virtual ui::mojom::DragOperation StartDragAndDrop(
  29. std::unique_ptr<ui::OSExchangeData> data,
  30. aura::Window* root_window,
  31. aura::Window* source_window,
  32. const gfx::Point& screen_location,
  33. int allowed_operations,
  34. ui::mojom::DragEventSource source) = 0;
  35. // Called when a drag and drop session is cancelled.
  36. virtual void DragCancel() = 0;
  37. // Returns true if a drag and drop session is in progress.
  38. virtual bool IsDragDropInProgress() = 0;
  39. virtual void AddObserver(DragDropClientObserver* observer) = 0;
  40. virtual void RemoveObserver(DragDropClientObserver* observer) = 0;
  41. };
  42. AURA_EXPORT void SetDragDropClient(Window* root_window,
  43. DragDropClient* client);
  44. AURA_EXPORT DragDropClient* GetDragDropClient(Window* root_window);
  45. } // namespace client
  46. } // namespace aura
  47. #endif // UI_AURA_CLIENT_DRAG_DROP_CLIENT_H_