Chromium Code Reviews| 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_WS_WINDOW_TREE_H_ | 5 #ifndef SERVICES_UI_WS_WINDOW_TREE_H_ |
| 6 #define SERVICES_UI_WS_WINDOW_TREE_H_ | 6 #define SERVICES_UI_WS_WINDOW_TREE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <queue> | 12 #include <queue> |
| 13 #include <set> | 13 #include <set> |
| 14 #include <string> | 14 #include <string> |
| 15 #include <unordered_map> | 15 #include <unordered_map> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "base/callback.h" | 18 #include "base/callback.h" |
| 19 #include "base/macros.h" | 19 #include "base/macros.h" |
| 20 #include "base/memory/weak_ptr.h" | |
| 20 #include "cc/ipc/surface_id.mojom.h" | 21 #include "cc/ipc/surface_id.mojom.h" |
| 21 #include "mojo/public/cpp/bindings/associated_binding.h" | 22 #include "mojo/public/cpp/bindings/associated_binding.h" |
| 22 #include "services/ui/public/interfaces/window_tree.mojom.h" | 23 #include "services/ui/public/interfaces/window_tree.mojom.h" |
| 23 #include "services/ui/ws/access_policy_delegate.h" | 24 #include "services/ui/ws/access_policy_delegate.h" |
| 24 #include "services/ui/ws/drag_source.h" | 25 #include "services/ui/ws/drag_source.h" |
| 25 #include "services/ui/ws/drag_target_connection.h" | 26 #include "services/ui/ws/drag_target_connection.h" |
| 26 #include "services/ui/ws/ids.h" | 27 #include "services/ui/ws/ids.h" |
| 27 #include "services/ui/ws/user_id.h" | 28 #include "services/ui/ws/user_id.h" |
| 28 #include "services/ui/ws/window_tree_binding.h" | 29 #include "services/ui/ws/window_tree_binding.h" |
| 29 | 30 |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 365 | 366 |
| 366 void DispatchInputEventImpl(ServerWindow* target, const ui::Event& event); | 367 void DispatchInputEventImpl(ServerWindow* target, const ui::Event& event); |
| 367 | 368 |
| 368 // Returns true if the client has a pointer watcher and this event matches. | 369 // Returns true if the client has a pointer watcher and this event matches. |
| 369 bool EventMatchesPointerWatcher(const ui::Event& event) const; | 370 bool EventMatchesPointerWatcher(const ui::Event& event) const; |
| 370 | 371 |
| 371 // Calls OnChangeCompleted() on the client. | 372 // Calls OnChangeCompleted() on the client. |
| 372 void NotifyChangeCompleted(uint32_t change_id, | 373 void NotifyChangeCompleted(uint32_t change_id, |
| 373 mojom::WindowManagerErrorCode error_code); | 374 mojom::WindowManagerErrorCode error_code); |
| 374 | 375 |
| 376 // Callback for when WmMoveDragImage completes. This sends off the next | |
| 377 // queued move under the image if the mouse had further moves while we were | |
| 378 // waiting for the last move to be acknowledged. | |
| 379 void OnWmMoveDragImageCompleted(); | |
| 380 | |
| 375 // WindowTree: | 381 // WindowTree: |
| 376 void NewWindow(uint32_t change_id, | 382 void NewWindow(uint32_t change_id, |
| 377 Id transport_window_id, | 383 Id transport_window_id, |
| 378 const base::Optional< | 384 const base::Optional< |
| 379 std::unordered_map<std::string, std::vector<uint8_t>>>& | 385 std::unordered_map<std::string, std::vector<uint8_t>>>& |
| 380 transport_properties) override; | 386 transport_properties) override; |
| 381 void NewTopLevelWindow( | 387 void NewTopLevelWindow( |
| 382 uint32_t change_id, | 388 uint32_t change_id, |
| 383 Id transport_window_id, | 389 Id transport_window_id, |
| 384 const std::unordered_map<std::string, std::vector<uint8_t>>& | 390 const std::unordered_map<std::string, std::vector<uint8_t>>& |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 453 void StackAbove(uint32_t change_id, Id above_id, Id below_id) override; | 459 void StackAbove(uint32_t change_id, Id above_id, Id below_id) override; |
| 454 void StackAtTop(uint32_t change_id, Id window_id) override; | 460 void StackAtTop(uint32_t change_id, Id window_id) override; |
| 455 void GetWindowManagerClient( | 461 void GetWindowManagerClient( |
| 456 mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal) | 462 mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal) |
| 457 override; | 463 override; |
| 458 void GetCursorLocationMemory(const GetCursorLocationMemoryCallback& callback) | 464 void GetCursorLocationMemory(const GetCursorLocationMemoryCallback& callback) |
| 459 override; | 465 override; |
| 460 void PerformDragDrop( | 466 void PerformDragDrop( |
| 461 uint32_t change_id, | 467 uint32_t change_id, |
| 462 Id source_window_id, | 468 Id source_window_id, |
| 469 const gfx::Point& screen_location, | |
| 463 const std::unordered_map<std::string, std::vector<uint8_t>>& drag_data, | 470 const std::unordered_map<std::string, std::vector<uint8_t>>& drag_data, |
| 464 uint32_t drag_operation) override; | 471 const SkBitmap& drag_image, |
| 472 const gfx::Vector2d& drag_image_offset, | |
| 473 uint32_t drag_operation, | |
| 474 ui::mojom::DragEventSource source) override; | |
| 465 void CancelDragDrop(Id window_id) override; | 475 void CancelDragDrop(Id window_id) override; |
| 466 void PerformWindowMove(uint32_t change_id, | 476 void PerformWindowMove(uint32_t change_id, |
| 467 Id window_id, | 477 Id window_id, |
| 468 ui::mojom::MoveLoopSource source, | 478 ui::mojom::MoveLoopSource source, |
| 469 const gfx::Point& cursor) override; | 479 const gfx::Point& cursor) override; |
| 470 void CancelWindowMove(Id window_id) override; | 480 void CancelWindowMove(Id window_id) override; |
| 471 | 481 |
| 472 // mojom::WindowManagerClient: | 482 // mojom::WindowManagerClient: |
| 473 void AddAccelerators(std::vector<mojom::WmAcceleratorPtr> accelerators, | 483 void AddAccelerators(std::vector<mojom::WmAcceleratorPtr> accelerators, |
| 474 const AddAcceleratorsCallback& callback) override; | 484 const AddAcceleratorsCallback& callback) override; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 493 | 503 |
| 494 // AccessPolicyDelegate: | 504 // AccessPolicyDelegate: |
| 495 bool HasRootForAccessPolicy(const ServerWindow* window) const override; | 505 bool HasRootForAccessPolicy(const ServerWindow* window) const override; |
| 496 bool IsWindowKnownForAccessPolicy(const ServerWindow* window) const override; | 506 bool IsWindowKnownForAccessPolicy(const ServerWindow* window) const override; |
| 497 bool IsWindowRootOfAnotherTreeForAccessPolicy( | 507 bool IsWindowRootOfAnotherTreeForAccessPolicy( |
| 498 const ServerWindow* window) const override; | 508 const ServerWindow* window) const override; |
| 499 bool IsWindowCreatedByWindowManager( | 509 bool IsWindowCreatedByWindowManager( |
| 500 const ServerWindow* window) const override; | 510 const ServerWindow* window) const override; |
| 501 | 511 |
| 502 // DragSource: | 512 // DragSource: |
| 513 void OnDragContinued(const gfx::Point& location) override; | |
| 503 void OnDragCompleted(bool success, uint32_t action_taken) override; | 514 void OnDragCompleted(bool success, uint32_t action_taken) override; |
| 504 ServerWindow* GetWindowById(const WindowId& id) override; | 515 ServerWindow* GetWindowById(const WindowId& id) override; |
| 505 DragTargetConnection* GetDragTargetForWindow( | 516 DragTargetConnection* GetDragTargetForWindow( |
| 506 const ServerWindow* window) override; | 517 const ServerWindow* window) override; |
| 507 | 518 |
| 508 // DragTargetConnection: | 519 // DragTargetConnection: |
| 509 void PerformOnDragDropStart( | 520 void PerformOnDragDropStart( |
| 510 const std::unordered_map<std::string, std::vector<uint8_t>>& mime_data) | 521 const std::unordered_map<std::string, std::vector<uint8_t>>& mime_data) |
| 511 override; | 522 override; |
| 512 void PerformOnDragEnter( | 523 void PerformOnDragEnter( |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 579 | 590 |
| 580 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManagerClient>> | 591 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManagerClient>> |
| 581 window_manager_internal_client_binding_; | 592 window_manager_internal_client_binding_; |
| 582 mojom::WindowManager* window_manager_internal_; | 593 mojom::WindowManager* window_manager_internal_; |
| 583 std::unique_ptr<WindowManagerState> window_manager_state_; | 594 std::unique_ptr<WindowManagerState> window_manager_state_; |
| 584 | 595 |
| 585 std::unique_ptr<WaitingForTopLevelWindowInfo> | 596 std::unique_ptr<WaitingForTopLevelWindowInfo> |
| 586 waiting_for_top_level_window_info_; | 597 waiting_for_top_level_window_info_; |
| 587 bool embedder_intercepts_events_ = false; | 598 bool embedder_intercepts_events_ = false; |
| 588 | 599 |
| 600 // Whether we're waiting for an ack from a WmMoveDragImage message. | |
|
sky
2017/03/23 00:05:36
Similar to WindowManager please put the state rela
Elliot Glaysher
2017/03/23 19:58:44
Done. But I left the weak_factory_ in WindowTree (
| |
| 601 bool waiting_for_move_drag_ack_ = false; | |
| 602 | |
| 603 // Whether we've queued a move to |queued_cursor_location_| when we get an | |
| 604 // ack from WmMoveDragImage. | |
| 605 bool has_queued_drag_window_move_ = false; | |
| 606 | |
| 607 // When |has_queued_drag_window_move_| is true, this is a location which | |
| 608 // should be sent to the window manager as soon as it acked the last one. | |
| 609 gfx::Point queued_cursor_location_; | |
| 610 | |
| 611 base::WeakPtrFactory<WindowTree> weak_factory_; | |
| 612 | |
| 589 DISALLOW_COPY_AND_ASSIGN(WindowTree); | 613 DISALLOW_COPY_AND_ASSIGN(WindowTree); |
| 590 }; | 614 }; |
| 591 | 615 |
| 592 } // namespace ws | 616 } // namespace ws |
| 593 } // namespace ui | 617 } // namespace ui |
| 594 | 618 |
| 595 #endif // SERVICES_UI_WS_WINDOW_TREE_H_ | 619 #endif // SERVICES_UI_WS_WINDOW_TREE_H_ |
| OLD | NEW |