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 |
111 void RootNodeManager::PrepareForChange(ViewManagerConnection* connection, | 121 void RootNodeManager::PrepareForChange(ViewManagerConnection* connection, |
112 TransportChangeId change_id) { | 122 TransportChangeId change_id) { |
113 DCHECK(!change_.get()); // Should only ever have one change in flight. | 123 DCHECK(!change_.get()); // Should only ever have one change in flight. |
114 change_.reset(new Change(connection->id(), change_id)); | 124 change_.reset(new Change(connection->id(), change_id)); |
115 } | 125 } |
116 | 126 |
117 void RootNodeManager::FinishChange() { | 127 void RootNodeManager::FinishChange() { |
118 DCHECK(change_.get()); // PrepareForChange/FinishChange should be balanced. | 128 DCHECK(change_.get()); // PrepareForChange/FinishChange should be balanced. |
119 change_.reset(); | 129 change_.reset(); |
120 } | 130 } |
121 | 131 |
122 void RootNodeManager::OnNodeHierarchyChanged(const NodeId& node, | 132 void RootNodeManager::OnNodeHierarchyChanged(const NodeId& node, |
123 const NodeId& new_parent, | 133 const NodeId& new_parent, |
124 const NodeId& old_parent) { | 134 const NodeId& old_parent) { |
125 if (!root_view_manager_.in_setup()) | 135 if (!root_view_manager_.in_setup()) |
126 NotifyNodeHierarchyChanged(node, new_parent, old_parent); | 136 NotifyNodeHierarchyChanged(node, new_parent, old_parent); |
127 } | 137 } |
128 | 138 |
129 void RootNodeManager::OnNodeViewReplaced(const NodeId& node, | 139 void RootNodeManager::OnNodeViewReplaced(const NodeId& node, |
130 const ViewId& new_view_id, | 140 const ViewId& new_view_id, |
131 const ViewId& old_view_id) { | 141 const ViewId& old_view_id) { |
132 NotifyNodeViewReplaced(node, new_view_id, old_view_id); | 142 NotifyNodeViewReplaced(node, new_view_id, old_view_id); |
133 } | 143 } |
134 | 144 |
135 } // namespace view_manager | 145 } // namespace view_manager |
136 } // namespace services | 146 } // namespace services |
137 } // namespace mojo | 147 } // namespace mojo |
OLD | NEW |