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/public/cpp/window_tree_client.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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ 5 #ifndef SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_
6 #define SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ 6 #define SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 const gfx::Rect& bounds); 101 const gfx::Rect& bounds);
102 void SetCapture(Window* window); 102 void SetCapture(Window* window);
103 void ReleaseCapture(Window* window); 103 void ReleaseCapture(Window* window);
104 void SetClientArea(Id window_id, 104 void SetClientArea(Id window_id,
105 const gfx::Insets& client_area, 105 const gfx::Insets& client_area,
106 const std::vector<gfx::Rect>& additional_client_areas); 106 const std::vector<gfx::Rect>& additional_client_areas);
107 void SetHitTestMask(Id window_id, const gfx::Rect& mask); 107 void SetHitTestMask(Id window_id, const gfx::Rect& mask);
108 void ClearHitTestMask(Id window_id); 108 void ClearHitTestMask(Id window_id);
109 void SetFocus(Window* window); 109 void SetFocus(Window* window);
110 void SetCanFocus(Id window_id, bool can_focus); 110 void SetCanFocus(Id window_id, bool can_focus);
111 void SetCanAcceptDrops(Id window_id, bool can_accept_drops);
111 void SetCanAcceptEvents(Id window_id, bool can_accept_events); 112 void SetCanAcceptEvents(Id window_id, bool can_accept_events);
112 void SetPredefinedCursor(Id window_id, ui::mojom::Cursor cursor_id); 113 void SetPredefinedCursor(Id window_id, ui::mojom::Cursor cursor_id);
113 void SetVisible(Window* window, bool visible); 114 void SetVisible(Window* window, bool visible);
114 void SetOpacity(Window* window, float opacity); 115 void SetOpacity(Window* window, float opacity);
115 void SetProperty(Window* window, 116 void SetProperty(Window* window,
116 const std::string& name, 117 const std::string& name,
117 mojo::Array<uint8_t> data); 118 mojo::Array<uint8_t> data);
118 void SetWindowTextInputState(Id window_id, mojo::TextInputStatePtr state); 119 void SetWindowTextInputState(Id window_id, mojo::TextInputStatePtr state);
119 void SetImeVisibility(Id window_id, 120 void SetImeVisibility(Id window_id,
120 bool visible, 121 bool visible,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // Returns the current location of the mouse on screen. Note: this method may 169 // Returns the current location of the mouse on screen. Note: this method may
169 // race the asynchronous initialization; but in that case we return (0, 0). 170 // race the asynchronous initialization; but in that case we return (0, 0).
170 gfx::Point GetCursorScreenPoint(); 171 gfx::Point GetCursorScreenPoint();
171 172
172 // See description in window_tree.mojom. When an existing pointer watcher is 173 // See description in window_tree.mojom. When an existing pointer watcher is
173 // updated or cleared then any future events from the server for that watcher 174 // updated or cleared then any future events from the server for that watcher
174 // will be ignored. 175 // will be ignored.
175 void StartPointerWatcher(bool want_moves); 176 void StartPointerWatcher(bool want_moves);
176 void StopPointerWatcher(); 177 void StopPointerWatcher();
177 178
179 void PerformDragDrop(
180 Window* window,
181 int drag_pointer,
182 const std::map<std::string, std::vector<uint8_t>>& drag_data,
183 int drag_operation,
184 const gfx::Point& cursor_location,
185 const SkBitmap& bitmap,
186 const base::Callback<void(bool)>& callback);
187
178 // Performs a window move. |callback| will be asynchronously called with the 188 // Performs a window move. |callback| will be asynchronously called with the
179 // whether the move loop completed successfully. 189 // whether the move loop completed successfully.
180 void PerformWindowMove(Window* window, 190 void PerformWindowMove(Window* window,
181 ui::mojom::MoveLoopSource source, 191 ui::mojom::MoveLoopSource source,
182 const gfx::Point& cursor_location, 192 const gfx::Point& cursor_location,
183 const base::Callback<void(bool)>& callback); 193 const base::Callback<void(bool)>& callback);
184 194
185 // Cancels a in progress window move. (If no window is currently being moved, 195 // Cancels a in progress window move. (If no window is currently being moved,
186 // does nothing.) 196 // does nothing.)
187 void CancelWindowMove(Window* window); 197 void CancelWindowMove(Window* window);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 mojo::Array<uint8_t> new_data) override; 311 mojo::Array<uint8_t> new_data) override;
302 void OnWindowInputEvent(uint32_t event_id, 312 void OnWindowInputEvent(uint32_t event_id,
303 Id window_id, 313 Id window_id,
304 std::unique_ptr<ui::Event> event, 314 std::unique_ptr<ui::Event> event,
305 bool matches_pointer_watcher) override; 315 bool matches_pointer_watcher) override;
306 void OnPointerEventObserved(std::unique_ptr<ui::Event> event, 316 void OnPointerEventObserved(std::unique_ptr<ui::Event> event,
307 uint32_t window_id) override; 317 uint32_t window_id) override;
308 void OnWindowFocused(Id focused_window_id) override; 318 void OnWindowFocused(Id focused_window_id) override;
309 void OnWindowPredefinedCursorChanged(Id window_id, 319 void OnWindowPredefinedCursorChanged(Id window_id,
310 mojom::Cursor cursor) override; 320 mojom::Cursor cursor) override;
321 void OnDragStart(
322 Id window_id,
323 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data) override;
324 void OnDragEnter(Id window_id,
325 uint32_t key_state,
326 const gfx::Point& position,
327 uint32_t effect_bitmask,
328 const OnDragEnterCallback& callback) override;
329 void OnDragOver(Id window_id,
330 uint32_t key_state,
331 const gfx::Point& position,
332 uint32_t effect_bitmask,
333 const OnDragOverCallback& callback) override;
334 void OnDragLeave(Id window_id) override;
335 void OnDragDrop(Id window_id,
336 uint32_t key_state,
337 const gfx::Point& position,
338 uint32_t effect_bitmask,
339 const OnDragDropCallback& callback) override;
340 void OnDragFinish(Id window_id) override;
311 void OnChangeCompleted(uint32_t change_id, bool success) override; 341 void OnChangeCompleted(uint32_t change_id, bool success) override;
312 void RequestClose(uint32_t window_id) override; 342 void RequestClose(uint32_t window_id) override;
313 void GetWindowManager( 343 void GetWindowManager(
314 mojo::AssociatedInterfaceRequest<WindowManager> internal) override; 344 mojo::AssociatedInterfaceRequest<WindowManager> internal) override;
315 345
316 // Overridden from WindowManager: 346 // Overridden from WindowManager:
317 void OnConnect(ClientSpecificId client_id) override; 347 void OnConnect(ClientSpecificId client_id) override;
318 void WmNewDisplayAdded(const display::Display& display, 348 void WmNewDisplayAdded(const display::Display& display,
319 mojom::WindowDataPtr root_data, 349 mojom::WindowDataPtr root_data,
320 bool parent_drawn) override; 350 bool parent_drawn) override;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 436
407 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>> 437 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>>
408 window_manager_internal_; 438 window_manager_internal_;
409 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; 439 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_;
410 440
411 bool has_pointer_watcher_ = false; 441 bool has_pointer_watcher_ = false;
412 442
413 // The current change id for the client. 443 // The current change id for the client.
414 uint32_t current_move_loop_change_ = 0u; 444 uint32_t current_move_loop_change_ = 0u;
415 445
446 // Callback executed when a move loop initiated by PerformWindowMove() is
447 // completed.
448 base::Callback<void(bool)> on_current_move_finished_;
449
416 // The current change id for the window manager. 450 // The current change id for the window manager.
417 uint32_t current_wm_move_loop_change_ = 0u; 451 uint32_t current_wm_move_loop_change_ = 0u;
418 Id current_wm_move_loop_window_id_ = 0u; 452 Id current_wm_move_loop_window_id_ = 0u;
419 453
420 // Callback executed when a move loop initiated by PerformWindowMove() is 454 // The current change id of the current drag an drop ipc.
421 // completed. 455 uint32_t current_drag_change_ = 0u;
422 base::Callback<void(bool)> on_current_move_finished_; 456
457 // Callback executed when a drag initiated by PerformDragDrop() is completed.
458 base::Callback<void(bool)> on_current_drag_finished_;
423 459
424 base::WeakPtrFactory<WindowTreeClient> weak_factory_; 460 base::WeakPtrFactory<WindowTreeClient> weak_factory_;
425 461
426 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); 462 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient);
427 }; 463 };
428 464
429 } // namespace ui 465 } // namespace ui
430 466
431 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ 467 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698