Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: services/ui/ws/drag_target_connection.h

Issue 2266603002: mus: Implement interwindow drag and drop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clear the implicit pointer drags before start. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_WS_DRAG_TARGET_CONNECTION_H_
6 #define SERVICES_UI_WS_DRAG_TARGET_CONNECTION_H_
7
8 #include "base/bind.h"
9 #include "mojo/public/cpp/bindings/array.h"
10 #include "mojo/public/cpp/bindings/map.h"
11 #include "mojo/public/cpp/bindings/string.h"
12 #include "ui/gfx/geometry/point.h"
13
14 namespace ui {
15 namespace ws {
16
17 class ServerWindow;
18
19 // An abstract connection which can respond to drag/drop target requests.
20 //
21 // The methods in this class send drag and drop messages to the client and
22 // return their results through the passed in callback. From the point of view
23 // of the client, the lifecycle of receiving messages are in the following
24 // order:
25 class DragTargetConnection {
26 public:
27 virtual ~DragTargetConnection() {}
28
29 // On the first time that the pointer enters a |window|, we send this
30 // DragStart message with the |mime_data| of the drag so that we only send
31 // this data over the connection once. We send the mime data first because
32 // clients may read the payload at any time, including during the enter
33 // message.
34 //
35 // (As an optimization, on the server side, we don't send this message to the
36 // source window of the drag; the client library has already done the
37 // equivalent in ui::WindowDropTarget to minimize the load of inter-process
38 // communication.)
39 virtual void PerformOnDragStart(
40 const ServerWindow* window,
41 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data) = 0;
42
43 // Next, on each time that the mouse cursor moves from one |window| to
44 // another, we send a DragEnter message. The value returned by |callback| is
45 // a bitmask of drop operations that can be performed at this location, in
46 // terms of the ui::mojom::kDropEffect{None,Move,Copy,Link} constants.
47 virtual void PerformOnDragEnter(
48 const ServerWindow* window,
49 uint32_t key_state,
50 const gfx::Point& cursor_offset,
51 uint32_t effect_bitmask,
52 const base::Callback<void(uint32_t)>& callback) = 0;
53
54 // For each mouse move after the initial DragEnter message, we call DragOver
55 // to change the mouse location and to update what drop operations can be
56 // performed.
57 virtual void PerformOnDragOver(
58 const ServerWindow* window,
59 uint32_t key_state,
60 const gfx::Point& cursor_offset,
61 uint32_t effect_bitmask,
62 const base::Callback<void(uint32_t)>& callback) = 0;
63
64 // If the mouse cursor leaves |window|, send an DragLeave message.
65 virtual void PerformOnDragLeave(const ServerWindow* window) = 0;
66
67 // If the user releases the pointer over a window, send a DragDrop message,
68 // which signals that the client should complete the drag. The return value
69 // is which operation was performed; a non-zero callback value means the drag
70 // was accepted and completed.
71 virtual void PerformOnDragDrop(
72 const ServerWindow* window,
73 uint32_t key_state,
74 const gfx::Point& cursor_offset,
75 uint32_t effect_bitmask,
76 const base::Callback<void(uint32_t)>& callback) = 0;
77
78 // Finally, regardless of which window accepted (or rejected) the drop, we
79 // send a DragFinish message to each window that we sent a DragStart message
80 // to. This message is used to clear cached data from the drag.
81 //
82 // (Again, we don't send this message to the source window as we didn't send
83 // a DragStart message; the client library handles the equivalent at its
84 // layer.)
85 virtual void PerformOnDragFinish(const ServerWindow* window) = 0;
86 };
87
88 } // namespace ws
89 } // namespace ui
90
91 #endif // SERVICES_UI_WS_DRAG_TARGET_CONNECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698