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

Side by Side Diff: ui/views/mus/drop_target_mus.h

Issue 2323553002: mash: Use the new mus drag and drop API to get drag working in mash. (Closed)
Patch Set: Patch cleanup Created 4 years, 2 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 UI_VIEWS_MUS_DROP_TARGET_MUS_H_
6 #define UI_VIEWS_MUS_DROP_TARGET_MUS_H_
7
8 #include <map>
9 #include <memory>
10 #include <string>
11 #include <vector>
12
13 #include "base/macros.h"
14 #include "services/ui/public/cpp/window_drop_target.h"
15 #include "ui/aura/window_observer.h"
16
17 namespace aura {
18 class RootWindow;
19 class Window;
20
21 namespace client {
22 class DragDropDelegate;
23 }
24 }
25
26 namespace ui {
27 class DropTargetEvent;
28 class OSExchangeData;
29 }
30
31 namespace views {
32
33 // An adapter class which takes signals from mus' WindowDropTarget, performs
34 // targeting on the underlying aura::Window tree, and dispatches them to the
35 // aura DragDropDelegate of the targeted aura::Window.
36 class DropTargetMus : public ui::WindowDropTarget, public aura::WindowObserver {
37 public:
38 explicit DropTargetMus(aura::Window* root_window);
39 ~DropTargetMus() override;
40
41 private:
42 // Common functionality for the ui::DropTargetWin methods to translate from
sky 2016/09/23 16:14:09 DropTargetWin?
43 // mus data types to Aura ones.
44 void Translate(uint32_t key_state,
45 const gfx::Point& position,
sky 2016/09/23 16:14:08 If position is a screen location, please name it a
46 uint32_t effect_bitmask,
47 std::unique_ptr<ui::OSExchangeData>* data,
48 std::unique_ptr<ui::DropTargetEvent>* event,
49 aura::client::DragDropDelegate** delegate);
50
51 void NotifyDragLeave();
52
53 // Overridden from ui::WindowDropTarget:
54 void OnDragDropStart(
55 std::map<std::string, std::vector<uint8_t>> mime_data) override;
sky 2016/09/23 16:14:08 Just noticed this. How come this doesn't take a co
Elliot Glaysher 2016/09/23 21:40:48 To minimize the number of copies of an arbitrarily
56 uint32_t OnDragEnter(uint32_t key_state,
57 const gfx::Point& position,
58 uint32_t effect_bitmask) override;
59 uint32_t OnDragOver(uint32_t key_state,
60 const gfx::Point& position,
61 uint32_t effect_bitmask) override;
62 void OnDragLeave() override;
63 uint32_t OnCompleteDrop(uint32_t key_state,
64 const gfx::Point& position,
65 uint32_t effect_bitmask) override;
66 void OnDragDropDone() override;
67
68 // Overridden from aura::WindowObserver:
69 void OnWindowDestroyed(aura::Window* window) override;
70
71 // The root window associated with this drop target.
72 aura::Window* root_window_;
73
74 // The Aura window that is currently under the cursor. We need to manually
75 // keep track of this because mus will only call our drag enter method once
76 // when the user enters the associated mus::Window. But inside mus there
77 // could be multiple aura windows, so we need to generate drag enter events
78 // for them.
79 aura::Window* target_window_;
80
81 // The entire drag data payload. We receive this during the drag enter event
82 // and cache it so we don't send this multiple times. We reset this value on
83 // leave or drop.
84 std::map<std::string, std::vector<uint8_t>> mime_data_;
85
86 DISALLOW_COPY_AND_ASSIGN(DropTargetMus);
87 };
88
89 } // namespace views
90
91 #endif // UI_VIEWS_MUS_DROP_TARGET_MUS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698