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 19 matching lines...) Expand all Loading... |
69 bool DeleteViewImpl(ViewManagerConnection* source, | 67 bool DeleteViewImpl(ViewManagerConnection* source, |
70 const ViewId& view_id, | 68 const ViewId& view_id, |
71 TransportChangeId change_id); | 69 TransportChangeId change_id); |
72 | 70 |
73 // Sets the view associated with a node. | 71 // Sets the view associated with a node. |
74 bool SetViewImpl(const NodeId& node_id, | 72 bool SetViewImpl(const NodeId& node_id, |
75 const ViewId& view_id, | 73 const ViewId& view_id, |
76 TransportChangeId change_id); | 74 TransportChangeId change_id); |
77 | 75 |
78 // Overridden from IViewManager: | 76 // Overridden from IViewManager: |
| 77 virtual void SetClient(IViewManagerClient* client) OVERRIDE; |
79 virtual void CreateNode(TransportConnectionSpecificNodeId node_id, | 78 virtual void CreateNode(TransportConnectionSpecificNodeId node_id, |
80 const Callback<void(bool)>& callback) OVERRIDE; | 79 const Callback<void(bool)>& callback) OVERRIDE; |
81 virtual void DeleteNode(TransportNodeId transport_node_id, | 80 virtual void DeleteNode(TransportNodeId transport_node_id, |
82 TransportChangeId change_id, | 81 TransportChangeId change_id, |
83 const Callback<void(bool)>& callback) OVERRIDE; | 82 const Callback<void(bool)>& callback) OVERRIDE; |
84 virtual void AddNode(TransportNodeId parent_id, | 83 virtual void AddNode(TransportNodeId parent_id, |
85 TransportNodeId child_id, | 84 TransportNodeId child_id, |
86 TransportChangeId change_id, | 85 TransportChangeId change_id, |
87 const Callback<void(bool)>& callback) OVERRIDE; | 86 const Callback<void(bool)>& callback) OVERRIDE; |
88 virtual void RemoveNodeFromParent( | 87 virtual void RemoveNodeFromParent( |
(...skipping 14 matching lines...) Expand all Loading... |
103 const Callback<void(bool)>& callback) OVERRIDE; | 102 const Callback<void(bool)>& callback) OVERRIDE; |
104 | 103 |
105 // Overridden from NodeDelegate: | 104 // Overridden from NodeDelegate: |
106 virtual void OnNodeHierarchyChanged(const NodeId& node, | 105 virtual void OnNodeHierarchyChanged(const NodeId& node, |
107 const NodeId& new_parent, | 106 const NodeId& new_parent, |
108 const NodeId& old_parent) OVERRIDE; | 107 const NodeId& old_parent) OVERRIDE; |
109 virtual void OnNodeViewReplaced(const NodeId& node, | 108 virtual void OnNodeViewReplaced(const NodeId& node, |
110 const ViewId& new_view_id, | 109 const ViewId& new_view_id, |
111 const ViewId& old_view_id) OVERRIDE; | 110 const ViewId& old_view_id) OVERRIDE; |
112 | 111 |
| 112 IViewManagerClient* client_; |
| 113 |
113 // Id of this connection as assigned by RootNodeManager. Assigned in | 114 // Id of this connection as assigned by RootNodeManager. Assigned in |
114 // Initialize(). | 115 // Initialize(). |
115 TransportConnectionId id_; | 116 TransportConnectionId id_; |
116 | 117 |
117 NodeMap node_map_; | 118 NodeMap node_map_; |
118 | 119 |
119 ViewMap view_map_; | 120 ViewMap view_map_; |
120 | 121 |
121 DISALLOW_COPY_AND_ASSIGN(ViewManagerConnection); | 122 DISALLOW_COPY_AND_ASSIGN(ViewManagerConnection); |
122 }; | 123 }; |
123 | 124 |
124 } // namespace view_manager | 125 } // namespace view_manager |
125 } // namespace services | 126 } // namespace services |
126 } // namespace mojo | 127 } // namespace mojo |
127 | 128 |
128 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_ | 129 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_ |
OLD | NEW |