| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_WS_WINDOW_TREE_HOST_IMPL_H_ | 5 #ifndef COMPONENTS_MUS_WS_WINDOW_TREE_HOST_IMPL_H_ |
| 6 #define COMPONENTS_MUS_WS_WINDOW_TREE_HOST_IMPL_H_ | 6 #define COMPONENTS_MUS_WS_WINDOW_TREE_HOST_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "components/mus/common/types.h" | 10 #include "components/mus/common/types.h" |
| 11 #include "components/mus/public/interfaces/window_tree_host.mojom.h" | 11 #include "components/mus/public/interfaces/window_tree_host.mojom.h" |
| 12 #include "components/mus/ws/display_manager.h" | 12 #include "components/mus/ws/display_manager.h" |
| 13 #include "components/mus/ws/event_dispatcher.h" | 13 #include "components/mus/ws/event_dispatcher.h" |
| 14 #include "components/mus/ws/event_dispatcher_delegate.h" | 14 #include "components/mus/ws/event_dispatcher_delegate.h" |
| 15 #include "components/mus/ws/focus_controller_delegate.h" |
| 15 #include "components/mus/ws/focus_controller_observer.h" | 16 #include "components/mus/ws/focus_controller_observer.h" |
| 16 #include "components/mus/ws/server_window.h" | 17 #include "components/mus/ws/server_window.h" |
| 17 #include "components/mus/ws/server_window_observer.h" | 18 #include "components/mus/ws/server_window_observer.h" |
| 18 | 19 |
| 19 namespace mus { | 20 namespace mus { |
| 20 namespace ws { | 21 namespace ws { |
| 21 | 22 |
| 22 class ConnectionManager; | 23 class ConnectionManager; |
| 23 class FocusController; | 24 class FocusController; |
| 24 class WindowTreeHostDelegate; | 25 class WindowTreeHostDelegate; |
| 25 class WindowTreeImpl; | 26 class WindowTreeImpl; |
| 26 | 27 |
| 27 // WindowTreeHostImpl is an implementation of the WindowTreeHost interface. | 28 // WindowTreeHostImpl is an implementation of the WindowTreeHost interface. |
| 28 // It serves as a top level root window for a window. Its lifetime is managed by | 29 // It serves as a top level root window for a window. Its lifetime is managed by |
| 29 // ConnectionManager. If the connection to the client breaks or if the user | 30 // ConnectionManager. If the connection to the client breaks or if the user |
| 30 // closes the associated window, then this object and related state will be | 31 // closes the associated window, then this object and related state will be |
| 31 // deleted. | 32 // deleted. |
| 32 class WindowTreeHostImpl : public DisplayManagerDelegate, | 33 class WindowTreeHostImpl : public DisplayManagerDelegate, |
| 33 public mojom::WindowTreeHost, | 34 public mojom::WindowTreeHost, |
| 34 public FocusControllerObserver, | 35 public FocusControllerObserver, |
| 36 public FocusControllerDelegate, |
| 35 public EventDispatcherDelegate, | 37 public EventDispatcherDelegate, |
| 36 public ServerWindowObserver { | 38 public ServerWindowObserver { |
| 37 public: | 39 public: |
| 38 // TODO(fsamuel): All these parameters are just plumbing for creating | 40 // TODO(fsamuel): All these parameters are just plumbing for creating |
| 39 // DisplayManagers. We should probably just store these common parameters | 41 // DisplayManagers. We should probably just store these common parameters |
| 40 // in the DisplayManagerFactory and pass them along on DisplayManager::Create. | 42 // in the DisplayManagerFactory and pass them along on DisplayManager::Create. |
| 41 WindowTreeHostImpl(mojom::WindowTreeHostClientPtr client, | 43 WindowTreeHostImpl(mojom::WindowTreeHostClientPtr client, |
| 42 ConnectionManager* connection_manager, | 44 ConnectionManager* connection_manager, |
| 43 mojo::ApplicationImpl* app_impl, | 45 mojo::ApplicationImpl* app_impl, |
| 44 const scoped_refptr<GpuState>& gpu_state, | 46 const scoped_refptr<GpuState>& gpu_state, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 void UpdateTextInputState(ServerWindow* window, | 89 void UpdateTextInputState(ServerWindow* window, |
| 88 const ui::TextInputState& state); | 90 const ui::TextInputState& state); |
| 89 void SetImeVisibility(ServerWindow* window, bool visible); | 91 void SetImeVisibility(ServerWindow* window, bool visible); |
| 90 | 92 |
| 91 // WindowTreeHost: | 93 // WindowTreeHost: |
| 92 void SetSize(mojo::SizePtr size) override; | 94 void SetSize(mojo::SizePtr size) override; |
| 93 void SetTitle(const mojo::String& title) override; | 95 void SetTitle(const mojo::String& title) override; |
| 94 void AddAccelerator(uint32_t id, | 96 void AddAccelerator(uint32_t id, |
| 95 mojom::EventMatcherPtr event_matcher) override; | 97 mojom::EventMatcherPtr event_matcher) override; |
| 96 void RemoveAccelerator(uint32_t id) override; | 98 void RemoveAccelerator(uint32_t id) override; |
| 99 void AddActivationParent(uint32_t window_id) override; |
| 100 void RemoveActivationParent(uint32_t window_id) override; |
| 97 | 101 |
| 98 private: | 102 private: |
| 99 void OnClientClosed(); | 103 void OnClientClosed(); |
| 100 | 104 |
| 101 // DisplayManagerDelegate: | 105 // DisplayManagerDelegate: |
| 102 ServerWindow* GetRootWindow() override; | 106 ServerWindow* GetRootWindow() override; |
| 103 void OnEvent(mojom::EventPtr event) override; | 107 void OnEvent(mojom::EventPtr event) override; |
| 104 void OnDisplayClosed() override; | 108 void OnDisplayClosed() override; |
| 105 void OnViewportMetricsChanged( | 109 void OnViewportMetricsChanged( |
| 106 const mojom::ViewportMetrics& old_metrics, | 110 const mojom::ViewportMetrics& old_metrics, |
| 107 const mojom::ViewportMetrics& new_metrics) override; | 111 const mojom::ViewportMetrics& new_metrics) override; |
| 108 void OnTopLevelSurfaceChanged(cc::SurfaceId surface_id) override; | 112 void OnTopLevelSurfaceChanged(cc::SurfaceId surface_id) override; |
| 109 void OnCompositorFrameDrawn() override; | 113 void OnCompositorFrameDrawn() override; |
| 110 | 114 |
| 115 // FocusControllerDelegate: |
| 116 bool CanHaveActiveChildren(ServerWindow* window) const override; |
| 117 |
| 111 // FocusControllerObserver: | 118 // FocusControllerObserver: |
| 119 void OnActivationChanged(ServerWindow* old_active_window, |
| 120 ServerWindow* new_active_window) override; |
| 112 void OnFocusChanged(FocusControllerChangeSource change_source, | 121 void OnFocusChanged(FocusControllerChangeSource change_source, |
| 113 ServerWindow* old_focused_window, | 122 ServerWindow* old_focused_window, |
| 114 ServerWindow* new_focused_window) override; | 123 ServerWindow* new_focused_window) override; |
| 115 | 124 |
| 116 // EventDispatcherDelegate: | 125 // EventDispatcherDelegate: |
| 117 void OnAccelerator(uint32_t accelerator_id, mojom::EventPtr event) override; | 126 void OnAccelerator(uint32_t accelerator_id, mojom::EventPtr event) override; |
| 118 void SetFocusedWindowFromEventDispatcher(ServerWindow* window) override; | 127 void SetFocusedWindowFromEventDispatcher(ServerWindow* window) override; |
| 119 ServerWindow* GetFocusedWindowForEventDispatcher() override; | 128 ServerWindow* GetFocusedWindowForEventDispatcher() override; |
| 120 void DispatchInputEventToWindow(ServerWindow* target, | 129 void DispatchInputEventToWindow(ServerWindow* target, |
| 121 bool in_nonclient_area, | 130 bool in_nonclient_area, |
| 122 mojom::EventPtr event) override; | 131 mojom::EventPtr event) override; |
| 123 | 132 |
| 124 // ServerWindowObserver: | 133 // ServerWindowObserver: |
| 125 void OnWindowDestroyed(ServerWindow* window) override; | 134 void OnWindowDestroyed(ServerWindow* window) override; |
| 126 | 135 |
| 127 WindowTreeHostDelegate* delegate_; | 136 WindowTreeHostDelegate* delegate_; |
| 128 ConnectionManager* const connection_manager_; | 137 ConnectionManager* const connection_manager_; |
| 129 mojom::WindowTreeHostClientPtr client_; | 138 mojom::WindowTreeHostClientPtr client_; |
| 130 EventDispatcher event_dispatcher_; | 139 EventDispatcher event_dispatcher_; |
| 131 scoped_ptr<ServerWindow> root_; | 140 scoped_ptr<ServerWindow> root_; |
| 132 scoped_ptr<DisplayManager> display_manager_; | 141 scoped_ptr<DisplayManager> display_manager_; |
| 133 scoped_ptr<FocusController> focus_controller_; | 142 scoped_ptr<FocusController> focus_controller_; |
| 134 mojom::WindowManagerPtr window_manager_; | 143 mojom::WindowManagerPtr window_manager_; |
| 135 | 144 |
| 145 std::set<WindowId> activation_parents_; |
| 146 |
| 136 // Set of windows with surfaces that need to be destroyed once the frame | 147 // Set of windows with surfaces that need to be destroyed once the frame |
| 137 // draws. | 148 // draws. |
| 138 std::set<ServerWindow*> windows_needing_frame_destruction_; | 149 std::set<ServerWindow*> windows_needing_frame_destruction_; |
| 139 | 150 |
| 140 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostImpl); | 151 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostImpl); |
| 141 }; | 152 }; |
| 142 | 153 |
| 143 } // namespace ws | 154 } // namespace ws |
| 144 } // namespace mus | 155 } // namespace mus |
| 145 | 156 |
| 146 #endif // COMPONENTS_MUS_WS_WINDOW_TREE_HOST_IMPL_H_ | 157 #endif // COMPONENTS_MUS_WS_WINDOW_TREE_HOST_IMPL_H_ |
| OLD | NEW |