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 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. This call blocks but spins up a nested message | |
sky
2016/06/29 00:04:08
Update comment (no longer blocks).
| |
185 // loop to handle incoming move messages. | |
186 void PerformWindowMove(Window* window, | |
187 ::mus::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 ::mus::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, | 349 void SetNonClientCursor(Window* window, |
331 mus::mojom::Cursor cursor_id) override; | 350 mus::mojom::Cursor cursor_id) override; |
332 void AddAccelerator(uint32_t id, | 351 void AddAccelerator(uint32_t id, |
333 mojom::EventMatcherPtr event_matcher, | 352 mojom::EventMatcherPtr event_matcher, |
334 const base::Callback<void(bool)>& callback) override; | 353 const base::Callback<void(bool)>& callback) override; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
390 | 409 |
391 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>> | 410 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>> |
392 window_manager_internal_; | 411 window_manager_internal_; |
393 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; | 412 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; |
394 | 413 |
395 bool has_event_observer_ = false; | 414 bool has_event_observer_ = false; |
396 | 415 |
397 // Monotonically increasing ID for event observers. | 416 // Monotonically increasing ID for event observers. |
398 uint32_t event_observer_id_ = 0u; | 417 uint32_t event_observer_id_ = 0u; |
399 | 418 |
419 uint32_t current_move_loop_change_ = 0u; | |
420 | |
421 // Callback executed when a move loop initiated by PerformWindowMove() is | |
422 // completed. | |
423 base::Callback<void(bool)> on_current_move_finished_; | |
424 | |
400 base::WeakPtrFactory<WindowTreeClient> weak_factory_; | 425 base::WeakPtrFactory<WindowTreeClient> weak_factory_; |
401 | 426 |
402 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); | 427 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); |
403 }; | 428 }; |
404 | 429 |
405 } // namespace mus | 430 } // namespace mus |
406 | 431 |
407 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ | 432 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ |
OLD | NEW |