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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 61 } |
62 const Node* GetNode(const NodeId& id) const; | 62 const Node* GetNode(const NodeId& id) const; |
63 | 63 |
64 // Returns the View with the specified id. | 64 // Returns the View with the specified id. |
65 View* GetView(const ViewId& id) { | 65 View* GetView(const ViewId& id) { |
66 return const_cast<View*>( | 66 return const_cast<View*>( |
67 const_cast<const ViewManagerServiceImpl*>(this)->GetView(id)); | 67 const_cast<const ViewManagerServiceImpl*>(this)->GetView(id)); |
68 } | 68 } |
69 const View* GetView(const ViewId& id) const; | 69 const View* GetView(const ViewId& id) const; |
70 | 70 |
| 71 // Returns true if this has |id| as a root. |
| 72 bool HasRoot(const NodeId& id) const; |
| 73 |
71 // Invoked when a connection is destroyed. | 74 // Invoked when a connection is destroyed. |
72 void OnViewManagerServiceImplDestroyed(ConnectionSpecificId id); | 75 void OnViewManagerServiceImplDestroyed(ConnectionSpecificId id); |
73 | 76 |
74 // The following methods are invoked after the corresponding change has been | 77 // The following methods are invoked after the corresponding change has been |
75 // processed. They do the appropriate bookkeeping and update the client as | 78 // processed. They do the appropriate bookkeeping and update the client as |
76 // necessary. | 79 // necessary. |
77 void ProcessNodeBoundsChanged(const Node* node, | 80 void ProcessNodeBoundsChanged(const Node* node, |
78 const gfx::Rect& old_bounds, | 81 const gfx::Rect& old_bounds, |
79 const gfx::Rect& new_bounds, | 82 const gfx::Rect& new_bounds, |
80 bool originated_change); | 83 bool originated_change); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 bool DeleteViewImpl(ViewManagerServiceImpl* source, const ViewId& view_id); | 137 bool DeleteViewImpl(ViewManagerServiceImpl* source, const ViewId& view_id); |
135 | 138 |
136 // Sets the view associated with a node. | 139 // Sets the view associated with a node. |
137 bool SetViewImpl(Node* node, const ViewId& view_id); | 140 bool SetViewImpl(Node* node, const ViewId& view_id); |
138 | 141 |
139 // If |node| is known (in |known_nodes_|) does nothing. Otherwise adds |node| | 142 // If |node| is known (in |known_nodes_|) does nothing. Otherwise adds |node| |
140 // to |nodes|, marks |node| as known and recurses. | 143 // to |nodes|, marks |node| as known and recurses. |
141 void GetUnknownNodesFrom(const Node* node, std::vector<const Node*>* nodes); | 144 void GetUnknownNodesFrom(const Node* node, std::vector<const Node*>* nodes); |
142 | 145 |
143 // Removes |node| and all its descendants from |known_nodes_|. This does not | 146 // Removes |node| and all its descendants from |known_nodes_|. This does not |
144 // recurse through nodes that were created by this connection. | 147 // recurse through nodes that were created by this connection. All nodes owned |
145 void RemoveFromKnown(const Node* node); | 148 // by this connection are added to |local_nodes|. |
| 149 void RemoveFromKnown(const Node* node, std::vector<Node*>* local_nodes); |
146 | 150 |
147 // Adds |transport_node_id| to the set of roots this connection knows about. | 151 // Adds |node_id| to the set of roots this connection knows about. The caller |
148 // Returns true if |transport_node_id| was not already a root for this | 152 // should have verified |node_id| is not among the roots of this connection. |
149 // connection. | 153 void AddRoot(const NodeId& node_id); |
150 bool AddRoot(Id transport_node_id); | 154 |
| 155 // Removes |node_id| from the set of roots this connection knows about. |
| 156 void RemoveRoot(const NodeId& node_id); |
151 | 157 |
152 // Returns true if |node| is a non-null and a descendant of |roots_| (or | 158 // Returns true if |node| is a non-null and a descendant of |roots_| (or |
153 // |roots_| is empty). | 159 // |roots_| is empty). |
154 bool IsNodeDescendantOfRoots(const Node* node) const; | 160 bool IsNodeDescendantOfRoots(const Node* node) const; |
155 | 161 |
156 // Returns true if notification should be sent of a hierarchy change. If true | 162 // Returns true if notification should be sent of a hierarchy change. If true |
157 // is returned, any nodes that need to be sent to the client are added to | 163 // is returned, any nodes that need to be sent to the client are added to |
158 // |to_send|. | 164 // |to_send|. |
159 bool ShouldNotifyOnHierarchyChange(const Node* node, | 165 bool ShouldNotifyOnHierarchyChange(const Node* node, |
160 const Node** new_parent, | 166 const Node** new_parent, |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 261 |
256 #if defined(OS_WIN) | 262 #if defined(OS_WIN) |
257 #pragma warning(pop) | 263 #pragma warning(pop) |
258 #endif | 264 #endif |
259 | 265 |
260 } // namespace service | 266 } // namespace service |
261 } // namespace view_manager | 267 } // namespace view_manager |
262 } // namespace mojo | 268 } // namespace mojo |
263 | 269 |
264 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_ | 270 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_ |
OLD | NEW |