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

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

Issue 2266603002: mus: Implement interwindow drag and drop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Uploaded for a few comments. 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 UI_VIEWS_MUS_DROP_TARGET_MUS_H_
6 #define UI_VIEWS_MUS_DROP_TARGET_MUS_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "services/ui/public/cpp/window_drop_target.h"
12 #include "ui/aura/window_observer.h"
13
14 namespace aura {
15 class RootWindow;
16 class Window;
17
18 namespace client {
19 class DragDropDelegate;
20 }
21 }
22
23 namespace ui {
24 class DropTargetEvent;
25 class OSExchangeData;
26 }
27
28 namespace views {
29
30 class DropTargetMus : public ui::WindowDropTarget, public aura::WindowObserver {
31 public:
32 DropTargetMus(aura::Window* root_window);
33 ~DropTargetMus() override;
34
35 private:
36 // Common functionality for the ui::DropTargetWin methods to translate from
37 // mus data types to Aura ones.
38 void Translate(uint32_t key_state,
39 const gfx::Point& position,
40 uint32_t effect_bitmask,
41 std::unique_ptr<ui::OSExchangeData>* data,
42 std::unique_ptr<ui::DropTargetEvent>* event,
43 aura::client::DragDropDelegate** delegate);
44
45 void NotifyDragLeave();
46
47 // Overridden from ui::WindowDropTarget:
48 uint32_t OnDragEnter(std::map<std::string, std::vector<uint8_t>> mime_types,
49 uint32_t key_state,
50 const gfx::Point& position,
51 uint32_t effect_bitmask) override;
52 uint32_t OnDragOver(uint32_t key_state,
53 const gfx::Point& position,
54 uint32_t effect_bitmask) override;
55 void OnDragLeave() override;
56 uint32_t OnDragDrop(uint32_t key_state,
57 const gfx::Point& position,
58 uint32_t effect_bitmask) override;
59
60 // Overridden from aura::WindowObserver:
61 void OnWindowDestroyed(aura::Window* window) override;
62
63 // The root window associated with this drop target.
64 aura::Window* root_window_;
65
66 // The Aura window that is currently under the cursor. We need to manually
67 // keep track of this because mus will only call our drag enter method once
68 // when the user enters the associated mus::Window. But inside mus there
69 // could be multiple aura windows, so we need to generate drag enter events
70 // for them.
71 aura::Window* target_window_;
72
73 // The entire drag data payload. We receive this during the drag enter event
74 // and cache it so we don't send this multiple times. We reset this value on
75 // leave or drop.
76 std::map<std::string, std::vector<uint8_t>> mime_data_;
77
78 DISALLOW_COPY_AND_ASSIGN(DropTargetMus);
79 };
80
81 } // namespace views
82
83 #endif // UI_VIEWS_MUS_DROP_TARGET_MUS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698