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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // Sets focus to null. This does nothing if focus is currently null. | 172 // Sets focus to null. This does nothing if focus is currently null. |
173 void ClearFocus(); | 173 void ClearFocus(); |
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 uint32_t AddEventObserver(mojom::EventMatcherPtr matcher); |
| 183 void RemoveEventObserver(uint32_t event_observer_id); |
183 | 184 |
184 // Performs a window move. |callback| will be asynchronously called with the | 185 // Performs a window move. |callback| will be asynchronously called with the |
185 // whether the move loop completed successfully. | 186 // whether the move loop completed successfully. |
186 void PerformWindowMove(Window* window, | 187 void PerformWindowMove(Window* window, |
187 ui::mojom::MoveLoopSource source, | 188 ui::mojom::MoveLoopSource source, |
188 const gfx::Point& cursor_location, | 189 const gfx::Point& cursor_location, |
189 const base::Callback<void(bool)>& callback); | 190 const base::Callback<void(bool)>& callback); |
190 | 191 |
191 // Cancels a in progress window move. (If no window is currently being moved, | 192 // Cancels a in progress window move. (If no window is currently being moved, |
192 // does nothing.) | 193 // does nothing.) |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 void OnWindowOpacityChanged(Id window_id, | 301 void OnWindowOpacityChanged(Id window_id, |
301 float old_opacity, | 302 float old_opacity, |
302 float new_opacity) override; | 303 float new_opacity) override; |
303 void OnWindowParentDrawnStateChanged(Id window_id, bool drawn) override; | 304 void OnWindowParentDrawnStateChanged(Id window_id, bool drawn) override; |
304 void OnWindowSharedPropertyChanged(Id window_id, | 305 void OnWindowSharedPropertyChanged(Id window_id, |
305 const mojo::String& name, | 306 const mojo::String& name, |
306 mojo::Array<uint8_t> new_data) override; | 307 mojo::Array<uint8_t> new_data) override; |
307 void OnWindowInputEvent(uint32_t event_id, | 308 void OnWindowInputEvent(uint32_t event_id, |
308 Id window_id, | 309 Id window_id, |
309 std::unique_ptr<ui::Event> event, | 310 std::unique_ptr<ui::Event> event, |
310 uint32_t event_observer_id) override; | 311 mojo::Array<uint32_t> event_observer_ids) override; |
311 void OnEventObserved(std::unique_ptr<ui::Event> event, | 312 void OnEventObserved(std::unique_ptr<ui::Event> event, |
312 uint32_t event_observer_id) override; | 313 mojo::Array<uint32_t> event_observer_ids) override; |
313 void OnWindowFocused(Id focused_window_id) override; | 314 void OnWindowFocused(Id focused_window_id) override; |
314 void OnWindowPredefinedCursorChanged(Id window_id, | 315 void OnWindowPredefinedCursorChanged(Id window_id, |
315 mojom::Cursor cursor) override; | 316 mojom::Cursor cursor) override; |
316 void OnChangeCompleted(uint32_t change_id, bool success) override; | 317 void OnChangeCompleted(uint32_t change_id, bool success) override; |
317 void RequestClose(uint32_t window_id) override; | 318 void RequestClose(uint32_t window_id) override; |
318 void GetWindowManager( | 319 void GetWindowManager( |
319 mojo::AssociatedInterfaceRequest<WindowManager> internal) override; | 320 mojo::AssociatedInterfaceRequest<WindowManager> internal) override; |
320 | 321 |
321 // Overridden from WindowManager: | 322 // Overridden from WindowManager: |
322 void OnConnect(ClientSpecificId client_id) override; | 323 void OnConnect(ClientSpecificId client_id) override; |
(...skipping 29 matching lines...) Expand all Loading... |
352 const base::Callback<void(bool)>& callback) override; | 353 const base::Callback<void(bool)>& callback) override; |
353 void RemoveAccelerator(uint32_t id) override; | 354 void RemoveAccelerator(uint32_t id) override; |
354 void AddActivationParent(Window* window) override; | 355 void AddActivationParent(Window* window) override; |
355 void RemoveActivationParent(Window* window) override; | 356 void RemoveActivationParent(Window* window) override; |
356 void ActivateNextWindow() override; | 357 void ActivateNextWindow() override; |
357 void SetUnderlaySurfaceOffsetAndExtendedHitArea( | 358 void SetUnderlaySurfaceOffsetAndExtendedHitArea( |
358 Window* window, | 359 Window* window, |
359 const gfx::Vector2d& offset, | 360 const gfx::Vector2d& offset, |
360 const gfx::Insets& hit_area) override; | 361 const gfx::Insets& hit_area) override; |
361 | 362 |
| 363 // Returns true if there is an id in event_observer_ids_ that matches |
| 364 // this event_observer_id. |
| 365 bool MatchEventObserverId(uint32_t event_observer_id); |
| 366 |
362 // The one int in |cursor_location_mapping_|. When we read from this | 367 // The one int in |cursor_location_mapping_|. When we read from this |
363 // location, we must always read from it atomically. | 368 // location, we must always read from it atomically. |
364 base::subtle::Atomic32* cursor_location_memory() { | 369 base::subtle::Atomic32* cursor_location_memory() { |
365 return reinterpret_cast<base::subtle::Atomic32*>( | 370 return reinterpret_cast<base::subtle::Atomic32*>( |
366 cursor_location_mapping_.get()); | 371 cursor_location_mapping_.get()); |
367 } | 372 } |
368 | 373 |
369 // This is set once and only once when we get OnEmbed(). It gives the unique | 374 // This is set once and only once when we get OnEmbed(). It gives the unique |
370 // id for this client. | 375 // id for this client. |
371 ClientSpecificId client_id_; | 376 ClientSpecificId client_id_; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 // A mapping to shared memory that is one 32 bit integer long. The window | 408 // A mapping to shared memory that is one 32 bit integer long. The window |
404 // server uses this to let us synchronously read the cursor location. | 409 // server uses this to let us synchronously read the cursor location. |
405 mojo::ScopedSharedBufferMapping cursor_location_mapping_; | 410 mojo::ScopedSharedBufferMapping cursor_location_mapping_; |
406 | 411 |
407 base::ObserverList<WindowTreeClientObserver> observers_; | 412 base::ObserverList<WindowTreeClientObserver> observers_; |
408 | 413 |
409 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>> | 414 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>> |
410 window_manager_internal_; | 415 window_manager_internal_; |
411 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; | 416 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; |
412 | 417 |
413 bool has_event_observer_ = false; | |
414 | |
415 // Monotonically increasing ID for event observers. | 418 // Monotonically increasing ID for event observers. |
416 uint32_t event_observer_id_ = 0u; | 419 uint32_t event_observer_id_ = 0u; |
| 420 std::vector<uint32_t> event_observer_ids_; |
417 | 421 |
418 // The current change id for the client. | 422 // The current change id for the client. |
419 uint32_t current_move_loop_change_ = 0u; | 423 uint32_t current_move_loop_change_ = 0u; |
420 | 424 |
421 // The current change id for the window manager. | 425 // The current change id for the window manager. |
422 uint32_t current_wm_move_loop_change_ = 0u; | 426 uint32_t current_wm_move_loop_change_ = 0u; |
423 Id current_wm_move_loop_window_id_ = 0u; | 427 Id current_wm_move_loop_window_id_ = 0u; |
424 | 428 |
425 // Callback executed when a move loop initiated by PerformWindowMove() is | 429 // Callback executed when a move loop initiated by PerformWindowMove() is |
426 // completed. | 430 // completed. |
427 base::Callback<void(bool)> on_current_move_finished_; | 431 base::Callback<void(bool)> on_current_move_finished_; |
428 | 432 |
429 base::WeakPtrFactory<WindowTreeClient> weak_factory_; | 433 base::WeakPtrFactory<WindowTreeClient> weak_factory_; |
430 | 434 |
431 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); | 435 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); |
432 }; | 436 }; |
433 | 437 |
434 } // namespace ui | 438 } // namespace ui |
435 | 439 |
436 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ | 440 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ |
OLD | NEW |