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

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: sky 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
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 OnDragMimeTypes(
322 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data) override;
323 void OnDragEnter(Id window_id,
324 uint32_t event_flags,
325 const gfx::Point& position,
326 uint32_t effect_bitmask,
327 const OnDragEnterCallback& callback) override;
328 void OnDragOver(Id window_id,
329 uint32_t event_flags,
330 const gfx::Point& position,
331 uint32_t effect_bitmask,
332 const OnDragOverCallback& callback) override;
333 void OnDragLeave(Id window_id) override;
334 void OnCompleteDrop(Id window_id,
335 uint32_t event_flags,
336 const gfx::Point& position,
337 uint32_t effect_bitmask,
338 const OnCompleteDropCallback& callback) override;
339 void OnDragFinish() override;
311 void OnChangeCompleted(uint32_t change_id, bool success) override; 340 void OnChangeCompleted(uint32_t change_id, bool success) override;
312 void RequestClose(uint32_t window_id) override; 341 void RequestClose(uint32_t window_id) override;
313 void GetWindowManager( 342 void GetWindowManager(
314 mojo::AssociatedInterfaceRequest<WindowManager> internal) override; 343 mojo::AssociatedInterfaceRequest<WindowManager> internal) override;
315 344
316 // Overridden from WindowManager: 345 // Overridden from WindowManager:
317 void OnConnect(ClientSpecificId client_id) override; 346 void OnConnect(ClientSpecificId client_id) override;
318 void WmNewDisplayAdded(const display::Display& display, 347 void WmNewDisplayAdded(const display::Display& display,
319 mojom::WindowDataPtr root_data, 348 mojom::WindowDataPtr root_data,
320 bool parent_drawn) override; 349 bool parent_drawn) override;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 435
407 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>> 436 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>>
408 window_manager_internal_; 437 window_manager_internal_;
409 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; 438 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_;
410 439
411 bool has_pointer_watcher_ = false; 440 bool has_pointer_watcher_ = false;
412 441
413 // The current change id for the client. 442 // The current change id for the client.
414 uint32_t current_move_loop_change_ = 0u; 443 uint32_t current_move_loop_change_ = 0u;
415 444
445 // Callback executed when a move loop initiated by PerformWindowMove() is
446 // completed.
447 base::Callback<void(bool)> on_current_move_finished_;
448
416 // The current change id for the window manager. 449 // The current change id for the window manager.
417 uint32_t current_wm_move_loop_change_ = 0u; 450 uint32_t current_wm_move_loop_change_ = 0u;
418 Id current_wm_move_loop_window_id_ = 0u; 451 Id current_wm_move_loop_window_id_ = 0u;
419 452
420 // Callback executed when a move loop initiated by PerformWindowMove() is 453 // The current change id of the current drag an drop ipc.
421 // completed. 454 uint32_t current_drag_change_ = 0u;
sky 2016/09/13 18:15:31 Move current_drag_change_ and on_current_drag_fini
422 base::Callback<void(bool)> on_current_move_finished_; 455
456 // TODO(erg): OnDragStart() AS PART OF THE MUS/CLIENT INTERFACE SHOULD BE
457 // RENAMED.
458
459 // The mus server sends the mime drag data once per connection; we cache this
460 // on
461 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_drag_data_;
462
463 std::set<Id> entered_windows_;
sky 2016/09/13 18:15:31 Add description. optional: include drag in the nam
464
465 // Callback executed when a drag initiated by PerformDragDrop() is completed.
466 base::Callback<void(bool)> on_current_drag_finished_;
423 467
424 base::WeakPtrFactory<WindowTreeClient> weak_factory_; 468 base::WeakPtrFactory<WindowTreeClient> weak_factory_;
425 469
426 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); 470 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient);
427 }; 471 };
428 472
429 } // namespace ui 473 } // namespace ui
430 474
431 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ 475 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698