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) override; | 104 mojom::EventMatcherPtr event_matcher) override; |
101 void RemoveAccelerator(uint32_t id) override; | 105 void RemoveAccelerator(uint32_t id) override; |
102 void AddActivationParent(uint32_t window_id) override; | 106 void AddActivationParent(uint32_t window_id) override; |
103 void RemoveActivationParent(uint32_t window_id) override; | 107 void RemoveActivationParent(uint32_t window_id) override; |
104 void ActivateNextWindow() override; | 108 void ActivateNextWindow() override; |
105 void SetUnderlaySurfaceOffsetAndExtendedHitArea( | 109 void SetUnderlaySurfaceOffsetAndExtendedHitArea( |
106 Id window_id, | 110 Id window_id, |
107 int32_t x_offset, | 111 int32_t x_offset, |
108 int32_t y_offset, | 112 int32_t y_offset, |
109 mojo::InsetsPtr hit_area) override; | 113 mojo::InsetsPtr hit_area) override; |
110 | 114 |
111 void OnEventAck(mojom::WindowTree* tree); | 115 void OnEventAck(mojom::WindowTree* tree); |
112 | 116 |
113 private: | 117 private: |
114 friend class WindowTreeTest; | 118 friend class WindowTreeTest; |
115 | 119 |
116 void OnClientClosed(); | 120 void OnClientClosed(); |
117 void OnEventAckTimeout(); | 121 void OnEventAckTimeout(); |
118 void DispatchNextEventFromQueue(); | 122 void DispatchNextEventFromQueue(); |
119 | 123 |
| 124 void UpdateNativeCursor(int32_t cursor_id); |
| 125 |
120 // DisplayManagerDelegate: | 126 // DisplayManagerDelegate: |
121 ServerWindow* GetRootWindow() override; | 127 ServerWindow* GetRootWindow() override; |
122 void OnEvent(mojom::EventPtr event) override; | 128 void OnEvent(mojom::EventPtr event) override; |
123 void OnDisplayClosed() override; | 129 void OnDisplayClosed() override; |
124 void OnViewportMetricsChanged( | 130 void OnViewportMetricsChanged( |
125 const mojom::ViewportMetrics& old_metrics, | 131 const mojom::ViewportMetrics& old_metrics, |
126 const mojom::ViewportMetrics& new_metrics) override; | 132 const mojom::ViewportMetrics& new_metrics) override; |
127 void OnTopLevelSurfaceChanged(cc::SurfaceId surface_id) override; | 133 void OnTopLevelSurfaceChanged(cc::SurfaceId surface_id) override; |
128 void OnCompositorFrameDrawn() override; | 134 void OnCompositorFrameDrawn() override; |
129 | 135 |
(...skipping 21 matching lines...) Expand all Loading... |
151 WindowTreeHostDelegate* delegate_; | 157 WindowTreeHostDelegate* delegate_; |
152 ConnectionManager* const connection_manager_; | 158 ConnectionManager* const connection_manager_; |
153 mojom::WindowTreeHostClientPtr client_; | 159 mojom::WindowTreeHostClientPtr client_; |
154 EventDispatcher event_dispatcher_; | 160 EventDispatcher event_dispatcher_; |
155 scoped_ptr<ServerWindow> root_; | 161 scoped_ptr<ServerWindow> root_; |
156 scoped_ptr<DisplayManager> display_manager_; | 162 scoped_ptr<DisplayManager> display_manager_; |
157 scoped_ptr<FocusController> focus_controller_; | 163 scoped_ptr<FocusController> focus_controller_; |
158 mojom::WindowManagerPtr window_manager_; | 164 mojom::WindowManagerPtr window_manager_; |
159 mojom::WindowTree* tree_awaiting_input_ack_; | 165 mojom::WindowTree* tree_awaiting_input_ack_; |
160 | 166 |
| 167 // The last cursor set. Used to track whether we need to change the cursor. |
| 168 int32_t last_cursor_; |
| 169 |
161 std::set<WindowId> activation_parents_; | 170 std::set<WindowId> activation_parents_; |
162 | 171 |
163 // Set of windows with surfaces that need to be destroyed once the frame | 172 // Set of windows with surfaces that need to be destroyed once the frame |
164 // draws. | 173 // draws. |
165 std::set<ServerWindow*> windows_needing_frame_destruction_; | 174 std::set<ServerWindow*> windows_needing_frame_destruction_; |
166 | 175 |
167 std::queue<mojom::EventPtr> event_queue_; | 176 std::queue<mojom::EventPtr> event_queue_; |
168 base::OneShotTimer event_ack_timer_; | 177 base::OneShotTimer event_ack_timer_; |
169 | 178 |
170 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostImpl); | 179 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostImpl); |
171 }; | 180 }; |
172 | 181 |
173 } // namespace ws | 182 } // namespace ws |
174 } // namespace mus | 183 } // namespace mus |
175 | 184 |
176 #endif // COMPONENTS_MUS_WS_WINDOW_TREE_HOST_IMPL_H_ | 185 #endif // COMPONENTS_MUS_WS_WINDOW_TREE_HOST_IMPL_H_ |
OLD | NEW |