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 5 #ifndef UI_AURA_CLIENT_DRAG_DROP_CLIENT_H_ 6 #define UI_AURA_CLIENT_DRAG_DROP_CLIENT_H_ 7 8 #include "ui/aura/aura_export.h" 9 #include "ui/base/dragdrop/drag_drop_types.h" 10 #include "ui/gfx/native_widget_types.h" 11 12 namespace gfx { 13 class Point; 14 } 15 16 namespace ui { 17 class LocatedEvent; 18 class OSExchangeData; 19 } 20 21 namespace aura { 22 class RootWindow; 23 class Window; 24 namespace client { 25 26 // An interface implemented by an object that controls a drag and drop session. 27 class AURA_EXPORT DragDropClient { 28 public: 29 virtual ~DragDropClient() {} 30 31 // Initiates a drag and drop session. Returns the drag operation that was 32 // applied at the end of the drag drop session. |root_location| is in the 33 // RootWindow's coordinate system. 34 virtual int StartDragAndDrop(const ui::OSExchangeData& data, 35 aura::RootWindow* root_window, 36 aura::Window* source_window, 37 const gfx::Point& root_location, 38 int operation, 39 ui::DragDropTypes::DragEventSource source) = 0; 40 41 // Called when mouse is dragged during a drag and drop. 42 virtual void DragUpdate(aura::Window* target, 43 const ui::LocatedEvent& event) = 0; 44 45 // Called when mouse is released during a drag and drop. 46 virtual void Drop(aura::Window* target, 47 const ui::LocatedEvent& event) = 0; 48 49 // Called when a drag and drop session is cancelled. 50 virtual void DragCancel() = 0; 51 52 // Returns true if a drag and drop session is in progress. 53 virtual bool IsDragDropInProgress() = 0; 54 }; 55 56 AURA_EXPORT void SetDragDropClient(RootWindow* root_window, 57 DragDropClient* client); 58 AURA_EXPORT DragDropClient* GetDragDropClient(RootWindow* root_window); 59 60 } // namespace client 61 } // namespace aura 62 63 #endif // UI_AURA_CLIENT_DRAG_DROP_CLIENT_H_ 64