Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: services/ui/public/cpp/window_tree_client.h

Issue 2183163002: mus: Change PointerWatcher to observe all pointer events, with moves optional. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // is focused. 171 // is focused.
172 Window* GetFocusedWindow(); 172 Window* GetFocusedWindow();
173 173
174 // Sets focus to null. This does nothing if focus is currently null. 174 // Sets focus to null. This does nothing if focus is currently null.
175 void ClearFocus(); 175 void ClearFocus();
176 176
177 // Returns the current location of the mouse on screen. Note: this method may 177 // Returns the current location of the mouse on screen. Note: this method may
178 // race the asynchronous initialization; but in that case we return (0, 0). 178 // race the asynchronous initialization; but in that case we return (0, 0).
179 gfx::Point GetCursorScreenPoint(); 179 gfx::Point GetCursorScreenPoint();
180 180
181 // See description in window_tree.mojom. When an existing event observer is 181 // See description in window_tree.mojom. When an existing pointer watcher is
182 // updated or cleared then any future events from the server for that observer 182 // updated or cleared then any future events from the server for that watcher
183 // will be ignored. 183 // will be ignored.
184 void SetEventObserver(mojom::EventMatcherPtr matcher); 184 void StartPointerWatcher(bool want_moves);
185 void StopPointerWatcher();
185 186
186 // Performs a window move. |callback| will be asynchronously called with the 187 // Performs a window move. |callback| will be asynchronously called with the
187 // whether the move loop completed successfully. 188 // whether the move loop completed successfully.
188 void PerformWindowMove(Window* window, 189 void PerformWindowMove(Window* window,
189 ui::mojom::MoveLoopSource source, 190 ui::mojom::MoveLoopSource source,
190 const gfx::Point& cursor_location, 191 const gfx::Point& cursor_location,
191 const base::Callback<void(bool)>& callback); 192 const base::Callback<void(bool)>& callback);
192 193
193 // Cancels a in progress window move. (If no window is currently being moved, 194 // Cancels a in progress window move. (If no window is currently being moved,
194 // does nothing.) 195 // does nothing.)
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 void OnWindowOpacityChanged(Id window_id, 303 void OnWindowOpacityChanged(Id window_id,
303 float old_opacity, 304 float old_opacity,
304 float new_opacity) override; 305 float new_opacity) override;
305 void OnWindowParentDrawnStateChanged(Id window_id, bool drawn) override; 306 void OnWindowParentDrawnStateChanged(Id window_id, bool drawn) override;
306 void OnWindowSharedPropertyChanged(Id window_id, 307 void OnWindowSharedPropertyChanged(Id window_id,
307 const mojo::String& name, 308 const mojo::String& name,
308 mojo::Array<uint8_t> new_data) override; 309 mojo::Array<uint8_t> new_data) override;
309 void OnWindowInputEvent(uint32_t event_id, 310 void OnWindowInputEvent(uint32_t event_id,
310 Id window_id, 311 Id window_id,
311 std::unique_ptr<ui::Event> event, 312 std::unique_ptr<ui::Event> event,
312 uint32_t event_observer_id) override; 313 uint32_t pointer_watcher_id) override;
313 void OnEventObserved(std::unique_ptr<ui::Event> event, 314 void OnPointerEventObserved(std::unique_ptr<ui::Event> event,
314 uint32_t event_observer_id) override; 315 uint32_t pointer_watcher_id) override;
315 void OnWindowFocused(Id focused_window_id) override; 316 void OnWindowFocused(Id focused_window_id) override;
316 void OnWindowPredefinedCursorChanged(Id window_id, 317 void OnWindowPredefinedCursorChanged(Id window_id,
317 mojom::Cursor cursor) override; 318 mojom::Cursor cursor) override;
318 void OnChangeCompleted(uint32_t change_id, bool success) override; 319 void OnChangeCompleted(uint32_t change_id, bool success) override;
319 void RequestClose(uint32_t window_id) override; 320 void RequestClose(uint32_t window_id) override;
320 void GetWindowManager( 321 void GetWindowManager(
321 mojo::AssociatedInterfaceRequest<WindowManager> internal) override; 322 mojo::AssociatedInterfaceRequest<WindowManager> internal) override;
322 323
323 // Overridden from WindowManager: 324 // Overridden from WindowManager:
324 void OnConnect(ClientSpecificId client_id) override; 325 void OnConnect(ClientSpecificId client_id) override;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 // 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
408 // server uses this to let us synchronously read the cursor location. 409 // server uses this to let us synchronously read the cursor location.
409 mojo::ScopedSharedBufferMapping cursor_location_mapping_; 410 mojo::ScopedSharedBufferMapping cursor_location_mapping_;
410 411
411 base::ObserverList<WindowTreeClientObserver> observers_; 412 base::ObserverList<WindowTreeClientObserver> observers_;
412 413
413 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>> 414 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>>
414 window_manager_internal_; 415 window_manager_internal_;
415 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; 416 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_;
416 417
417 bool has_event_observer_ = false; 418 bool has_pointer_watcher_ = false;
418 419
419 // Monotonically increasing ID for event observers. 420 // Monotonically increasing ID for pointer watchers.
420 uint32_t event_observer_id_ = 0u; 421 uint32_t pointer_watcher_id_ = 0u;
421 422
422 // The current change id for the client. 423 // The current change id for the client.
423 uint32_t current_move_loop_change_ = 0u; 424 uint32_t current_move_loop_change_ = 0u;
424 425
425 // The current change id for the window manager. 426 // The current change id for the window manager.
426 uint32_t current_wm_move_loop_change_ = 0u; 427 uint32_t current_wm_move_loop_change_ = 0u;
427 Id current_wm_move_loop_window_id_ = 0u; 428 Id current_wm_move_loop_window_id_ = 0u;
428 429
429 // Callback executed when a move loop initiated by PerformWindowMove() is 430 // Callback executed when a move loop initiated by PerformWindowMove() is
430 // completed. 431 // completed.
431 base::Callback<void(bool)> on_current_move_finished_; 432 base::Callback<void(bool)> on_current_move_finished_;
432 433
433 base::WeakPtrFactory<WindowTreeClient> weak_factory_; 434 base::WeakPtrFactory<WindowTreeClient> weak_factory_;
434 435
435 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); 436 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient);
436 }; 437 };
437 438
438 } // namespace ui 439 } // namespace ui
439 440
440 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ 441 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_
OLDNEW
« no previous file with comments | « services/ui/public/cpp/tests/window_tree_client_unittest.cc ('k') | services/ui/public/cpp/window_tree_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698