| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // Marks the connection with the specified id as having seen a message. | 62 // Marks the connection with the specified id as having seen a message. |
| 63 void MarkConnectionAsMessaged(ConnectionSpecificId connection_id) { | 63 void MarkConnectionAsMessaged(ConnectionSpecificId connection_id) { |
| 64 message_ids_.insert(connection_id); | 64 message_ids_.insert(connection_id); |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Returns true if MarkConnectionAsMessaged(connection_id) was invoked. | 67 // Returns true if MarkConnectionAsMessaged(connection_id) was invoked. |
| 68 bool DidMessageConnection(ConnectionSpecificId connection_id) const { | 68 bool DidMessageConnection(ConnectionSpecificId connection_id) const { |
| 69 return message_ids_.count(connection_id) > 0; | 69 return message_ids_.count(connection_id) > 0; |
| 70 } | 70 } |
| 71 | 71 |
| 72 // Sends OnServerChangeIdAdvanced() to all connections that have not yet |
| 73 // been messaged. |
| 74 void SendServerChangeIdAdvanced(); |
| 75 |
| 72 private: | 76 private: |
| 73 RootNodeManager* root_; | 77 RootNodeManager* root_; |
| 74 const ConnectionSpecificId connection_id_; | 78 const ConnectionSpecificId connection_id_; |
| 75 const ChangeType change_type_; | 79 const ChangeType change_type_; |
| 76 const bool is_delete_node_; | 80 const bool is_delete_node_; |
| 77 | 81 |
| 78 // See description of MarkConnectionAsMessaged/DidMessageConnection. | 82 // See description of MarkConnectionAsMessaged/DidMessageConnection. |
| 79 std::set<ConnectionSpecificId> message_ids_; | 83 std::set<ConnectionSpecificId> message_ids_; |
| 80 | 84 |
| 81 DISALLOW_COPY_AND_ASSIGN(ScopedChange); | 85 DISALLOW_COPY_AND_ASSIGN(ScopedChange); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // to avoid sending ServerChangeIdAdvanced() unnecessarily. | 130 // to avoid sending ServerChangeIdAdvanced() unnecessarily. |
| 127 void OnConnectionMessagedClient(ConnectionSpecificId id); | 131 void OnConnectionMessagedClient(ConnectionSpecificId id); |
| 128 | 132 |
| 129 // Returns true if OnConnectionMessagedClient() was invoked for id. | 133 // Returns true if OnConnectionMessagedClient() was invoked for id. |
| 130 bool DidConnectionMessageClient(ConnectionSpecificId id) const; | 134 bool DidConnectionMessageClient(ConnectionSpecificId id) const; |
| 131 | 135 |
| 132 ViewManagerServiceImpl* GetConnectionByCreator( | 136 ViewManagerServiceImpl* GetConnectionByCreator( |
| 133 ConnectionSpecificId creator_id, | 137 ConnectionSpecificId creator_id, |
| 134 const std::string& url) const; | 138 const std::string& url) const; |
| 135 | 139 |
| 140 // Returns the ViewManagerServiceImpl that has |id| as a root. |
| 141 ViewManagerServiceImpl* GetConnectionWithRoot(const NodeId& id); |
| 142 |
| 136 void DispatchViewInputEventToWindowManager(const View* view, | 143 void DispatchViewInputEventToWindowManager(const View* view, |
| 137 const ui::Event* event); | 144 const ui::Event* event); |
| 138 | 145 |
| 139 // These functions trivially delegate to all ViewManagerServiceImpls, which in | 146 // These functions trivially delegate to all ViewManagerServiceImpls, which in |
| 140 // term notify their clients. | 147 // term notify their clients. |
| 141 void ProcessNodeDestroyed(Node* node); | 148 void ProcessNodeDestroyed(Node* node); |
| 142 void ProcessNodeBoundsChanged(const Node* node, | 149 void ProcessNodeBoundsChanged(const Node* node, |
| 143 const gfx::Rect& old_bounds, | 150 const gfx::Rect& old_bounds, |
| 144 const gfx::Rect& new_bounds); | 151 const gfx::Rect& new_bounds); |
| 145 void ProcessNodeHierarchyChanged(const Node* node, | 152 void ProcessNodeHierarchyChanged(const Node* node, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 171 // by FinishChange() once the change is done. | 178 // by FinishChange() once the change is done. |
| 172 // | 179 // |
| 173 // Changes should never nest, meaning each PrepareForChange() must be | 180 // Changes should never nest, meaning each PrepareForChange() must be |
| 174 // balanced with a call to FinishChange() with no PrepareForChange() | 181 // balanced with a call to FinishChange() with no PrepareForChange() |
| 175 // in between. | 182 // in between. |
| 176 void PrepareForChange(ScopedChange* change); | 183 void PrepareForChange(ScopedChange* change); |
| 177 | 184 |
| 178 // Balances a call to PrepareForChange(). | 185 // Balances a call to PrepareForChange(). |
| 179 void FinishChange(); | 186 void FinishChange(); |
| 180 | 187 |
| 188 // See description in ScopedChange. |
| 189 void SendServerChangeIdAdvanced(); |
| 190 |
| 181 // Returns true if the specified connection originated the current change. | 191 // Returns true if the specified connection originated the current change. |
| 182 bool IsChangeSource(ConnectionSpecificId connection_id) const { | 192 bool IsChangeSource(ConnectionSpecificId connection_id) const { |
| 183 return current_change_ && current_change_->connection_id() == connection_id; | 193 return current_change_ && current_change_->connection_id() == connection_id; |
| 184 } | 194 } |
| 185 | 195 |
| 186 // Implementation of the two embed variants. | 196 // Implementation of the two embed variants. |
| 187 ViewManagerServiceImpl* EmbedImpl(ConnectionSpecificId creator_id, | 197 ViewManagerServiceImpl* EmbedImpl(ConnectionSpecificId creator_id, |
| 188 const String& url, | 198 const String& url, |
| 189 const NodeId& root_id); | 199 const NodeId& root_id); |
| 190 | 200 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 ScopedChange* current_change_; | 238 ScopedChange* current_change_; |
| 229 | 239 |
| 230 DISALLOW_COPY_AND_ASSIGN(RootNodeManager); | 240 DISALLOW_COPY_AND_ASSIGN(RootNodeManager); |
| 231 }; | 241 }; |
| 232 | 242 |
| 233 } // namespace service | 243 } // namespace service |
| 234 } // namespace view_manager | 244 } // namespace view_manager |
| 235 } // namespace mojo | 245 } // namespace mojo |
| 236 | 246 |
| 237 #endif // MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_ | 247 #endif // MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_ |
| OLD | NEW |