| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // is focused. | 171 // is focused. |
| 172 Window* GetFocusedWindow(); | 172 Window* GetFocusedWindow(); |
| 173 | 173 |
| 174 // Sets focus to null. This does nothing if focus is currently null. | 174 // Sets focus to null. This does nothing if focus is currently null. |
| 175 void ClearFocus(); | 175 void ClearFocus(); |
| 176 | 176 |
| 177 // Returns the current location of the mouse on screen. Note: this method may | 177 // 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). | 178 // race the asynchronous initialization; but in that case we return (0, 0). |
| 179 gfx::Point GetCursorScreenPoint(); | 179 gfx::Point GetCursorScreenPoint(); |
| 180 | 180 |
| 181 // See description in window_tree.mojom. When an existing event observer is | 181 // 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 observer | 182 // updated or cleared then any future events from the server for that watcher |
| 183 // will be ignored. | 183 // will be ignored. |
| 184 void SetEventObserver(mojom::EventMatcherPtr matcher); | 184 void StartPointerWatcher(bool want_moves); |
| 185 void StopPointerWatcher(); |
| 185 | 186 |
| 186 // Performs a window move. |callback| will be asynchronously called with the | 187 // Performs a window move. |callback| will be asynchronously called with the |
| 187 // whether the move loop completed successfully. | 188 // whether the move loop completed successfully. |
| 188 void PerformWindowMove(Window* window, | 189 void PerformWindowMove(Window* window, |
| 189 ui::mojom::MoveLoopSource source, | 190 ui::mojom::MoveLoopSource source, |
| 190 const gfx::Point& cursor_location, | 191 const gfx::Point& cursor_location, |
| 191 const base::Callback<void(bool)>& callback); | 192 const base::Callback<void(bool)>& callback); |
| 192 | 193 |
| 193 // Cancels a in progress window move. (If no window is currently being moved, | 194 // Cancels a in progress window move. (If no window is currently being moved, |
| 194 // does nothing.) | 195 // does nothing.) |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 void OnWindowOpacityChanged(Id window_id, | 303 void OnWindowOpacityChanged(Id window_id, |
| 303 float old_opacity, | 304 float old_opacity, |
| 304 float new_opacity) override; | 305 float new_opacity) override; |
| 305 void OnWindowParentDrawnStateChanged(Id window_id, bool drawn) override; | 306 void OnWindowParentDrawnStateChanged(Id window_id, bool drawn) override; |
| 306 void OnWindowSharedPropertyChanged(Id window_id, | 307 void OnWindowSharedPropertyChanged(Id window_id, |
| 307 const mojo::String& name, | 308 const mojo::String& name, |
| 308 mojo::Array<uint8_t> new_data) override; | 309 mojo::Array<uint8_t> new_data) override; |
| 309 void OnWindowInputEvent(uint32_t event_id, | 310 void OnWindowInputEvent(uint32_t event_id, |
| 310 Id window_id, | 311 Id window_id, |
| 311 std::unique_ptr<ui::Event> event, | 312 std::unique_ptr<ui::Event> event, |
| 312 uint32_t event_observer_id) override; | 313 uint32_t pointer_watcher_id) override; |
| 313 void OnEventObserved(std::unique_ptr<ui::Event> event, | 314 void OnPointerWatcherEvent(std::unique_ptr<ui::Event> event, |
| 314 uint32_t event_observer_id) override; | 315 uint32_t pointer_watcher_id) override; |
| 315 void OnWindowFocused(Id focused_window_id) override; | 316 void OnWindowFocused(Id focused_window_id) override; |
| 316 void OnWindowPredefinedCursorChanged(Id window_id, | 317 void OnWindowPredefinedCursorChanged(Id window_id, |
| 317 mojom::Cursor cursor) override; | 318 mojom::Cursor cursor) override; |
| 318 void OnChangeCompleted(uint32_t change_id, bool success) override; | 319 void OnChangeCompleted(uint32_t change_id, bool success) override; |
| 319 void RequestClose(uint32_t window_id) override; | 320 void RequestClose(uint32_t window_id) override; |
| 320 void GetWindowManager( | 321 void GetWindowManager( |
| 321 mojo::AssociatedInterfaceRequest<WindowManager> internal) override; | 322 mojo::AssociatedInterfaceRequest<WindowManager> internal) override; |
| 322 | 323 |
| 323 // Overridden from WindowManager: | 324 // Overridden from WindowManager: |
| 324 void OnConnect(ClientSpecificId client_id) override; | 325 void OnConnect(ClientSpecificId client_id) override; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 const base::Callback<void(bool)>& callback) override; | 357 const base::Callback<void(bool)>& callback) override; |
| 357 void RemoveAccelerator(uint32_t id) override; | 358 void RemoveAccelerator(uint32_t id) override; |
| 358 void AddActivationParent(Window* window) override; | 359 void AddActivationParent(Window* window) override; |
| 359 void RemoveActivationParent(Window* window) override; | 360 void RemoveActivationParent(Window* window) override; |
| 360 void ActivateNextWindow() override; | 361 void ActivateNextWindow() override; |
| 361 void SetUnderlaySurfaceOffsetAndExtendedHitArea( | 362 void SetUnderlaySurfaceOffsetAndExtendedHitArea( |
| 362 Window* window, | 363 Window* window, |
| 363 const gfx::Vector2d& offset, | 364 const gfx::Vector2d& offset, |
| 364 const gfx::Insets& hit_area) override; | 365 const gfx::Insets& hit_area) override; |
| 365 | 366 |
| 367 ui::PointerEvent* ConvertEventToPointerEvent(ui::Event* event); |
| 368 |
| 366 // The one int in |cursor_location_mapping_|. When we read from this | 369 // The one int in |cursor_location_mapping_|. When we read from this |
| 367 // location, we must always read from it atomically. | 370 // location, we must always read from it atomically. |
| 368 base::subtle::Atomic32* cursor_location_memory() { | 371 base::subtle::Atomic32* cursor_location_memory() { |
| 369 return reinterpret_cast<base::subtle::Atomic32*>( | 372 return reinterpret_cast<base::subtle::Atomic32*>( |
| 370 cursor_location_mapping_.get()); | 373 cursor_location_mapping_.get()); |
| 371 } | 374 } |
| 372 | 375 |
| 373 // This is set once and only once when we get OnEmbed(). It gives the unique | 376 // This is set once and only once when we get OnEmbed(). It gives the unique |
| 374 // id for this client. | 377 // id for this client. |
| 375 ClientSpecificId client_id_; | 378 ClientSpecificId client_id_; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 // A mapping to shared memory that is one 32 bit integer long. The window | 410 // A mapping to shared memory that is one 32 bit integer long. The window |
| 408 // server uses this to let us synchronously read the cursor location. | 411 // server uses this to let us synchronously read the cursor location. |
| 409 mojo::ScopedSharedBufferMapping cursor_location_mapping_; | 412 mojo::ScopedSharedBufferMapping cursor_location_mapping_; |
| 410 | 413 |
| 411 base::ObserverList<WindowTreeClientObserver> observers_; | 414 base::ObserverList<WindowTreeClientObserver> observers_; |
| 412 | 415 |
| 413 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>> | 416 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>> |
| 414 window_manager_internal_; | 417 window_manager_internal_; |
| 415 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; | 418 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; |
| 416 | 419 |
| 417 bool has_event_observer_ = false; | 420 bool has_pointer_watcher_ = false; |
| 418 | 421 |
| 419 // Monotonically increasing ID for event observers. | 422 // Monotonically increasing ID for pointer watchers. |
| 420 uint32_t event_observer_id_ = 0u; | 423 uint32_t pointer_watcher_id_ = 0u; |
| 421 | 424 |
| 422 // The current change id for the client. | 425 // The current change id for the client. |
| 423 uint32_t current_move_loop_change_ = 0u; | 426 uint32_t current_move_loop_change_ = 0u; |
| 424 | 427 |
| 425 // The current change id for the window manager. | 428 // The current change id for the window manager. |
| 426 uint32_t current_wm_move_loop_change_ = 0u; | 429 uint32_t current_wm_move_loop_change_ = 0u; |
| 427 Id current_wm_move_loop_window_id_ = 0u; | 430 Id current_wm_move_loop_window_id_ = 0u; |
| 428 | 431 |
| 429 // Callback executed when a move loop initiated by PerformWindowMove() is | 432 // Callback executed when a move loop initiated by PerformWindowMove() is |
| 430 // completed. | 433 // completed. |
| 431 base::Callback<void(bool)> on_current_move_finished_; | 434 base::Callback<void(bool)> on_current_move_finished_; |
| 432 | 435 |
| 433 base::WeakPtrFactory<WindowTreeClient> weak_factory_; | 436 base::WeakPtrFactory<WindowTreeClient> weak_factory_; |
| 434 | 437 |
| 435 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); | 438 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); |
| 436 }; | 439 }; |
| 437 | 440 |
| 438 } // namespace ui | 441 } // namespace ui |
| 439 | 442 |
| 440 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ | 443 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ |
| OLD | NEW |