| 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 #include "mojo/services/view_manager/root_node_manager.h" | 5 #include "mojo/services/view_manager/root_node_manager.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "mojo/services/view_manager/view_manager_connection.h" | 8 #include "mojo/services/view_manager/view_manager_connection.h" |
| 9 #include "ui/aura/env.h" | 9 #include "ui/aura/env.h" |
| 10 | 10 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 for (ConnectionMap::iterator i = connection_map_.begin(); | 101 for (ConnectionMap::iterator i = connection_map_.begin(); |
| 102 i != connection_map_.end(); ++i) { | 102 i != connection_map_.end(); ++i) { |
| 103 const TransportChangeId change_id = | 103 const TransportChangeId change_id = |
| 104 (change_ && i->first == change_->connection_id) ? | 104 (change_ && i->first == change_->connection_id) ? |
| 105 change_->change_id : 0; | 105 change_->change_id : 0; |
| 106 i->second->NotifyNodeViewReplaced(node, new_view_id, old_view_id, | 106 i->second->NotifyNodeViewReplaced(node, new_view_id, old_view_id, |
| 107 change_id); | 107 change_id); |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 | 110 |
| 111 void RootNodeManager::NotifyNodeDeleted(const NodeId& node) { | |
| 112 for (ConnectionMap::iterator i = connection_map_.begin(); | |
| 113 i != connection_map_.end(); ++i) { | |
| 114 const TransportChangeId change_id = | |
| 115 (change_ && i->first == change_->connection_id) ? | |
| 116 change_->change_id : 0; | |
| 117 i->second->NotifyNodeDeleted(node, change_id); | |
| 118 } | |
| 119 } | |
| 120 | |
| 121 void RootNodeManager::PrepareForChange(ViewManagerConnection* connection, | 111 void RootNodeManager::PrepareForChange(ViewManagerConnection* connection, |
| 122 TransportChangeId change_id) { | 112 TransportChangeId change_id) { |
| 123 DCHECK(!change_.get()); // Should only ever have one change in flight. | 113 DCHECK(!change_.get()); // Should only ever have one change in flight. |
| 124 change_.reset(new Change(connection->id(), change_id)); | 114 change_.reset(new Change(connection->id(), change_id)); |
| 125 } | 115 } |
| 126 | 116 |
| 127 void RootNodeManager::FinishChange() { | 117 void RootNodeManager::FinishChange() { |
| 128 DCHECK(change_.get()); // PrepareForChange/FinishChange should be balanced. | 118 DCHECK(change_.get()); // PrepareForChange/FinishChange should be balanced. |
| 129 change_.reset(); | 119 change_.reset(); |
| 130 } | 120 } |
| 131 | 121 |
| 132 void RootNodeManager::OnNodeHierarchyChanged(const NodeId& node, | 122 void RootNodeManager::OnNodeHierarchyChanged(const NodeId& node, |
| 133 const NodeId& new_parent, | 123 const NodeId& new_parent, |
| 134 const NodeId& old_parent) { | 124 const NodeId& old_parent) { |
| 135 if (!root_view_manager_.in_setup()) | 125 if (!root_view_manager_.in_setup()) |
| 136 NotifyNodeHierarchyChanged(node, new_parent, old_parent); | 126 NotifyNodeHierarchyChanged(node, new_parent, old_parent); |
| 137 } | 127 } |
| 138 | 128 |
| 139 void RootNodeManager::OnNodeViewReplaced(const NodeId& node, | 129 void RootNodeManager::OnNodeViewReplaced(const NodeId& node, |
| 140 const ViewId& new_view_id, | 130 const ViewId& new_view_id, |
| 141 const ViewId& old_view_id) { | 131 const ViewId& old_view_id) { |
| 142 NotifyNodeViewReplaced(node, new_view_id, old_view_id); | 132 NotifyNodeViewReplaced(node, new_view_id, old_view_id); |
| 143 } | 133 } |
| 144 | 134 |
| 145 } // namespace view_manager | 135 } // namespace view_manager |
| 146 } // namespace services | 136 } // namespace services |
| 147 } // namespace mojo | 137 } // namespace mojo |
| OLD | NEW |