OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 SERVICES_UI_PUBLIC_CPP_WINDOW_DROP_TARGET_H_ |
| 6 #define SERVICES_UI_PUBLIC_CPP_WINDOW_DROP_TARGET_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <vector> |
| 10 |
| 11 #include "ui/gfx/geometry/point.h" |
| 12 |
| 13 namespace ui { |
| 14 |
| 15 // Interface that clients that want to opt-in to receiving drag drop events |
| 16 // pass to their ui::Window. This is the client side equivalent to the |
| 17 // messages defined in ui::mojom::WindowTreeClient. |
| 18 class WindowDropTarget { |
| 19 public: |
| 20 // On the first time the pointer enters the associated ui::Window, we get a |
| 21 // start message with all the data that's part of the drag. (The source |
| 22 // ui::Window receives this immediately through the client library instead |
| 23 // of asynchronously.) |
| 24 virtual void OnDragDropStart( |
| 25 std::map<std::string, std::vector<uint8_t>> mime_data) = 0; |
| 26 |
| 27 // Each time the pointer enters the associated ui::Window, we receive an |
| 28 // enter event and return a bitmask of drop operations that can be performed |
| 29 // at this location, in terms of the ui::mojom::kDropEffect{None,Move, |
| 30 // Copy,Link} constants. |
| 31 virtual uint32_t OnDragEnter(uint32_t event_flags, |
| 32 const gfx::Point& position, |
| 33 uint32_t effect_bitmask) = 0; |
| 34 |
| 35 // Each time the pointer moves inside the associated ui::Window, we receive |
| 36 // an over event and return a bitmask of drop oeprations. |
| 37 virtual uint32_t OnDragOver(uint32_t event_flags, |
| 38 const gfx::Point& position, |
| 39 uint32_t effect_bitmask) = 0; |
| 40 |
| 41 // Each time the pointer leaves the associated ui::Window, we receive a |
| 42 // leave event. |
| 43 virtual void OnDragLeave() = 0; |
| 44 |
| 45 // If the user releases the pointer over the associated ui::Window, we |
| 46 // receive this drop event to actually try to perform the drop. Unlike the |
| 47 // other methods in this class which return a value, this return value is not |
| 48 // a bitmask and is the operation which was actually completed. Returning 0 |
| 49 // indicates that the drag failed and shouldn't be reported as a success. |
| 50 virtual uint32_t OnCompleteDrop(uint32_t event_flags, |
| 51 const gfx::Point& position, |
| 52 uint32_t effect_bitmask) = 0; |
| 53 |
| 54 // When a drag that entered the associated window finishes one way or |
| 55 // another, the target receives this message to clear the mime_data from the |
| 56 // start message, along with any other client specific caches. |
| 57 virtual void OnDragDropDone() = 0; |
| 58 |
| 59 protected: |
| 60 virtual ~WindowDropTarget() {} |
| 61 }; |
| 62 |
| 63 } // namespace ui |
| 64 |
| 65 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_DROP_TARGET_H_ |
OLD | NEW |