OLD | NEW |
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 const gfx::Rect& bounds); | 106 const gfx::Rect& bounds); |
107 void SetCapture(Window* window); | 107 void SetCapture(Window* window); |
108 void ReleaseCapture(Window* window); | 108 void ReleaseCapture(Window* window); |
109 void SetClientArea(Id window_id, | 109 void SetClientArea(Id window_id, |
110 const gfx::Insets& client_area, | 110 const gfx::Insets& client_area, |
111 const std::vector<gfx::Rect>& additional_client_areas); | 111 const std::vector<gfx::Rect>& additional_client_areas); |
112 void SetHitTestMask(Id window_id, const gfx::Rect& mask); | 112 void SetHitTestMask(Id window_id, const gfx::Rect& mask); |
113 void ClearHitTestMask(Id window_id); | 113 void ClearHitTestMask(Id window_id); |
114 void SetFocus(Window* window); | 114 void SetFocus(Window* window); |
115 void SetCanFocus(Id window_id, bool can_focus); | 115 void SetCanFocus(Id window_id, bool can_focus); |
| 116 void SetCanAcceptDrags(Id window_id, bool can_accept_drags); |
116 void SetCanAcceptEvents(Id window_id, bool can_accept_events); | 117 void SetCanAcceptEvents(Id window_id, bool can_accept_events); |
117 void SetPredefinedCursor(Id window_id, ui::mojom::Cursor cursor_id); | 118 void SetPredefinedCursor(Id window_id, ui::mojom::Cursor cursor_id); |
118 void SetVisible(Window* window, bool visible); | 119 void SetVisible(Window* window, bool visible); |
119 void SetOpacity(Window* window, float opacity); | 120 void SetOpacity(Window* window, float opacity); |
120 void SetProperty(Window* window, | 121 void SetProperty(Window* window, |
121 const std::string& name, | 122 const std::string& name, |
122 mojo::Array<uint8_t> data); | 123 mojo::Array<uint8_t> data); |
123 void SetWindowTextInputState(Id window_id, mojo::TextInputStatePtr state); | 124 void SetWindowTextInputState(Id window_id, mojo::TextInputStatePtr state); |
124 void SetImeVisibility(Id window_id, | 125 void SetImeVisibility(Id window_id, |
125 bool visible, | 126 bool visible, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // Returns the current location of the mouse on screen. Note: this method may | 178 // Returns the current location of the mouse on screen. Note: this method may |
178 // race the asynchronous initialization; but in that case we return (0, 0). | 179 // race the asynchronous initialization; but in that case we return (0, 0). |
179 gfx::Point GetCursorScreenPoint(); | 180 gfx::Point GetCursorScreenPoint(); |
180 | 181 |
181 // See description in window_tree.mojom. When an existing pointer watcher is | 182 // See description in window_tree.mojom. When an existing pointer watcher is |
182 // updated or cleared then any future events from the server for that watcher | 183 // updated or cleared then any future events from the server for that watcher |
183 // will be ignored. | 184 // will be ignored. |
184 void StartPointerWatcher(bool want_moves); | 185 void StartPointerWatcher(bool want_moves); |
185 void StopPointerWatcher(); | 186 void StopPointerWatcher(); |
186 | 187 |
| 188 void PerformDragDrop( |
| 189 Window* window, |
| 190 const std::map<std::string, std::vector<uint8_t>>& drag_data, |
| 191 int drag_operation, |
| 192 const gfx::Point& cursor_location, |
| 193 const SkBitmap& bitmap, |
| 194 const base::Callback<void(bool)>& callback); |
| 195 |
187 // Performs a window move. |callback| will be asynchronously called with the | 196 // Performs a window move. |callback| will be asynchronously called with the |
188 // whether the move loop completed successfully. | 197 // whether the move loop completed successfully. |
189 void PerformWindowMove(Window* window, | 198 void PerformWindowMove(Window* window, |
190 ui::mojom::MoveLoopSource source, | 199 ui::mojom::MoveLoopSource source, |
191 const gfx::Point& cursor_location, | 200 const gfx::Point& cursor_location, |
192 const base::Callback<void(bool)>& callback); | 201 const base::Callback<void(bool)>& callback); |
193 | 202 |
194 // Cancels a in progress window move. (If no window is currently being moved, | 203 // Cancels a in progress window move. (If no window is currently being moved, |
195 // does nothing.) | 204 // does nothing.) |
196 void CancelWindowMove(Window* window); | 205 void CancelWindowMove(Window* window); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 mojo::Array<uint8_t> new_data) override; | 319 mojo::Array<uint8_t> new_data) override; |
311 void OnWindowInputEvent(uint32_t event_id, | 320 void OnWindowInputEvent(uint32_t event_id, |
312 Id window_id, | 321 Id window_id, |
313 std::unique_ptr<ui::Event> event, | 322 std::unique_ptr<ui::Event> event, |
314 bool matches_pointer_watcher) override; | 323 bool matches_pointer_watcher) override; |
315 void OnPointerEventObserved(std::unique_ptr<ui::Event> event, | 324 void OnPointerEventObserved(std::unique_ptr<ui::Event> event, |
316 uint32_t window_id) override; | 325 uint32_t window_id) override; |
317 void OnWindowFocused(Id focused_window_id) override; | 326 void OnWindowFocused(Id focused_window_id) override; |
318 void OnWindowPredefinedCursorChanged(Id window_id, | 327 void OnWindowPredefinedCursorChanged(Id window_id, |
319 mojom::Cursor cursor) override; | 328 mojom::Cursor cursor) override; |
| 329 void OnDragStart( |
| 330 Id window_id, |
| 331 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data) override; |
| 332 void OnDragEnter(Id window_id, |
| 333 uint32_t key_state, |
| 334 const gfx::Point& position, |
| 335 uint32_t effect_bitmask, |
| 336 const OnDragEnterCallback& callback) override; |
| 337 void OnDragOver(Id window_id, |
| 338 uint32_t key_state, |
| 339 const gfx::Point& position, |
| 340 uint32_t effect_bitmask, |
| 341 const OnDragOverCallback& callback) override; |
| 342 void OnDragLeave(Id window_id) override; |
| 343 void OnDragDrop(Id window_id, |
| 344 uint32_t key_state, |
| 345 const gfx::Point& position, |
| 346 uint32_t effect_bitmask, |
| 347 const OnDragDropCallback& callback) override; |
| 348 void OnDragFinish(Id window_id) override; |
320 void OnChangeCompleted(uint32_t change_id, bool success) override; | 349 void OnChangeCompleted(uint32_t change_id, bool success) override; |
321 void RequestClose(uint32_t window_id) override; | 350 void RequestClose(uint32_t window_id) override; |
322 void GetWindowManager( | 351 void GetWindowManager( |
323 mojo::AssociatedInterfaceRequest<WindowManager> internal) override; | 352 mojo::AssociatedInterfaceRequest<WindowManager> internal) override; |
324 | 353 |
325 // Overridden from WindowManager: | 354 // Overridden from WindowManager: |
326 void OnConnect(ClientSpecificId client_id) override; | 355 void OnConnect(ClientSpecificId client_id) override; |
327 void WmNewDisplayAdded(const display::Display& display, | 356 void WmNewDisplayAdded(const display::Display& display, |
328 mojom::WindowDataPtr root_data, | 357 mojom::WindowDataPtr root_data, |
329 bool parent_drawn) override; | 358 bool parent_drawn) override; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 | 443 |
415 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>> | 444 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>> |
416 window_manager_internal_; | 445 window_manager_internal_; |
417 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; | 446 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; |
418 | 447 |
419 bool has_pointer_watcher_ = false; | 448 bool has_pointer_watcher_ = false; |
420 | 449 |
421 // The current change id for the client. | 450 // The current change id for the client. |
422 uint32_t current_move_loop_change_ = 0u; | 451 uint32_t current_move_loop_change_ = 0u; |
423 | 452 |
| 453 // Callback executed when a move loop initiated by PerformWindowMove() is |
| 454 // completed. |
| 455 base::Callback<void(bool)> on_current_move_finished_; |
| 456 |
424 // The current change id for the window manager. | 457 // The current change id for the window manager. |
425 uint32_t current_wm_move_loop_change_ = 0u; | 458 uint32_t current_wm_move_loop_change_ = 0u; |
426 Id current_wm_move_loop_window_id_ = 0u; | 459 Id current_wm_move_loop_window_id_ = 0u; |
427 | 460 |
428 // Callback executed when a move loop initiated by PerformWindowMove() is | 461 // The current change id of the current drag an drop ipc. |
429 // completed. | 462 uint32_t current_drag_change_ = 0u; |
430 base::Callback<void(bool)> on_current_move_finished_; | 463 |
| 464 // Callback executed when a drag initiated by PerformDragDrop() is completed. |
| 465 base::Callback<void(bool)> on_current_drag_finished_; |
431 | 466 |
432 base::WeakPtrFactory<WindowTreeClient> weak_factory_; | 467 base::WeakPtrFactory<WindowTreeClient> weak_factory_; |
433 | 468 |
434 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); | 469 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); |
435 }; | 470 }; |
436 | 471 |
437 } // namespace ui | 472 } // namespace ui |
438 | 473 |
439 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ | 474 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ |
OLD | NEW |