| 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_ROOT_NODE_MANAGER_H_ | 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_ |
| 6 #define MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_ | 6 #define MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 virtual ~RootNodeManager(); | 76 virtual ~RootNodeManager(); |
| 77 | 77 |
| 78 // Returns the id for the next ViewManagerServiceImpl. | 78 // Returns the id for the next ViewManagerServiceImpl. |
| 79 ConnectionSpecificId GetAndAdvanceNextConnectionId(); | 79 ConnectionSpecificId GetAndAdvanceNextConnectionId(); |
| 80 | 80 |
| 81 void AddConnection(ViewManagerServiceImpl* connection); | 81 void AddConnection(ViewManagerServiceImpl* connection); |
| 82 void RemoveConnection(ViewManagerServiceImpl* connection); | 82 void RemoveConnection(ViewManagerServiceImpl* connection); |
| 83 | 83 |
| 84 // Establishes the initial client. Similar to Connect(), but the resulting | 84 // Establishes the initial client. Similar to Connect(), but the resulting |
| 85 // client is allowed to do anything. | 85 // client is allowed to do anything. |
| 86 void EmbedRoot(const std::string& url); | 86 void EmbedRoot(const std::string& url, |
| 87 InterfaceRequest<ServiceProvider> service_provider); |
| 87 | 88 |
| 88 // See description of ViewManagerService::Embed() for details. This assumes | 89 // See description of ViewManagerService::Embed() for details. This assumes |
| 89 // |transport_node_id| is valid. | 90 // |transport_node_id| is valid. |
| 90 void Embed(ConnectionSpecificId creator_id, | 91 void Embed(ConnectionSpecificId creator_id, |
| 91 const String& url, | 92 const String& url, |
| 92 Id transport_node_id); | 93 Id transport_node_id, |
| 94 InterfaceRequest<ServiceProvider> service_provider); |
| 93 | 95 |
| 94 // Returns the connection by id. | 96 // Returns the connection by id. |
| 95 ViewManagerServiceImpl* GetConnection(ConnectionSpecificId connection_id); | 97 ViewManagerServiceImpl* GetConnection(ConnectionSpecificId connection_id); |
| 96 | 98 |
| 97 // Returns the Node identified by |id|. | 99 // Returns the Node identified by |id|. |
| 98 Node* GetNode(const NodeId& id); | 100 Node* GetNode(const NodeId& id); |
| 99 | 101 |
| 100 // Returns the View identified by |id|. | 102 // Returns the View identified by |id|. |
| 101 View* GetView(const ViewId& id); | 103 View* GetView(const ViewId& id); |
| 102 | 104 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 171 |
| 170 // Balances a call to PrepareForChange(). | 172 // Balances a call to PrepareForChange(). |
| 171 void FinishChange(); | 173 void FinishChange(); |
| 172 | 174 |
| 173 // Returns true if the specified connection originated the current change. | 175 // Returns true if the specified connection originated the current change. |
| 174 bool IsChangeSource(ConnectionSpecificId connection_id) const { | 176 bool IsChangeSource(ConnectionSpecificId connection_id) const { |
| 175 return current_change_ && current_change_->connection_id() == connection_id; | 177 return current_change_ && current_change_->connection_id() == connection_id; |
| 176 } | 178 } |
| 177 | 179 |
| 178 // Implementation of the two embed variants. | 180 // Implementation of the two embed variants. |
| 179 ViewManagerServiceImpl* EmbedImpl(ConnectionSpecificId creator_id, | 181 ViewManagerServiceImpl* EmbedImpl( |
| 180 const String& url, | 182 ConnectionSpecificId creator_id, |
| 181 const NodeId& root_id); | 183 const String& url, |
| 184 const NodeId& root_id, |
| 185 InterfaceRequest<ServiceProvider> service_provider); |
| 182 | 186 |
| 183 // Overridden from NodeDelegate: | 187 // Overridden from NodeDelegate: |
| 184 virtual void OnNodeDestroyed(const Node* node) OVERRIDE; | 188 virtual void OnNodeDestroyed(const Node* node) OVERRIDE; |
| 185 virtual void OnNodeHierarchyChanged(const Node* node, | 189 virtual void OnNodeHierarchyChanged(const Node* node, |
| 186 const Node* new_parent, | 190 const Node* new_parent, |
| 187 const Node* old_parent) OVERRIDE; | 191 const Node* old_parent) OVERRIDE; |
| 188 virtual void OnNodeBoundsChanged(const Node* node, | 192 virtual void OnNodeBoundsChanged(const Node* node, |
| 189 const gfx::Rect& old_bounds, | 193 const gfx::Rect& old_bounds, |
| 190 const gfx::Rect& new_bounds) OVERRIDE; | 194 const gfx::Rect& new_bounds) OVERRIDE; |
| 191 virtual void OnNodeViewReplaced(const Node* node, | 195 virtual void OnNodeViewReplaced(const Node* node, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 217 // (it's created on the stack by ViewManagerServiceImpl). | 221 // (it's created on the stack by ViewManagerServiceImpl). |
| 218 ScopedChange* current_change_; | 222 ScopedChange* current_change_; |
| 219 | 223 |
| 220 DISALLOW_COPY_AND_ASSIGN(RootNodeManager); | 224 DISALLOW_COPY_AND_ASSIGN(RootNodeManager); |
| 221 }; | 225 }; |
| 222 | 226 |
| 223 } // namespace service | 227 } // namespace service |
| 224 } // namespace mojo | 228 } // namespace mojo |
| 225 | 229 |
| 226 #endif // MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_ | 230 #endif // MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_ |
| OLD | NEW |