| 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_SERVICE_IMPL_H_ | 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_ |
| 6 #define MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_ | 6 #define MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 bool CanReorderNode(const Node* node, | 116 bool CanReorderNode(const Node* node, |
| 117 const Node* relative_node, | 117 const Node* relative_node, |
| 118 OrderDirection direction) const; | 118 OrderDirection direction) const; |
| 119 bool CanDeleteNode(const NodeId& node_id) const; | 119 bool CanDeleteNode(const NodeId& node_id) const; |
| 120 bool CanDeleteView(const ViewId& view_id) const; | 120 bool CanDeleteView(const ViewId& view_id) const; |
| 121 bool CanSetView(const Node* node, const ViewId& view_id) const; | 121 bool CanSetView(const Node* node, const ViewId& view_id) const; |
| 122 bool CanSetFocus(const Node* node) const; | 122 bool CanSetFocus(const Node* node) const; |
| 123 bool CanGetNodeTree(const Node* node) const; | 123 bool CanGetNodeTree(const Node* node) const; |
| 124 bool CanEmbed(Id transport_node_id) const; | 124 bool CanEmbed(Id transport_node_id) const; |
| 125 bool CanSetNodeVisibility(const Node* node, bool visible) const; | 125 bool CanSetNodeVisibility(const Node* node, bool visible) const; |
| 126 // Used during GetNodeTreeImpl() to decide if we should descend into |node| |
| 127 // when building the results of GetNodeTree(). |
| 128 bool CanDescendIntoNodeForNodeTree(const Node* node) const; |
| 126 | 129 |
| 127 // Deletes a node owned by this connection. Returns true on success. |source| | 130 // Deletes a node owned by this connection. Returns true on success. |source| |
| 128 // is the connection that originated the change. | 131 // is the connection that originated the change. |
| 129 bool DeleteNodeImpl(ViewManagerServiceImpl* source, const NodeId& node_id); | 132 bool DeleteNodeImpl(ViewManagerServiceImpl* source, const NodeId& node_id); |
| 130 | 133 |
| 131 // Deletes a view owned by this connection. Returns true on success. |source| | 134 // Deletes a view owned by this connection. Returns true on success. |source| |
| 132 // is the connection that originated the change. | 135 // is the connection that originated the change. |
| 133 bool DeleteViewImpl(ViewManagerServiceImpl* source, const ViewId& view_id); | 136 bool DeleteViewImpl(ViewManagerServiceImpl* source, const ViewId& view_id); |
| 134 | 137 |
| 135 // Sets the view associated with a node. | 138 // Sets the view associated with a node. |
| 136 bool SetViewImpl(Node* node, const ViewId& view_id); | 139 bool SetViewImpl(Node* node, const ViewId& view_id); |
| 137 | 140 |
| 138 // If |node| is known (in |known_nodes_|) does nothing. Otherwise adds |node| | 141 // If |node| is known (in |known_nodes_|) does nothing. Otherwise adds |node| |
| 139 // to |nodes|, marks |node| as known and recurses. | 142 // to |nodes|, marks |node| as known and recurses. |
| 140 void GetUnknownNodesFrom(const Node* node, std::vector<const Node*>* nodes); | 143 void GetUnknownNodesFrom(const Node* node, std::vector<const Node*>* nodes); |
| 141 | 144 |
| 145 // Returns true if node (or one of its ancestors) is embedded in another |
| 146 // connection. |
| 147 bool IsNodeEmbeddedInAnotherConnection(const Node* node) const; |
| 148 |
| 142 // Removes |node| and all its descendants from |known_nodes_|. This does not | 149 // Removes |node| and all its descendants from |known_nodes_|. This does not |
| 143 // recurse through nodes that were created by this connection. All nodes owned | 150 // recurse through nodes that were created by this connection. All nodes owned |
| 144 // by this connection are added to |local_nodes|. | 151 // by this connection are added to |local_nodes|. |
| 145 void RemoveFromKnown(const Node* node, std::vector<Node*>* local_nodes); | 152 void RemoveFromKnown(const Node* node, std::vector<Node*>* local_nodes); |
| 146 | 153 |
| 147 // Adds |node_id| to the set of roots this connection knows about. The caller | 154 // Adds |node_id| to the set of roots this connection knows about. The caller |
| 148 // should have verified |node_id| is not among the roots of this connection. | 155 // should have verified |node_id| is not among the roots of this connection. |
| 149 void AddRoot(const NodeId& node_id); | 156 void AddRoot(const NodeId& node_id); |
| 150 | 157 |
| 151 // Removes |node_id| from the set of roots this connection knows about. | 158 // Removes |node_id| from the set of roots this connection knows about. |
| 152 void RemoveRoot(const NodeId& node_id); | 159 void RemoveRoot(const NodeId& node_id); |
| 153 | 160 |
| 161 void RemoveChildrenAsPartOfEmbed(const NodeId& node_id); |
| 162 |
| 154 // Returns true if |node| is a non-null and a descendant of |roots_| (or | 163 // Returns true if |node| is a non-null and a descendant of |roots_| (or |
| 155 // |roots_| is empty). | 164 // |roots_| is empty). |
| 156 bool IsNodeDescendantOfRoots(const Node* node) const; | 165 bool IsNodeDescendantOfRoots(const Node* node) const; |
| 157 | 166 |
| 158 // Returns true if notification should be sent of a hierarchy change. If true | 167 // Returns true if notification should be sent of a hierarchy change. If true |
| 159 // is returned, any nodes that need to be sent to the client are added to | 168 // is returned, any nodes that need to be sent to the client are added to |
| 160 // |to_send|. | 169 // |to_send|. |
| 161 bool ShouldNotifyOnHierarchyChange(const Node* node, | 170 bool ShouldNotifyOnHierarchyChange(const Node* node, |
| 162 const Node** new_parent, | 171 const Node** new_parent, |
| 163 const Node** old_parent, | 172 const Node** old_parent, |
| 164 std::vector<const Node*>* to_send); | 173 std::vector<const Node*>* to_send); |
| 165 | 174 |
| 166 // Converts an array of Nodes to NodeDatas. This assumes all the nodes are | 175 // Converts an array of Nodes to NodeDatas. This assumes all the nodes are |
| 167 // valid for the client. The parent of nodes the client is not allowed to see | 176 // valid for the client. The parent of nodes the client is not allowed to see |
| 168 // are set to NULL (in the returned NodeDatas). | 177 // are set to NULL (in the returned NodeDatas). |
| 169 Array<NodeDataPtr> NodesToNodeDatas(const std::vector<const Node*>& nodes); | 178 Array<NodeDataPtr> NodesToNodeDatas(const std::vector<const Node*>& nodes); |
| 170 | 179 |
| 180 // Implementation of GetNodeTree(). Adds |node| to |nodes| and recurses if |
| 181 // CanDescendIntoNodeForNodeTree() returns true. |
| 182 void GetNodeTreeImpl(const Node* node, std::vector<const Node*>* nodes) const; |
| 183 |
| 171 // ViewManagerService: | 184 // ViewManagerService: |
| 172 virtual void CreateNode(Id transport_node_id, | 185 virtual void CreateNode(Id transport_node_id, |
| 173 const Callback<void(ErrorCode)>& callback) OVERRIDE; | 186 const Callback<void(ErrorCode)>& callback) OVERRIDE; |
| 174 virtual void DeleteNode(Id transport_node_id, | 187 virtual void DeleteNode(Id transport_node_id, |
| 175 const Callback<void(bool)>& callback) OVERRIDE; | 188 const Callback<void(bool)>& callback) OVERRIDE; |
| 176 virtual void AddNode(Id parent_id, | 189 virtual void AddNode(Id parent_id, |
| 177 Id child_id, | 190 Id child_id, |
| 178 const Callback<void(bool)>& callback) OVERRIDE; | 191 const Callback<void(bool)>& callback) OVERRIDE; |
| 179 virtual void RemoveNodeFromParent( | 192 virtual void RemoveNodeFromParent( |
| 180 Id node_id, | 193 Id node_id, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 266 |
| 254 #if defined(OS_WIN) | 267 #if defined(OS_WIN) |
| 255 #pragma warning(pop) | 268 #pragma warning(pop) |
| 256 #endif | 269 #endif |
| 257 | 270 |
| 258 } // namespace service | 271 } // namespace service |
| 259 } // namespace view_manager | 272 } // namespace view_manager |
| 260 } // namespace mojo | 273 } // namespace mojo |
| 261 | 274 |
| 262 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_ | 275 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_ |
| OLD | NEW |