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

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

Issue 2180683003: NOSUBMIT: PointerWatcher observes all pointer events, with moves optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 212 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/interfaces/window_tree.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698