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

Side by Side Diff: ui/aura/mus/drag_drop_controller_mus.h

Issue 2455963006: Wires up drag/drop for aura-mus (Closed)
Patch Set: twweaks Created 4 years, 1 month 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
« no previous file with comments | « ui/aura/mus/drag_drop_controller_host.h ('k') | ui/aura/mus/drag_drop_controller_mus.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 UI_AURA_MUS_DRAG_DROP_CONTROLLER_MUS_H_
6 #define UI_AURA_MUS_DRAG_DROP_CONTROLLER_MUS_H_
7
8 #include <stdint.h>
9
10 #include <map>
11 #include <memory>
12 #include <vector>
13
14 #include "ui/aura/client/drag_drop_client.h"
15 #include "ui/aura/window_tracker.h"
16 #include "ui/base/dragdrop/drag_drop_types.h"
17
18 namespace ui {
19 class DropTargetEvent;
20 class LocatedEvent;
21 class OSExchangeData;
22
23 namespace mojom {
24 class WindowTree;
25 }
26 }
27
28 namespace aura {
29
30 class DragDropControllerHost;
31 class WindowMus;
32
33 // DragDropControllerMus acts as the DragDropClient for aura as well as
34 // handling all drag operations from the server. Drag operations are forwarded
35 // to the client::DragDropDelegate set on the target Window.
36 class DragDropControllerMus : public client::DragDropClient {
37 public:
38 DragDropControllerMus(DragDropControllerHost* drag_drop_controller_host,
39 ui::mojom::WindowTree* window_tree);
40 ~DragDropControllerMus() override;
41
42 // Returns true if a drag was initiated and |id| identifies the change if of
43 // the drag.
44 bool DoesChangeIdMatchDragChangeId(uint32_t id) const;
45
46 // Forwarded from WindowTreeClient. These correspond to the functions of the
47 // same name defined in ui::mojom::WindowTreeClient.
48 void OnDragDropStart(std::map<std::string, std::vector<uint8_t>> data);
49 uint32_t OnDragEnter(WindowMus* window,
50 uint32_t event_flags,
51 const gfx::Point& screen_location,
52 uint32_t effect_bitmask);
53 uint32_t OnDragOver(WindowMus* window,
54 uint32_t event_flags,
55 const gfx::Point& screen_location,
56 uint32_t effect_bitmask);
57 void OnDragLeave(WindowMus* window);
58 uint32_t OnCompleteDrop(WindowMus* window,
59 uint32_t event_flags,
60 const gfx::Point& screen_location,
61 uint32_t effect_bitmask);
62 void OnPerformDragDropCompleted(uint32_t action_taken);
63 void OnDragDropDone();
64
65 // Overridden from client::DragDropClient:
66 int StartDragAndDrop(const ui::OSExchangeData& data,
67 Window* root_window,
68 Window* source_window,
69 const gfx::Point& screen_location,
70 int drag_operations,
71 ui::DragDropTypes::DragEventSource source) override;
72 void DragCancel() override;
73 bool IsDragDropInProgress() override;
74
75 private:
76 struct CurrentDragState;
77
78 // Called from OnDragEnter() and OnDragOver().
79 uint32_t HandleDragEnterOrOver(WindowMus* window,
80 uint32_t event_flags,
81 const gfx::Point& screen_location,
82 uint32_t effect_bitmask,
83 bool is_enter);
84
85 std::unique_ptr<ui::DropTargetEvent> CreateDropTargetEvent(
86 Window* window,
87 uint32_t event_flags,
88 const gfx::Point& screen_location,
89 uint32_t effect_bitmask);
90
91 DragDropControllerHost* drag_drop_controller_host_;
92
93 ui::mojom::WindowTree* window_tree_;
94
95 // State related to being the initiator of a drag started with
96 // PerformDragDrop(). If non-null a drag was started by this client and is
97 // still in progress. This references a value declared on the stack in
98 // StartDragAndDrop().
99 CurrentDragState* current_drag_state_ = nullptr;
100
101 // The entire drag data payload. We receive this during the drag enter event
102 // and cache it so we don't send this multiple times. This value is reset when
103 // the drag is done.
104 std::unique_ptr<ui::OSExchangeData> os_exchange_data_;
105
106 // Used to track the current drop target.
107 WindowTracker drop_target_window_tracker_;
108
109 DISALLOW_COPY_AND_ASSIGN(DragDropControllerMus);
110 };
111
112 } // namespace aura
113
114 #endif // UI_AURA_MUS_DRAG_DROP_CONTROLLER_MUS_H_
OLDNEW
« no previous file with comments | « ui/aura/mus/drag_drop_controller_host.h ('k') | ui/aura/mus/drag_drop_controller_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698