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

Side by Side Diff: mojo/services/view_manager/view_manager_connection.h

Issue 296003003: First step at setroots (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 6 years, 7 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 | Annotate | Revision Log
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 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 #include <vector> 9 #include <vector>
10 10
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // is the connection that originated the change. 89 // is the connection that originated the change.
90 bool DeleteViewImpl(ViewManagerConnection* source, const ViewId& view_id); 90 bool DeleteViewImpl(ViewManagerConnection* source, const ViewId& view_id);
91 91
92 // Sets the view associated with a node. 92 // Sets the view associated with a node.
93 bool SetViewImpl(const NodeId& node_id, const ViewId& view_id); 93 bool SetViewImpl(const NodeId& node_id, const ViewId& view_id);
94 94
95 // If |node| is known (in |known_nodes_|) does nothing. Otherwise adds |node| 95 // If |node| is known (in |known_nodes_|) does nothing. Otherwise adds |node|
96 // to |nodes|, marks |node| as known and recurses. 96 // to |nodes|, marks |node| as known and recurses.
97 void GetUnknownNodesFrom(const Node* node, std::vector<const Node*>* nodes); 97 void GetUnknownNodesFrom(const Node* node, std::vector<const Node*>* nodes);
98 98
99 // Removes |node| and all its descendants from |known_nodes_|. This does not
100 // recurse through nodes that were created by this connection.
101 void RemoveFromKnown(const Node* node);
102
103 // Returns true if |node| is a non-null and a descendant of |roots_| (or
104 // |roots_| is empty).
105 bool IsNodeDescendantOfRoots(const Node* node) const;
106
99 // Returns true if notification should be sent of a hierarchy change. If true 107 // Returns true if notification should be sent of a hierarchy change. If true
100 // is returned, any nodes that need to be sent to the client are added to 108 // is returned, any nodes that need to be sent to the client are added to
101 // |to_send|. 109 // |to_send|.
102 bool ShouldNotifyOnHierarchyChange(const Node* node_id, 110 bool ShouldNotifyOnHierarchyChange(const Node* node,
103 const Node* new_parent_id, 111 const Node** new_parent,
104 const Node* old_parent_id, 112 const Node** old_parent,
105 std::vector<const Node*>* to_send); 113 std::vector<const Node*>* to_send);
106 114
115 bool ProcessSetRoots(TransportConnectionId source_connection_id,
116 const Array<TransportNodeId>& transport_node_ids);
117
118 // Converts an array of Nodes to INodes. This assumes all the nodes are valid
119 // for the client. The parent in set to NULL if this client is not allowed to
Ben Goodger (Google) 2014/05/20 16:13:33 in->is
120 // access the parent.
121 Array<INode> NodesToINodes(const std::vector<const Node*>& nodes);
122
107 // Overridden from IViewManager: 123 // Overridden from IViewManager:
108 virtual void CreateNode(TransportNodeId transport_node_id, 124 virtual void CreateNode(TransportNodeId transport_node_id,
109 const Callback<void(bool)>& callback) OVERRIDE; 125 const Callback<void(bool)>& callback) OVERRIDE;
110 virtual void DeleteNode(TransportNodeId transport_node_id, 126 virtual void DeleteNode(TransportNodeId transport_node_id,
111 const Callback<void(bool)>& callback) OVERRIDE; 127 const Callback<void(bool)>& callback) OVERRIDE;
112 virtual void AddNode(TransportNodeId parent_id, 128 virtual void AddNode(TransportNodeId parent_id,
113 TransportNodeId child_id, 129 TransportNodeId child_id,
114 TransportChangeId server_change_id, 130 TransportChangeId server_change_id,
115 const Callback<void(bool)>& callback) OVERRIDE; 131 const Callback<void(bool)>& callback) OVERRIDE;
116 virtual void RemoveNodeFromParent( 132 virtual void RemoveNodeFromParent(
117 TransportNodeId node_id, 133 TransportNodeId node_id,
118 TransportChangeId server_change_id, 134 TransportChangeId server_change_id,
119 const Callback<void(bool)>& callback) OVERRIDE; 135 const Callback<void(bool)>& callback) OVERRIDE;
120 virtual void GetNodeTree( 136 virtual void GetNodeTree(
121 TransportNodeId node_id, 137 TransportNodeId node_id,
122 const Callback<void(Array<INode>)>& callback) OVERRIDE; 138 const Callback<void(Array<INode>)>& callback) OVERRIDE;
123 virtual void CreateView(TransportViewId transport_view_id, 139 virtual void CreateView(TransportViewId transport_view_id,
124 const Callback<void(bool)>& callback) OVERRIDE; 140 const Callback<void(bool)>& callback) OVERRIDE;
125 virtual void DeleteView(TransportViewId transport_view_id, 141 virtual void DeleteView(TransportViewId transport_view_id,
126 const Callback<void(bool)>& callback) OVERRIDE; 142 const Callback<void(bool)>& callback) OVERRIDE;
127 virtual void SetView(TransportNodeId transport_node_id, 143 virtual void SetView(TransportNodeId transport_node_id,
128 TransportViewId transport_view_id, 144 TransportViewId transport_view_id,
129 const Callback<void(bool)>& callback) OVERRIDE; 145 const Callback<void(bool)>& callback) OVERRIDE;
130 virtual void SetViewContents(TransportViewId view_id, 146 virtual void SetViewContents(TransportViewId view_id,
131 ScopedSharedBufferHandle buffer, 147 ScopedSharedBufferHandle buffer,
132 uint32_t buffer_size) OVERRIDE; 148 uint32_t buffer_size) OVERRIDE;
149 virtual void SetRoots(
150 TransportConnectionId connection_id,
151 const Array<TransportNodeId>& transport_node_ids,
152 const Callback<void(bool)>& callback) OVERRIDE;
133 153
134 // Overridden from NodeDelegate: 154 // Overridden from NodeDelegate:
135 virtual void OnNodeHierarchyChanged(const Node* node, 155 virtual void OnNodeHierarchyChanged(const Node* node,
136 const Node* new_parent, 156 const Node* new_parent,
137 const Node* old_parent) OVERRIDE; 157 const Node* old_parent) OVERRIDE;
138 virtual void OnNodeViewReplaced(const Node* node, 158 virtual void OnNodeViewReplaced(const Node* node,
139 const View* new_view, 159 const View* new_view,
140 const View* old_view) OVERRIDE; 160 const View* old_view) OVERRIDE;
141 161
142 RootNodeManager* root_node_manager_; 162 RootNodeManager* root_node_manager_;
143 163
144 // Id of this connection as assigned by RootNodeManager. Assigned in 164 // Id of this connection as assigned by RootNodeManager. Assigned in
145 // OnConnectionEstablished(). 165 // OnConnectionEstablished().
146 TransportConnectionId id_; 166 TransportConnectionId id_;
147 167
148 NodeMap node_map_; 168 NodeMap node_map_;
149 169
150 ViewMap view_map_; 170 ViewMap view_map_;
151 171
152 // The set of nodes that has been communicated to the client. 172 // The set of nodes that has been communicated to the client.
153 NodeIdSet known_nodes_; 173 NodeIdSet known_nodes_;
154 174
175 // This is the set of nodes the client can see. The client can not delete or
176 // move these.
177 NodeIdSet roots_;
178
155 DISALLOW_COPY_AND_ASSIGN(ViewManagerConnection); 179 DISALLOW_COPY_AND_ASSIGN(ViewManagerConnection);
156 }; 180 };
157 181
158 #if defined(OS_WIN) 182 #if defined(OS_WIN)
159 #pragma warning(pop) 183 #pragma warning(pop)
160 #endif 184 #endif
161 185
162 } // namespace service 186 } // namespace service
163 } // namespace view_manager 187 } // namespace view_manager
164 } // namespace mojo 188 } // namespace mojo
165 189
166 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_ 190 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_
OLDNEW
« no previous file with comments | « mojo/services/view_manager/type_converters.cc ('k') | mojo/services/view_manager/view_manager_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698