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

Side by Side Diff: services/ui/ws/window_tree.h

Issue 2266603002: mus: Implement interwindow drag and drop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sky comments Created 4 years, 3 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_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 <vector> 15 #include <vector>
16 16
17 #include "base/callback.h" 17 #include "base/callback.h"
18 #include "base/containers/hash_tables.h" 18 #include "base/containers/hash_tables.h"
19 #include "base/macros.h" 19 #include "base/macros.h"
20 #include "cc/ipc/surface_id.mojom.h" 20 #include "cc/ipc/surface_id.mojom.h"
21 #include "mojo/public/cpp/bindings/associated_binding.h" 21 #include "mojo/public/cpp/bindings/associated_binding.h"
22 #include "services/ui/public/interfaces/window_tree.mojom.h" 22 #include "services/ui/public/interfaces/window_tree.mojom.h"
23 #include "services/ui/ws/access_policy_delegate.h" 23 #include "services/ui/ws/access_policy_delegate.h"
24 #include "services/ui/ws/drag_source.h"
25 #include "services/ui/ws/drag_target_connection.h"
24 #include "services/ui/ws/ids.h" 26 #include "services/ui/ws/ids.h"
25 #include "services/ui/ws/user_id.h" 27 #include "services/ui/ws/user_id.h"
26 #include "services/ui/ws/window_tree_binding.h" 28 #include "services/ui/ws/window_tree_binding.h"
27 29
28 namespace gfx { 30 namespace gfx {
29 class Insets; 31 class Insets;
30 class Rect; 32 class Rect;
31 } 33 }
32 34
33 namespace ui { 35 namespace ui {
34 class Event; 36 class Event;
35 } 37 }
36 38
37 namespace ui { 39 namespace ui {
38 namespace ws { 40 namespace ws {
39 41
40 class AccessPolicy; 42 class AccessPolicy;
41 class DisplayManager; 43 class DisplayManager;
42 class Display; 44 class Display;
45 class DragTargetConnection;
43 class EventMatcher; 46 class EventMatcher;
44 class ServerWindow; 47 class ServerWindow;
45 class TargetedEvent; 48 class TargetedEvent;
46 class WindowManagerDisplayRoot; 49 class WindowManagerDisplayRoot;
47 class WindowManagerState; 50 class WindowManagerState;
48 class WindowServer; 51 class WindowServer;
49 class WindowTreeTest; 52 class WindowTreeTest;
50 53
51 namespace test { 54 namespace test {
52 class WindowTreeTestApi; 55 class WindowTreeTestApi;
53 } 56 }
54 57
55 // WindowTree represents a view onto portions of the window tree. The parts of 58 // WindowTree represents a view onto portions of the window tree. The parts of
56 // the tree exposed to the client start at the root windows. A WindowTree may 59 // the tree exposed to the client start at the root windows. A WindowTree may
57 // have any number of roots (including none). A WindowTree may not have 60 // have any number of roots (including none). A WindowTree may not have
58 // visibility of all the descendants of its roots. 61 // visibility of all the descendants of its roots.
59 // 62 //
60 // WindowTree notifies its client as changes happen to windows exposed to the 63 // WindowTree notifies its client as changes happen to windows exposed to the
61 // the client. 64 // the client.
62 // 65 //
63 // See ids.h for details on how WindowTree handles identity of windows. 66 // See ids.h for details on how WindowTree handles identity of windows.
64 class WindowTree : public mojom::WindowTree, 67 class WindowTree : public mojom::WindowTree,
65 public AccessPolicyDelegate, 68 public AccessPolicyDelegate,
66 public mojom::WindowManagerClient { 69 public mojom::WindowManagerClient,
70 public DragSource,
71 public DragTargetConnection {
67 public: 72 public:
68 WindowTree(WindowServer* window_server, 73 WindowTree(WindowServer* window_server,
69 const UserId& user_id, 74 const UserId& user_id,
70 ServerWindow* root, 75 ServerWindow* root,
71 std::unique_ptr<AccessPolicy> access_policy); 76 std::unique_ptr<AccessPolicy> access_policy);
72 ~WindowTree() override; 77 ~WindowTree() override;
73 78
74 void Init(std::unique_ptr<WindowTreeBinding> binding, 79 void Init(std::unique_ptr<WindowTreeBinding> binding,
75 mojom::WindowTreePtr tree); 80 mojom::WindowTreePtr tree);
76 81
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 mojo::TextInputStatePtr state) override; 416 mojo::TextInputStatePtr state) override;
412 void SetImeVisibility(Id transport_window_id, 417 void SetImeVisibility(Id transport_window_id,
413 bool visible, 418 bool visible,
414 mojo::TextInputStatePtr state) override; 419 mojo::TextInputStatePtr state) override;
415 void OnWindowInputEventAck(uint32_t event_id, 420 void OnWindowInputEventAck(uint32_t event_id,
416 mojom::EventResult result) override; 421 mojom::EventResult result) override;
417 void SetClientArea( 422 void SetClientArea(
418 Id transport_window_id, 423 Id transport_window_id,
419 const gfx::Insets& insets, 424 const gfx::Insets& insets,
420 mojo::Array<gfx::Rect> transport_additional_client_areas) override; 425 mojo::Array<gfx::Rect> transport_additional_client_areas) override;
426 void SetCanAcceptDrops(Id window_id, bool accepts_drops) override;
421 void SetHitTestMask(Id transport_window_id, 427 void SetHitTestMask(Id transport_window_id,
422 const base::Optional<gfx::Rect>& mask) override; 428 const base::Optional<gfx::Rect>& mask) override;
423 void GetWindowManagerClient( 429 void GetWindowManagerClient(
424 mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal) 430 mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal)
425 override; 431 override;
426 void GetCursorLocationMemory(const GetCursorLocationMemoryCallback& callback) 432 void GetCursorLocationMemory(const GetCursorLocationMemoryCallback& callback)
427 override; 433 override;
434 void PerformDragDrop(uint32_t change_id,
435 uint32_t source_window_id,
sky 2016/09/13 18:15:32 uint32_t -> Id
436 int32_t drag_pointer,
437 mojo::Map<mojo::String, mojo::Array<uint8_t>> drag_data,
438 uint32_t drag_operation) override;
428 void PerformWindowMove(uint32_t change_id, 439 void PerformWindowMove(uint32_t change_id,
429 Id window_id, 440 Id window_id,
430 ui::mojom::MoveLoopSource source, 441 ui::mojom::MoveLoopSource source,
431 const gfx::Point& cursor) override; 442 const gfx::Point& cursor) override;
432 void CancelWindowMove(Id window_id) override; 443 void CancelWindowMove(Id window_id) override;
433 444
434 // mojom::WindowManagerClient: 445 // mojom::WindowManagerClient:
435 void AddAccelerator(uint32_t id, 446 void AddAccelerator(uint32_t id,
436 mojom::EventMatcherPtr event_matcher, 447 mojom::EventMatcherPtr event_matcher,
437 const AddAcceleratorCallback& callback) override; 448 const AddAcceleratorCallback& callback) override;
(...skipping 15 matching lines...) Expand all
453 void OnWmCreatedTopLevelWindow(uint32_t change_id, 464 void OnWmCreatedTopLevelWindow(uint32_t change_id,
454 Id transport_window_id) override; 465 Id transport_window_id) override;
455 void OnAcceleratorAck(uint32_t event_id, mojom::EventResult result) override; 466 void OnAcceleratorAck(uint32_t event_id, mojom::EventResult result) override;
456 467
457 // AccessPolicyDelegate: 468 // AccessPolicyDelegate:
458 bool HasRootForAccessPolicy(const ServerWindow* window) const override; 469 bool HasRootForAccessPolicy(const ServerWindow* window) const override;
459 bool IsWindowKnownForAccessPolicy(const ServerWindow* window) const override; 470 bool IsWindowKnownForAccessPolicy(const ServerWindow* window) const override;
460 bool IsWindowRootOfAnotherTreeForAccessPolicy( 471 bool IsWindowRootOfAnotherTreeForAccessPolicy(
461 const ServerWindow* window) const override; 472 const ServerWindow* window) const override;
462 473
474 // DragSource:
475 void OnDragCompleted(bool success) override;
476 ServerWindow* GetWindowById(const WindowId& id) override;
477 DragTargetConnection* GetDragTargetWithRoot(
478 const ServerWindow* window) override;
479
480 // DragTargetConnection:
481 void PerformOnDragMimeTypes(
482 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data) override;
483 void PerformOnDragEnter(
484 const ServerWindow* window,
485 uint32_t event_flags,
486 const gfx::Point& cursor_offset,
487 uint32_t effect_bitmask,
488 const base::Callback<void(uint32_t)>& callback) override;
489 void PerformOnDragOver(
490 const ServerWindow* window,
491 uint32_t event_flags,
492 const gfx::Point& cursor_offset,
493 uint32_t effect_bitmask,
494 const base::Callback<void(uint32_t)>& callback) override;
495 void PerformOnDragLeave(const ServerWindow* window) override;
496 void PerformOnCompleteDrop(
497 const ServerWindow* window,
498 uint32_t event_flags,
499 const gfx::Point& cursor_offset,
500 uint32_t effect_bitmask,
501 const base::Callback<void(uint32_t)>& callback) override;
502 void PerformOnDragFinish() override;
503
463 WindowServer* window_server_; 504 WindowServer* window_server_;
464 505
465 UserId user_id_; 506 UserId user_id_;
466 507
467 // Id of this tree as assigned by WindowServer. 508 // Id of this tree as assigned by WindowServer.
468 const ClientSpecificId id_; 509 const ClientSpecificId id_;
469 std::string name_; 510 std::string name_;
470 511
471 ClientSpecificId next_window_id_; 512 ClientSpecificId next_window_id_;
472 513
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 waiting_for_top_level_window_info_; 555 waiting_for_top_level_window_info_;
515 bool embedder_intercepts_events_ = false; 556 bool embedder_intercepts_events_ = false;
516 557
517 DISALLOW_COPY_AND_ASSIGN(WindowTree); 558 DISALLOW_COPY_AND_ASSIGN(WindowTree);
518 }; 559 };
519 560
520 } // namespace ws 561 } // namespace ws
521 } // namespace ui 562 } // namespace ui
522 563
523 #endif // SERVICES_UI_WS_WINDOW_TREE_H_ 564 #endif // SERVICES_UI_WS_WINDOW_TREE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698