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

Side by Side Diff: services/ui/ws/current_drag_operation.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 SERVICES_UI_WS_CURRENT_DRAG_OPERATION_H_
6 #define SERVICES_UI_WS_CURRENT_DRAG_OPERATION_H_
7
8 #include <deque>
9
10 #include "base/memory/weak_ptr.h"
11 #include "services/ui/common/types.h"
12 #include "services/ui/ws/ids.h"
13 #include "services/ui/ws/server_window_observer.h"
14
15 namespace ui {
16 namespace ws {
17
18 class CurrentDragOperationDelegate;
19 class WindowServer;
20 class WindowTree;
21
22 // Represents all the data around the current ongoing drag operation.
23 //
24 // There should only be one instance of this class per userid
25 class CurrentDragOperation : public ServerWindowObserver {
26 public:
27 CurrentDragOperation(CurrentDragOperationDelegate* delegate,
28 uint32_t change_id,
29 WindowTree* source_window_tree,
30 ServerWindow* source_window,
31 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data,
32 uint32_t drag_operations);
33 ~CurrentDragOperation() override;
34
35 void DispatchLocatedEvent(const ui::LocatedEvent& event,
36 ServerWindow* current_target,
37 const ClientSpecificId& client_id);
38
39 void MessageDragCompleted(bool success);
40
41 private:
42 struct Operation;
43
44 void DispatchFrontOfWindowQueue(ServerWindow* window,
45 std::deque<Operation>* queue);
46
47 // Overridden from ServerWindowObserver:
48 void OnWindowDestroying(ServerWindow* window) override;
49
50 // Callback methods.
51 void OnDragStatusCompleted(const WindowId& id, uint32_t bitmask);
52 void OnDragDropCompleted(const WindowId& id, uint32_t bitmask);
53
54 // Our owner.
55 CurrentDragOperationDelegate* delegate_ = nullptr;
56
57 uint32_t change_id_;
58
59 uint32_t drag_operations_;
60
61 bool waiting_for_final_drop_response_ = false;
62
63 WindowTree* source_window_tree_ = nullptr;
64
65 WindowServer* window_server_ = nullptr;
66
67 // The window which started the drag and which acts as the ipc source.
68 ServerWindow* source_window_ = nullptr;
69
70 ServerWindow* current_target_window_ = nullptr;
71
72 // A list of the offered mime types.
73 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data_;
74
75 // Event queues for each window. If a vector is empty, there are no
76 // operations going on. If a vector has one operation, we're waiting on a
77 // response for that operation from the client. Every operation past the
78 // first is queued.
79 std::map<ServerWindow*, std::deque<Operation>> current_window_state_;
80
81 base::WeakPtrFactory<CurrentDragOperation> weak_factory_;
82
83 DISALLOW_COPY_AND_ASSIGN(CurrentDragOperation);
84 };
85
86 } // namespace ws
87 } // namespace ui
88
89 #endif // SERVICES_UI_WS_CURRENT_DRAG_OPERATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698