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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 174 |
175 // Returns the current location of the mouse on screen. Note: this method may | 175 // Returns the current location of the mouse on screen. Note: this method may |
176 // race the asynchronous initialization; but in that case we return (0, 0). | 176 // race the asynchronous initialization; but in that case we return (0, 0). |
177 gfx::Point GetCursorScreenPoint(); | 177 gfx::Point GetCursorScreenPoint(); |
178 | 178 |
179 // See description in window_tree.mojom. When an existing event observer is | 179 // See description in window_tree.mojom. When an existing event observer is |
180 // updated or cleared then any future events from the server for that observer | 180 // updated or cleared then any future events from the server for that observer |
181 // will be ignored. | 181 // will be ignored. |
182 void SetEventObserver(mojom::EventMatcherPtr matcher); | 182 void SetEventObserver(mojom::EventMatcherPtr matcher); |
183 | 183 |
| 184 // Performs a window move. |callback| will be asynchronously called with the |
| 185 // whether the move loop completed successfully. |
| 186 void PerformWindowMove(Window* window, |
| 187 ui::mojom::MoveLoopSource source, |
| 188 const gfx::Point& cursor_location, |
| 189 const base::Callback<void(bool)>& callback); |
| 190 |
| 191 // Cancels a in progress window move. (If no window is currently being moved, |
| 192 // does nothing.) |
| 193 void CancelWindowMove(Window* window); |
| 194 |
184 // Creates and returns a new Window (which is owned by the window server). | 195 // Creates and returns a new Window (which is owned by the window server). |
185 // Windows are initially hidden, use SetVisible(true) to show. | 196 // Windows are initially hidden, use SetVisible(true) to show. |
186 Window* NewWindow() { return NewWindow(nullptr); } | 197 Window* NewWindow() { return NewWindow(nullptr); } |
187 Window* NewWindow( | 198 Window* NewWindow( |
188 const std::map<std::string, std::vector<uint8_t>>* properties); | 199 const std::map<std::string, std::vector<uint8_t>>* properties); |
189 Window* NewTopLevelWindow( | 200 Window* NewTopLevelWindow( |
190 const std::map<std::string, std::vector<uint8_t>>* properties); | 201 const std::map<std::string, std::vector<uint8_t>>* properties); |
191 | 202 |
192 void AddObserver(WindowTreeClientObserver* observer); | 203 void AddObserver(WindowTreeClientObserver* observer); |
193 void RemoveObserver(WindowTreeClientObserver* observer); | 204 void RemoveObserver(WindowTreeClientObserver* observer); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 Id focused_window_id, | 252 Id focused_window_id, |
242 bool drawn); | 253 bool drawn); |
243 | 254 |
244 // Called by WmNewDisplayAdded(). | 255 // Called by WmNewDisplayAdded(). |
245 void WmNewDisplayAddedImpl(const display::Display& display, | 256 void WmNewDisplayAddedImpl(const display::Display& display, |
246 mojom::WindowDataPtr root_data, | 257 mojom::WindowDataPtr root_data, |
247 bool parent_drawn); | 258 bool parent_drawn); |
248 | 259 |
249 void OnReceivedCursorLocationMemory(mojo::ScopedSharedBufferHandle handle); | 260 void OnReceivedCursorLocationMemory(mojo::ScopedSharedBufferHandle handle); |
250 | 261 |
| 262 // Callback passed from WmPerformMoveLoop(). |
| 263 void OnWmMoveLoopCompleted(uint32_t change_id, bool completed); |
| 264 |
251 // Overridden from WindowTreeClient: | 265 // Overridden from WindowTreeClient: |
252 void OnEmbed(ClientSpecificId client_id, | 266 void OnEmbed(ClientSpecificId client_id, |
253 mojom::WindowDataPtr root, | 267 mojom::WindowDataPtr root, |
254 mojom::WindowTreePtr tree, | 268 mojom::WindowTreePtr tree, |
255 int64_t display_id, | 269 int64_t display_id, |
256 Id focused_window_id, | 270 Id focused_window_id, |
257 bool drawn) override; | 271 bool drawn) override; |
258 void OnEmbeddedAppDisconnected(Id window_id) override; | 272 void OnEmbeddedAppDisconnected(Id window_id) override; |
259 void OnUnembed(Id window_id) override; | 273 void OnUnembed(Id window_id) override; |
260 void OnLostCapture(Id window_id) override; | 274 void OnLostCapture(Id window_id) override; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 void WmSetProperty(uint32_t change_id, | 329 void WmSetProperty(uint32_t change_id, |
316 Id window_id, | 330 Id window_id, |
317 const mojo::String& name, | 331 const mojo::String& name, |
318 mojo::Array<uint8_t> transit_data) override; | 332 mojo::Array<uint8_t> transit_data) override; |
319 void WmCreateTopLevelWindow(uint32_t change_id, | 333 void WmCreateTopLevelWindow(uint32_t change_id, |
320 ClientSpecificId requesting_client_id, | 334 ClientSpecificId requesting_client_id, |
321 mojo::Map<mojo::String, mojo::Array<uint8_t>> | 335 mojo::Map<mojo::String, mojo::Array<uint8_t>> |
322 transport_properties) override; | 336 transport_properties) override; |
323 void WmClientJankinessChanged(ClientSpecificId client_id, | 337 void WmClientJankinessChanged(ClientSpecificId client_id, |
324 bool janky) override; | 338 bool janky) override; |
| 339 void WmPerformMoveLoop(uint32_t change_id, |
| 340 Id window_id, |
| 341 mojom::MoveLoopSource source, |
| 342 const gfx::Point& cursor_location) override; |
| 343 void WmCancelMoveLoop(uint32_t window_id) override; |
325 void OnAccelerator(uint32_t id, std::unique_ptr<ui::Event> event) override; | 344 void OnAccelerator(uint32_t id, std::unique_ptr<ui::Event> event) override; |
326 | 345 |
327 // Overridden from WindowManagerClient: | 346 // Overridden from WindowManagerClient: |
328 void SetFrameDecorationValues( | 347 void SetFrameDecorationValues( |
329 mojom::FrameDecorationValuesPtr values) override; | 348 mojom::FrameDecorationValuesPtr values) override; |
330 void SetNonClientCursor(Window* window, ui::mojom::Cursor cursor_id) override; | 349 void SetNonClientCursor(Window* window, ui::mojom::Cursor cursor_id) override; |
331 void AddAccelerator(uint32_t id, | 350 void AddAccelerator(uint32_t id, |
332 mojom::EventMatcherPtr event_matcher, | 351 mojom::EventMatcherPtr event_matcher, |
333 const base::Callback<void(bool)>& callback) override; | 352 const base::Callback<void(bool)>& callback) override; |
334 void RemoveAccelerator(uint32_t id) override; | 353 void RemoveAccelerator(uint32_t id) override; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 | 408 |
390 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>> | 409 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>> |
391 window_manager_internal_; | 410 window_manager_internal_; |
392 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; | 411 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; |
393 | 412 |
394 bool has_event_observer_ = false; | 413 bool has_event_observer_ = false; |
395 | 414 |
396 // Monotonically increasing ID for event observers. | 415 // Monotonically increasing ID for event observers. |
397 uint32_t event_observer_id_ = 0u; | 416 uint32_t event_observer_id_ = 0u; |
398 | 417 |
| 418 // The current change id for the client. |
| 419 uint32_t current_move_loop_change_ = 0u; |
| 420 |
| 421 // The current change id for the window manager. |
| 422 uint32_t current_wm_move_loop_change_ = 0u; |
| 423 Id current_wm_move_loop_window_id_ = 0u; |
| 424 |
| 425 // Callback executed when a move loop initiated by PerformWindowMove() is |
| 426 // completed. |
| 427 base::Callback<void(bool)> on_current_move_finished_; |
| 428 |
399 base::WeakPtrFactory<WindowTreeClient> weak_factory_; | 429 base::WeakPtrFactory<WindowTreeClient> weak_factory_; |
400 | 430 |
401 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); | 431 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); |
402 }; | 432 }; |
403 | 433 |
404 } // namespace ui | 434 } // namespace ui |
405 | 435 |
406 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ | 436 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ |
OLD | NEW |