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

Side by Side Diff: components/mus/public/cpp/window_tree_client.h

Issue 2060513002: Tab dragging as implemented as a mus API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use not not pattern to fix win compile Created 4 years, 6 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 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 173
174 // Returns the current location of the mouse on screen. Note: this method may 174 // Returns the current location of the mouse on screen. Note: this method may
175 // race the asynchronous initialization; but in that case we return (0, 0). 175 // race the asynchronous initialization; but in that case we return (0, 0).
176 gfx::Point GetCursorScreenPoint(); 176 gfx::Point GetCursorScreenPoint();
177 177
178 // See description in window_tree.mojom. When an existing event observer is 178 // See description in window_tree.mojom. When an existing event observer is
179 // updated or cleared then any future events from the server for that observer 179 // updated or cleared then any future events from the server for that observer
180 // will be ignored. 180 // will be ignored.
181 void SetEventObserver(mojom::EventMatcherPtr matcher); 181 void SetEventObserver(mojom::EventMatcherPtr matcher);
182 182
183 // Performs a window move. This call blocks but spins up a nested message
184 // loop to handle incoming move messages.
185 void PerformWindowMove(Window* window, const gfx::Point& cursor_location,
sky 2016/06/24 19:59:00 nit: run git cl format
186 const base::Callback<void(bool)>& callback);
187
188 // Cancels a in progress window move. (If no window is currently being moved,
189 // does nothing.)
190 void CancelWindowMove(Window* window);
191
183 // Creates and returns a new Window (which is owned by the window server). 192 // Creates and returns a new Window (which is owned by the window server).
184 // Windows are initially hidden, use SetVisible(true) to show. 193 // Windows are initially hidden, use SetVisible(true) to show.
185 Window* NewWindow() { return NewWindow(nullptr); } 194 Window* NewWindow() { return NewWindow(nullptr); }
186 Window* NewWindow( 195 Window* NewWindow(
187 const std::map<std::string, std::vector<uint8_t>>* properties); 196 const std::map<std::string, std::vector<uint8_t>>* properties);
188 Window* NewTopLevelWindow( 197 Window* NewTopLevelWindow(
189 const std::map<std::string, std::vector<uint8_t>>* properties); 198 const std::map<std::string, std::vector<uint8_t>>* properties);
190 199
191 void AddObserver(WindowTreeClientObserver* observer); 200 void AddObserver(WindowTreeClientObserver* observer);
192 void RemoveObserver(WindowTreeClientObserver* observer); 201 void RemoveObserver(WindowTreeClientObserver* observer);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 void OnWindowInputEvent(uint32_t event_id, 301 void OnWindowInputEvent(uint32_t event_id,
293 Id window_id, 302 Id window_id,
294 std::unique_ptr<ui::Event> event, 303 std::unique_ptr<ui::Event> event,
295 uint32_t event_observer_id) override; 304 uint32_t event_observer_id) override;
296 void OnEventObserved(std::unique_ptr<ui::Event> event, 305 void OnEventObserved(std::unique_ptr<ui::Event> event,
297 uint32_t event_observer_id) override; 306 uint32_t event_observer_id) override;
298 void OnWindowFocused(Id focused_window_id) override; 307 void OnWindowFocused(Id focused_window_id) override;
299 void OnWindowPredefinedCursorChanged(Id window_id, 308 void OnWindowPredefinedCursorChanged(Id window_id,
300 mojom::Cursor cursor) override; 309 mojom::Cursor cursor) override;
301 void OnChangeCompleted(uint32_t change_id, bool success) override; 310 void OnChangeCompleted(uint32_t change_id, bool success) override;
311 void OnMoveLoopCompleted(uint32_t change_id, bool success) override;
302 void RequestClose(uint32_t window_id) override; 312 void RequestClose(uint32_t window_id) override;
303 void GetWindowManager( 313 void GetWindowManager(
304 mojo::AssociatedInterfaceRequest<WindowManager> internal) override; 314 mojo::AssociatedInterfaceRequest<WindowManager> internal) override;
305 315
306 // Overridden from WindowManager: 316 // Overridden from WindowManager:
307 void OnConnect(ClientSpecificId client_id) override; 317 void OnConnect(ClientSpecificId client_id) override;
308 void WmNewDisplayAdded(mojom::DisplayPtr display, 318 void WmNewDisplayAdded(mojom::DisplayPtr display,
309 mojom::WindowDataPtr root_data, 319 mojom::WindowDataPtr root_data,
310 bool parent_drawn) override; 320 bool parent_drawn) override;
311 void WmSetBounds(uint32_t change_id, 321 void WmSetBounds(uint32_t change_id,
312 Id window_id, 322 Id window_id,
313 const gfx::Rect& transit_bounds) override; 323 const gfx::Rect& transit_bounds) override;
314 void WmSetProperty(uint32_t change_id, 324 void WmSetProperty(uint32_t change_id,
315 Id window_id, 325 Id window_id,
316 const mojo::String& name, 326 const mojo::String& name,
317 mojo::Array<uint8_t> transit_data) override; 327 mojo::Array<uint8_t> transit_data) override;
318 void WmCreateTopLevelWindow(uint32_t change_id, 328 void WmCreateTopLevelWindow(uint32_t change_id,
319 ClientSpecificId requesting_client_id, 329 ClientSpecificId requesting_client_id,
320 mojo::Map<mojo::String, mojo::Array<uint8_t>> 330 mojo::Map<mojo::String, mojo::Array<uint8_t>>
321 transport_properties) override; 331 transport_properties) override;
322 void WmClientJankinessChanged(ClientSpecificId client_id, 332 void WmClientJankinessChanged(ClientSpecificId client_id,
323 bool janky) override; 333 bool janky) override;
334 void WmPerformMoveLoop(uint32_t change_id,
335 Id window_id,
336 const gfx::Point& cursor_location) override;
337 void WmCancelMoveLoop(uint32_t window_id) override;
324 void OnAccelerator(uint32_t id, std::unique_ptr<ui::Event> event) override; 338 void OnAccelerator(uint32_t id, std::unique_ptr<ui::Event> event) override;
325 339
326 // Overridden from WindowManagerClient: 340 // Overridden from WindowManagerClient:
327 void SetFrameDecorationValues( 341 void SetFrameDecorationValues(
328 mojom::FrameDecorationValuesPtr values) override; 342 mojom::FrameDecorationValuesPtr values) override;
329 void SetNonClientCursor(Window* window, 343 void SetNonClientCursor(Window* window,
330 mus::mojom::Cursor cursor_id) override; 344 mus::mojom::Cursor cursor_id) override;
331 void AddAccelerator(uint32_t id, 345 void AddAccelerator(uint32_t id,
332 mojom::EventMatcherPtr event_matcher, 346 mojom::EventMatcherPtr event_matcher,
333 const base::Callback<void(bool)>& callback) override; 347 const base::Callback<void(bool)>& callback) override;
334 void RemoveAccelerator(uint32_t id) override; 348 void RemoveAccelerator(uint32_t id) override;
335 void AddActivationParent(Window* window) override; 349 void AddActivationParent(Window* window) override;
336 void RemoveActivationParent(Window* window) override; 350 void RemoveActivationParent(Window* window) override;
337 void ActivateNextWindow() override; 351 void ActivateNextWindow() override;
338 void SetUnderlaySurfaceOffsetAndExtendedHitArea( 352 void SetUnderlaySurfaceOffsetAndExtendedHitArea(
339 Window* window, 353 Window* window,
340 const gfx::Vector2d& offset, 354 const gfx::Vector2d& offset,
341 const gfx::Insets& hit_area) override; 355 const gfx::Insets& hit_area) override;
356 void OnWmMoveLoopCompleted(uint32_t change_id,
357 bool completed) override;
342 358
343 // The one int in |cursor_location_mapping_|. When we read from this 359 // The one int in |cursor_location_mapping_|. When we read from this
344 // location, we must always read from it atomically. 360 // location, we must always read from it atomically.
345 base::subtle::Atomic32* cursor_location_memory() { 361 base::subtle::Atomic32* cursor_location_memory() {
346 return reinterpret_cast<base::subtle::Atomic32*>( 362 return reinterpret_cast<base::subtle::Atomic32*>(
347 cursor_location_mapping_.get()); 363 cursor_location_mapping_.get());
348 } 364 }
349 365
350 // This is set once and only once when we get OnEmbed(). It gives the unique 366 // This is set once and only once when we get OnEmbed(). It gives the unique
351 // id for this client. 367 // id for this client.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 405
390 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>> 406 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>>
391 window_manager_internal_; 407 window_manager_internal_;
392 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; 408 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_;
393 409
394 bool has_event_observer_ = false; 410 bool has_event_observer_ = false;
395 411
396 // Monotonically increasing ID for event observers. 412 // Monotonically increasing ID for event observers.
397 uint32_t event_observer_id_ = 0u; 413 uint32_t event_observer_id_ = 0u;
398 414
415 // Callback executed when a move loop initiated by PerformWindowMove() is
416 // completed.
417 base::Callback<void(bool)> on_current_move_finished_;
418
399 base::WeakPtrFactory<WindowTreeClient> weak_factory_; 419 base::WeakPtrFactory<WindowTreeClient> weak_factory_;
400 420
401 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); 421 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient);
402 }; 422 };
403 423
404 } // namespace mus 424 } // namespace mus
405 425
406 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ 426 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698