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" |
(...skipping 15 matching lines...) Expand all Loading... |
26 class MOJO_VIEW_MANAGER_EXPORT ViewManagerConnection | 26 class MOJO_VIEW_MANAGER_EXPORT ViewManagerConnection |
27 : public ServiceConnection<IViewManager, 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 TransportConnectionId id() const { return id_; } | 34 TransportConnectionId id() const { return id_; } |
35 | 35 |
36 // Invoked from Service when connection is established. | 36 // Invoked when connection is established. |
37 void Initialize( | 37 void Initialize(); |
38 ServiceConnector<ViewManagerConnection, RootNodeManager>* service_factory, | |
39 ScopedMessagePipeHandle client_handle); | |
40 | 38 |
41 // Returns the Node with the specified id. | 39 // Returns the Node with the specified id. |
42 Node* GetNode(const NodeId& id); | 40 Node* GetNode(const NodeId& id); |
43 | 41 |
44 // Returns the View with the specified id. | 42 // Returns the View with the specified id. |
45 View* GetView(const ViewId& id); | 43 View* GetView(const ViewId& id); |
46 | 44 |
47 // Notifies the client of a hierarchy change. | 45 // Notifies the client of a hierarchy change. |
48 void NotifyNodeHierarchyChanged(const NodeId& node, | 46 void NotifyNodeHierarchyChanged(const NodeId& node, |
49 const NodeId& new_parent, | 47 const NodeId& new_parent, |
(...skipping 20 matching lines...) Expand all Loading... |
70 bool DeleteViewImpl(ViewManagerConnection* source, | 68 bool DeleteViewImpl(ViewManagerConnection* source, |
71 const ViewId& view_id, | 69 const ViewId& view_id, |
72 TransportChangeId change_id); | 70 TransportChangeId change_id); |
73 | 71 |
74 // Sets the view associated with a node. | 72 // Sets the view associated with a node. |
75 bool SetViewImpl(const NodeId& node_id, | 73 bool SetViewImpl(const NodeId& node_id, |
76 const ViewId& view_id, | 74 const ViewId& view_id, |
77 TransportChangeId change_id); | 75 TransportChangeId change_id); |
78 | 76 |
79 // Overridden from IViewManager: | 77 // Overridden from IViewManager: |
| 78 virtual void SetClient(IViewManagerClient* client) OVERRIDE; |
80 virtual void CreateNode(TransportConnectionSpecificNodeId node_id, | 79 virtual void CreateNode(TransportConnectionSpecificNodeId node_id, |
81 const Callback<void(bool)>& callback) OVERRIDE; | 80 const Callback<void(bool)>& callback) OVERRIDE; |
82 virtual void DeleteNode(TransportNodeId transport_node_id, | 81 virtual void DeleteNode(TransportNodeId transport_node_id, |
83 TransportChangeId change_id, | 82 TransportChangeId change_id, |
84 const Callback<void(bool)>& callback) OVERRIDE; | 83 const Callback<void(bool)>& callback) OVERRIDE; |
85 virtual void AddNode(TransportNodeId parent_id, | 84 virtual void AddNode(TransportNodeId parent_id, |
86 TransportNodeId child_id, | 85 TransportNodeId child_id, |
87 TransportChangeId change_id, | 86 TransportChangeId change_id, |
88 const Callback<void(bool)>& callback) OVERRIDE; | 87 const Callback<void(bool)>& callback) OVERRIDE; |
89 virtual void RemoveNodeFromParent( | 88 virtual void RemoveNodeFromParent( |
(...skipping 17 matching lines...) Expand all Loading... |
107 uint32_t buffer_size) OVERRIDE; | 106 uint32_t buffer_size) OVERRIDE; |
108 | 107 |
109 // Overridden from NodeDelegate: | 108 // Overridden from NodeDelegate: |
110 virtual void OnNodeHierarchyChanged(const NodeId& node, | 109 virtual void OnNodeHierarchyChanged(const NodeId& node, |
111 const NodeId& new_parent, | 110 const NodeId& new_parent, |
112 const NodeId& old_parent) OVERRIDE; | 111 const NodeId& old_parent) OVERRIDE; |
113 virtual void OnNodeViewReplaced(const NodeId& node, | 112 virtual void OnNodeViewReplaced(const NodeId& node, |
114 const ViewId& new_view_id, | 113 const ViewId& new_view_id, |
115 const ViewId& old_view_id) OVERRIDE; | 114 const ViewId& old_view_id) OVERRIDE; |
116 | 115 |
| 116 IViewManagerClient* client_; |
| 117 |
117 // Id of this connection as assigned by RootNodeManager. Assigned in | 118 // Id of this connection as assigned by RootNodeManager. Assigned in |
118 // Initialize(). | 119 // Initialize(). |
119 TransportConnectionId id_; | 120 TransportConnectionId id_; |
120 | 121 |
121 NodeMap node_map_; | 122 NodeMap node_map_; |
122 | 123 |
123 ViewMap view_map_; | 124 ViewMap view_map_; |
124 | 125 |
125 DISALLOW_COPY_AND_ASSIGN(ViewManagerConnection); | 126 DISALLOW_COPY_AND_ASSIGN(ViewManagerConnection); |
126 }; | 127 }; |
127 | 128 |
128 } // namespace view_manager | 129 } // namespace view_manager |
129 } // namespace services | 130 } // namespace services |
130 } // namespace mojo | 131 } // namespace mojo |
131 | 132 |
132 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_ | 133 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_ |
OLD | NEW |