Chromium Code Reviews| 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 mus::Window. This is the client side equivalent to the | |
|
sky
2016/09/08 23:37:20
mus->ui
| |
| 17 // messages defined in ui::ws::DragTargetConnection. | |
|
sky
2016/09/08 23:37:20
ui->mojom
| |
| 18 class WindowDropTarget { | |
| 19 public: | |
| 20 virtual ~WindowDropTarget() {} | |
| 21 | |
| 22 // On the first time the pointer enters the associated mus::Window, we get a | |
| 23 // start message with all the data that's part of the drag. (The source | |
| 24 // mus::Window receives this immediately through the client library instead | |
|
sky
2016/09/08 23:37:20
mus->ui (to a global search/replace as I'm going t
| |
| 25 // of asynchronously.) | |
| 26 virtual void OnDragStart( | |
| 27 std::map<std::string, std::vector<uint8_t>> mime_data) = 0; | |
| 28 | |
| 29 // Each time the pointer enters the associated mus::Window, we receive an | |
| 30 // enter event and return a bitmask of drop operations that can be performed | |
| 31 // at this location, in terms of the ui::mojom::kDropEffect{None,Move, | |
| 32 // Copy,Link} constants. | |
| 33 virtual uint32_t OnDragEnter(uint32_t key_state, | |
| 34 const gfx::Point& position, | |
| 35 uint32_t effect_bitmask) = 0; | |
| 36 | |
| 37 // Each time the pointer moves inside the associated mus::Window, we receive | |
| 38 // an over event and return a bitmask of drop oeprations. | |
| 39 virtual uint32_t OnDragOver(uint32_t key_state, | |
| 40 const gfx::Point& position, | |
| 41 uint32_t effect_bitmask) = 0; | |
| 42 | |
| 43 // Each time the pointer leaves the associated mus::Window, we receive a | |
| 44 // leave event. | |
| 45 virtual void OnDragLeave() = 0; | |
| 46 | |
| 47 // If the user releases the pointer over the associated mus::Window, wee | |
| 48 // receive this drop event to actually try to perform the drop. Unlike the | |
| 49 // other methods in this class which return a value, this return value is not | |
| 50 // a bitmask and is the operation which was actually completed. Returning 0 | |
| 51 // indicates that the drag failed and shouldn't be reported as a success. | |
| 52 virtual uint32_t OnDragDrop(uint32_t key_state, | |
| 53 const gfx::Point& position, | |
| 54 uint32_t effect_bitmask) = 0; | |
| 55 | |
| 56 // When a drag that entered the associated window finishes one way or | |
| 57 // another, the target receives this message to clear the mime_data from the | |
| 58 // start message, along with any other client specific caches. | |
| 59 virtual void OnDragFinish() = 0; | |
| 60 }; | |
| 61 | |
| 62 } // namespace ui | |
| 63 | |
| 64 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_DROP_TARGET_H_ | |
| OLD | NEW |