| 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 COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ | 5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ |
| 6 #define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ | 6 #define COMPONENTS_MUS_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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // if the owner of the roots Embed()s another app in all the roots, or all | 52 // if the owner of the roots Embed()s another app in all the roots, or all |
| 53 // the roots are explicitly deleted. | 53 // the roots are explicitly deleted. |
| 54 // . The connection to mus is lost. | 54 // . The connection to mus is lost. |
| 55 // . Explicitly by way of calling delete. | 55 // . Explicitly by way of calling delete. |
| 56 // | 56 // |
| 57 // When WindowTreeClient is deleted all windows are deleted (and observers | 57 // When WindowTreeClient is deleted all windows are deleted (and observers |
| 58 // notified). This is followed by calling | 58 // notified). This is followed by calling |
| 59 // WindowTreeClientDelegate::OnWindowTreeClientDestroyed(). | 59 // WindowTreeClientDelegate::OnWindowTreeClientDestroyed(). |
| 60 class WindowTreeClient : public mojom::WindowTreeClient, | 60 class WindowTreeClient : public mojom::WindowTreeClient, |
| 61 public mojom::WindowManager, | 61 public mojom::WindowManager, |
| 62 public mojom::InputEventHandler, |
| 62 public WindowManagerClient { | 63 public WindowManagerClient { |
| 63 public: | 64 public: |
| 64 WindowTreeClient(WindowTreeClientDelegate* delegate, | 65 WindowTreeClient(WindowTreeClientDelegate* delegate, |
| 65 WindowManagerDelegate* window_manager_delegate, | 66 WindowManagerDelegate* window_manager_delegate, |
| 66 mojom::WindowTreeClientRequest request); | 67 mojom::WindowTreeClientRequest request); |
| 67 ~WindowTreeClient() override; | 68 ~WindowTreeClient() override; |
| 68 | 69 |
| 69 // Establishes the connection by way of the WindowTreeFactory. | 70 // Establishes the connection by way of the WindowTreeFactory. |
| 70 void ConnectViaWindowTreeFactory(shell::Connector* connector); | 71 void ConnectViaWindowTreeFactory(shell::Connector* connector); |
| 71 | 72 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 void OnWindowInputEvent(uint32_t event_id, | 294 void OnWindowInputEvent(uint32_t event_id, |
| 294 Id window_id, | 295 Id window_id, |
| 295 std::unique_ptr<ui::Event> event, | 296 std::unique_ptr<ui::Event> event, |
| 296 uint32_t event_observer_id) override; | 297 uint32_t event_observer_id) override; |
| 297 void OnEventObserved(std::unique_ptr<ui::Event> event, | 298 void OnEventObserved(std::unique_ptr<ui::Event> event, |
| 298 uint32_t event_observer_id) override; | 299 uint32_t event_observer_id) override; |
| 299 void OnWindowFocused(Id focused_window_id) override; | 300 void OnWindowFocused(Id focused_window_id) override; |
| 300 void OnWindowPredefinedCursorChanged(Id window_id, | 301 void OnWindowPredefinedCursorChanged(Id window_id, |
| 301 mojom::Cursor cursor) override; | 302 mojom::Cursor cursor) override; |
| 302 void OnChangeCompleted(uint32_t change_id, bool success) override; | 303 void OnChangeCompleted(uint32_t change_id, bool success) override; |
| 304 void RequestInputEventHandler( |
| 305 mojom::InputEventHandlerRequest request) override; |
| 303 void RequestClose(uint32_t window_id) override; | 306 void RequestClose(uint32_t window_id) override; |
| 304 void GetWindowManager( | 307 void GetWindowManager( |
| 305 mojo::AssociatedInterfaceRequest<WindowManager> internal) override; | 308 mojo::AssociatedInterfaceRequest<WindowManager> internal) override; |
| 306 | 309 |
| 307 // Overridden from WindowManager: | 310 // Overridden from WindowManager: |
| 308 void OnConnect(ClientSpecificId client_id) override; | 311 void OnConnect(ClientSpecificId client_id) override; |
| 309 void WmNewDisplayAdded(mojom::DisplayPtr display, | 312 void WmNewDisplayAdded(mojom::DisplayPtr display, |
| 310 mojom::WindowDataPtr root_data, | 313 mojom::WindowDataPtr root_data, |
| 311 bool parent_drawn) override; | 314 bool parent_drawn) override; |
| 312 void WmSetBounds(uint32_t change_id, | 315 void WmSetBounds(uint32_t change_id, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 334 const base::Callback<void(bool)>& callback) override; | 337 const base::Callback<void(bool)>& callback) override; |
| 335 void RemoveAccelerator(uint32_t id) override; | 338 void RemoveAccelerator(uint32_t id) override; |
| 336 void AddActivationParent(Window* window) override; | 339 void AddActivationParent(Window* window) override; |
| 337 void RemoveActivationParent(Window* window) override; | 340 void RemoveActivationParent(Window* window) override; |
| 338 void ActivateNextWindow() override; | 341 void ActivateNextWindow() override; |
| 339 void SetUnderlaySurfaceOffsetAndExtendedHitArea( | 342 void SetUnderlaySurfaceOffsetAndExtendedHitArea( |
| 340 Window* window, | 343 Window* window, |
| 341 const gfx::Vector2d& offset, | 344 const gfx::Vector2d& offset, |
| 342 const gfx::Insets& hit_area) override; | 345 const gfx::Insets& hit_area) override; |
| 343 | 346 |
| 347 // mojom::InputEventHandler: |
| 348 void OnInputEvent(uint32_t window_id, |
| 349 std::unique_ptr<ui::Event> event, |
| 350 const OnInputEventCallback& callback) override; |
| 351 |
| 344 // The one int in |cursor_location_mapping_|. When we read from this | 352 // The one int in |cursor_location_mapping_|. When we read from this |
| 345 // location, we must always read from it atomically. | 353 // location, we must always read from it atomically. |
| 346 base::subtle::Atomic32* cursor_location_memory() { | 354 base::subtle::Atomic32* cursor_location_memory() { |
| 347 return reinterpret_cast<base::subtle::Atomic32*>( | 355 return reinterpret_cast<base::subtle::Atomic32*>( |
| 348 cursor_location_mapping_.get()); | 356 cursor_location_mapping_.get()); |
| 349 } | 357 } |
| 350 | 358 |
| 351 // This is set once and only once when we get OnEmbed(). It gives the unique | 359 // This is set once and only once when we get OnEmbed(). It gives the unique |
| 352 // id for this client. | 360 // id for this client. |
| 353 ClientSpecificId client_id_; | 361 ClientSpecificId client_id_; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 384 | 392 |
| 385 // A mapping to shared memory that is one 32 bit integer long. The window | 393 // A mapping to shared memory that is one 32 bit integer long. The window |
| 386 // server uses this to let us synchronously read the cursor location. | 394 // server uses this to let us synchronously read the cursor location. |
| 387 mojo::ScopedSharedBufferMapping cursor_location_mapping_; | 395 mojo::ScopedSharedBufferMapping cursor_location_mapping_; |
| 388 | 396 |
| 389 base::ObserverList<WindowTreeClientObserver> observers_; | 397 base::ObserverList<WindowTreeClientObserver> observers_; |
| 390 | 398 |
| 391 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>> | 399 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>> |
| 392 window_manager_internal_; | 400 window_manager_internal_; |
| 393 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; | 401 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; |
| 402 mojo::Binding<mus::mojom::InputEventHandler> event_handler_binding_; |
| 394 | 403 |
| 395 bool has_event_observer_ = false; | 404 bool has_event_observer_ = false; |
| 396 | 405 |
| 397 // Monotonically increasing ID for event observers. | 406 // Monotonically increasing ID for event observers. |
| 398 uint32_t event_observer_id_ = 0u; | 407 uint32_t event_observer_id_ = 0u; |
| 399 | 408 |
| 400 base::WeakPtrFactory<WindowTreeClient> weak_factory_; | 409 base::WeakPtrFactory<WindowTreeClient> weak_factory_; |
| 401 | 410 |
| 402 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); | 411 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); |
| 403 }; | 412 }; |
| 404 | 413 |
| 405 } // namespace mus | 414 } // namespace mus |
| 406 | 415 |
| 407 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ | 416 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ |
| OLD | NEW |