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 MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_ | 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_ |
6 #define MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_ | 6 #define MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "mojo/public/cpp/shell/service.h" | 11 #include "mojo/public/cpp/shell/service.h" |
12 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" | 12 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" |
13 #include "mojo/services/view_manager/ids.h" | 13 #include "mojo/services/view_manager/ids.h" |
14 #include "mojo/services/view_manager/node_delegate.h" | 14 #include "mojo/services/view_manager/node_delegate.h" |
15 #include "mojo/services/view_manager/view_manager_export.h" | 15 #include "mojo/services/view_manager/view_manager_export.h" |
16 | 16 |
17 namespace mojo { | 17 namespace mojo { |
18 namespace services { | 18 namespace services { |
19 namespace view_manager { | 19 namespace view_manager { |
20 | 20 |
21 class Node; | 21 class Node; |
22 class RootNodeManager; | 22 class RootNodeManager; |
23 class View; | 23 class View; |
24 | 24 |
25 // Manages a connection from the client. | 25 // Manages a connection from the client. |
26 class MOJO_VIEW_MANAGER_EXPORT ViewManagerConnection | 26 class MOJO_VIEW_MANAGER_EXPORT ViewManagerConnection |
27 : public ServiceConnection<ViewManager, ViewManagerConnection, | 27 : public ServiceConnection<IViewManager, ViewManagerConnection, |
28 RootNodeManager>, | 28 RootNodeManager>, |
29 public NodeDelegate { | 29 public NodeDelegate { |
30 public: | 30 public: |
31 ViewManagerConnection(); | 31 ViewManagerConnection(); |
32 virtual ~ViewManagerConnection(); | 32 virtual ~ViewManagerConnection(); |
33 | 33 |
34 uint16_t id() const { return id_; } | 34 uint16_t id() const { return id_; } |
35 | 35 |
36 // Invoked from Service when connection is established. | 36 // Invoked from Service when connection is established. |
37 void Initialize( | 37 void Initialize( |
(...skipping 30 matching lines...) Expand all Loading... |
68 // is the connection that originated the change. | 68 // is the connection that originated the change. |
69 bool DeleteViewImpl(ViewManagerConnection* source, | 69 bool DeleteViewImpl(ViewManagerConnection* source, |
70 const ViewId& view_id, | 70 const ViewId& view_id, |
71 ChangeId change_id); | 71 ChangeId change_id); |
72 | 72 |
73 // Sets the view associated with a node. | 73 // Sets the view associated with a node. |
74 bool SetViewImpl(const NodeId& node_id, | 74 bool SetViewImpl(const NodeId& node_id, |
75 const ViewId& view_id, | 75 const ViewId& view_id, |
76 ChangeId change_id); | 76 ChangeId change_id); |
77 | 77 |
78 // Overridden from ViewManager: | 78 // Overridden from IViewManager: |
79 virtual void CreateNode(uint16_t node_id, | 79 virtual void CreateNode(uint16_t node_id, |
80 const Callback<void(bool)>& callback) OVERRIDE; | 80 const Callback<void(bool)>& callback) OVERRIDE; |
81 virtual void DeleteNode(uint32_t transport_node_id, | 81 virtual void DeleteNode(uint32_t transport_node_id, |
82 ChangeId change_id, | 82 ChangeId change_id, |
83 const Callback<void(bool)>& callback) OVERRIDE; | 83 const Callback<void(bool)>& callback) OVERRIDE; |
84 virtual void AddNode(uint32_t parent_id, | 84 virtual void AddNode(uint32_t parent_id, |
85 uint32_t child_id, | 85 uint32_t child_id, |
86 ChangeId change_id, | 86 ChangeId change_id, |
87 const Callback<void(bool)>& callback) OVERRIDE; | 87 const Callback<void(bool)>& callback) OVERRIDE; |
88 virtual void RemoveNodeFromParent( | 88 virtual void RemoveNodeFromParent( |
89 uint32_t node_id, | 89 uint32_t node_id, |
90 ChangeId change_id, | 90 ChangeId change_id, |
91 const Callback<void(bool)>& callback) OVERRIDE; | 91 const Callback<void(bool)>& callback) OVERRIDE; |
92 virtual void GetNodeTree( | 92 virtual void GetNodeTree( |
93 uint32_t node_id, | 93 uint32_t node_id, |
94 const Callback<void(Array<INode>)>& callback) OVERRIDE; | 94 const Callback<void(Array<INode>)>& callback) OVERRIDE; |
95 virtual void CreateView(uint16_t view_id, | 95 virtual void CreateView(uint16_t view_id, |
96 const Callback<void(bool)>& callback) OVERRIDE; | 96 const Callback<void(bool)>& callback) OVERRIDE; |
97 virtual void DeleteView(uint32_t transport_view_id, | 97 virtual void DeleteView(uint32_t transport_view_id, |
98 ChangeId change_id, | 98 ChangeId change_id, |
99 const Callback<void(bool)>& callback) OVERRIDE; | 99 const Callback<void(bool)>& callback) OVERRIDE; |
100 virtual void SetView(uint32_t transport_node_id, | 100 virtual void SetView(uint32_t transport_node_id, |
101 uint32_t transport_view_id, | 101 uint32_t transport_view_id, |
102 ChangeId change_id, | 102 ChangeId change_id, |
103 const Callback<void(bool)>& callback) OVERRIDE; | 103 const Callback<void(bool)>& callback) OVERRIDE; |
104 | 104 |
105 // Overriden from NodeDelegate: | 105 // Overridden from NodeDelegate: |
106 virtual void OnNodeHierarchyChanged(const NodeId& node, | 106 virtual void OnNodeHierarchyChanged(const NodeId& node, |
107 const NodeId& new_parent, | 107 const NodeId& new_parent, |
108 const NodeId& old_parent) OVERRIDE; | 108 const NodeId& old_parent) OVERRIDE; |
109 virtual void OnNodeViewReplaced(const NodeId& node, | 109 virtual void OnNodeViewReplaced(const NodeId& node, |
110 const ViewId& new_view_id, | 110 const ViewId& new_view_id, |
111 const ViewId& old_view_id) OVERRIDE; | 111 const ViewId& old_view_id) OVERRIDE; |
112 | 112 |
113 // Id of this connection as assigned by RootNodeManager. Assigned in | 113 // Id of this connection as assigned by RootNodeManager. Assigned in |
114 // Initialize(). | 114 // Initialize(). |
115 uint16_t id_; | 115 uint16_t id_; |
116 | 116 |
117 NodeMap node_map_; | 117 NodeMap node_map_; |
118 | 118 |
119 ViewMap view_map_; | 119 ViewMap view_map_; |
120 | 120 |
121 DISALLOW_COPY_AND_ASSIGN(ViewManagerConnection); | 121 DISALLOW_COPY_AND_ASSIGN(ViewManagerConnection); |
122 }; | 122 }; |
123 | 123 |
124 } // namespace view_manager | 124 } // namespace view_manager |
125 } // namespace services | 125 } // namespace services |
126 } // namespace mojo | 126 } // namespace mojo |
127 | 127 |
128 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_ | 128 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_ |
OLD | NEW |