| 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 <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 const ServerWindow* root_window() const { return root_.get(); } | 86 const ServerWindow* root_window() const { return root_.get(); } |
| 87 | 87 |
| 88 void SetFocusedWindow(ServerWindow* window); | 88 void SetFocusedWindow(ServerWindow* window); |
| 89 ServerWindow* GetFocusedWindow(); | 89 ServerWindow* GetFocusedWindow(); |
| 90 void DestroyFocusController(); | 90 void DestroyFocusController(); |
| 91 | 91 |
| 92 void UpdateTextInputState(ServerWindow* window, | 92 void UpdateTextInputState(ServerWindow* window, |
| 93 const ui::TextInputState& state); | 93 const ui::TextInputState& state); |
| 94 void SetImeVisibility(ServerWindow* window, bool visible); | 94 void SetImeVisibility(ServerWindow* window, bool visible); |
| 95 | 95 |
| 96 // Called when a client updates a cursor. This will update the cursor on the |
| 97 // native display if the cursor is currently under |window|. |
| 98 void OnCursorUpdated(ServerWindow* window); |
| 99 |
| 96 // WindowTreeHost: | 100 // WindowTreeHost: |
| 97 void SetSize(mojo::SizePtr size) override; | 101 void SetSize(mojo::SizePtr size) override; |
| 98 void SetTitle(const mojo::String& title) override; | 102 void SetTitle(const mojo::String& title) override; |
| 99 void AddAccelerator(uint32_t id, | 103 void AddAccelerator(uint32_t id, |
| 100 mojom::EventMatcherPtr event_matcher, | 104 mojom::EventMatcherPtr event_matcher, |
| 101 const AddAcceleratorCallback& callback) override; | 105 const AddAcceleratorCallback& callback) override; |
| 102 void RemoveAccelerator(uint32_t id) override; | 106 void RemoveAccelerator(uint32_t id) override; |
| 103 void AddActivationParent(uint32_t window_id) override; | 107 void AddActivationParent(uint32_t window_id) override; |
| 104 void RemoveActivationParent(uint32_t window_id) override; | 108 void RemoveActivationParent(uint32_t window_id) override; |
| 105 void ActivateNextWindow() override; | 109 void ActivateNextWindow() override; |
| 106 void SetUnderlaySurfaceOffsetAndExtendedHitArea( | 110 void SetUnderlaySurfaceOffsetAndExtendedHitArea( |
| 107 Id window_id, | 111 Id window_id, |
| 108 int32_t x_offset, | 112 int32_t x_offset, |
| 109 int32_t y_offset, | 113 int32_t y_offset, |
| 110 mojo::InsetsPtr hit_area) override; | 114 mojo::InsetsPtr hit_area) override; |
| 111 | 115 |
| 112 void OnEventAck(mojom::WindowTree* tree); | 116 void OnEventAck(mojom::WindowTree* tree); |
| 113 | 117 |
| 114 private: | 118 private: |
| 115 friend class WindowTreeTest; | 119 friend class WindowTreeTest; |
| 116 | 120 |
| 117 void OnClientClosed(); | 121 void OnClientClosed(); |
| 118 void OnEventAckTimeout(); | 122 void OnEventAckTimeout(); |
| 119 void DispatchNextEventFromQueue(); | 123 void DispatchNextEventFromQueue(); |
| 120 | 124 |
| 125 void UpdateNativeCursor(int32_t cursor_id); |
| 126 |
| 121 // DisplayManagerDelegate: | 127 // DisplayManagerDelegate: |
| 122 ServerWindow* GetRootWindow() override; | 128 ServerWindow* GetRootWindow() override; |
| 123 void OnEvent(mojom::EventPtr event) override; | 129 void OnEvent(mojom::EventPtr event) override; |
| 124 void OnDisplayClosed() override; | 130 void OnDisplayClosed() override; |
| 125 void OnViewportMetricsChanged( | 131 void OnViewportMetricsChanged( |
| 126 const mojom::ViewportMetrics& old_metrics, | 132 const mojom::ViewportMetrics& old_metrics, |
| 127 const mojom::ViewportMetrics& new_metrics) override; | 133 const mojom::ViewportMetrics& new_metrics) override; |
| 128 void OnTopLevelSurfaceChanged(cc::SurfaceId surface_id) override; | 134 void OnTopLevelSurfaceChanged(cc::SurfaceId surface_id) override; |
| 129 void OnCompositorFrameDrawn() override; | 135 void OnCompositorFrameDrawn() override; |
| 130 | 136 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 152 WindowTreeHostDelegate* delegate_; | 158 WindowTreeHostDelegate* delegate_; |
| 153 ConnectionManager* const connection_manager_; | 159 ConnectionManager* const connection_manager_; |
| 154 mojom::WindowTreeHostClientPtr client_; | 160 mojom::WindowTreeHostClientPtr client_; |
| 155 EventDispatcher event_dispatcher_; | 161 EventDispatcher event_dispatcher_; |
| 156 scoped_ptr<ServerWindow> root_; | 162 scoped_ptr<ServerWindow> root_; |
| 157 scoped_ptr<DisplayManager> display_manager_; | 163 scoped_ptr<DisplayManager> display_manager_; |
| 158 scoped_ptr<FocusController> focus_controller_; | 164 scoped_ptr<FocusController> focus_controller_; |
| 159 mojom::WindowManagerPtr window_manager_; | 165 mojom::WindowManagerPtr window_manager_; |
| 160 mojom::WindowTree* tree_awaiting_input_ack_; | 166 mojom::WindowTree* tree_awaiting_input_ack_; |
| 161 | 167 |
| 168 // The last cursor set. Used to track whether we need to change the cursor. |
| 169 int32_t last_cursor_; |
| 170 |
| 162 std::set<WindowId> activation_parents_; | 171 std::set<WindowId> activation_parents_; |
| 163 | 172 |
| 164 // Set of windows with surfaces that need to be destroyed once the frame | 173 // Set of windows with surfaces that need to be destroyed once the frame |
| 165 // draws. | 174 // draws. |
| 166 std::set<ServerWindow*> windows_needing_frame_destruction_; | 175 std::set<ServerWindow*> windows_needing_frame_destruction_; |
| 167 | 176 |
| 168 std::queue<mojom::EventPtr> event_queue_; | 177 std::queue<mojom::EventPtr> event_queue_; |
| 169 base::OneShotTimer event_ack_timer_; | 178 base::OneShotTimer event_ack_timer_; |
| 170 | 179 |
| 171 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostImpl); | 180 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostImpl); |
| 172 }; | 181 }; |
| 173 | 182 |
| 174 } // namespace ws | 183 } // namespace ws |
| 175 } // namespace mus | 184 } // namespace mus |
| 176 | 185 |
| 177 #endif // COMPONENTS_MUS_WS_WINDOW_TREE_HOST_IMPL_H_ | 186 #endif // COMPONENTS_MUS_WS_WINDOW_TREE_HOST_IMPL_H_ |
| OLD | NEW |