| 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/public/cpp/view_manager/view_manager.h" | 5 #include "mojo/services/public/cpp/view_manager/view_manager.h" |
| 6 | 6 |
| 7 #include "mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h" | 7 #include "mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h" |
| 8 #include "mojo/services/public/cpp/view_manager/lib/view_tree_node_private.h" | 8 #include "mojo/services/public/cpp/view_manager/lib/view_tree_node_private.h" |
| 9 #include "mojo/services/public/cpp/view_manager/view.h" | 9 #include "mojo/services/public/cpp/view_manager/view.h" |
| 10 | 10 |
| 11 namespace mojo { | 11 namespace mojo { |
| 12 namespace view_manager { | 12 namespace view_manager { |
| 13 | 13 |
| 14 ViewManager::ViewManager(ServiceProvider* service_provider) | 14 ViewManager::ViewManager(Shell* shell) |
| 15 : service_provider_(service_provider) {} | 15 : shell_(shell) {} |
| 16 | 16 |
| 17 ViewManager::~ViewManager() { | 17 ViewManager::~ViewManager() { |
| 18 while (!nodes_.empty()) { | 18 while (!nodes_.empty()) { |
| 19 IdToNodeMap::iterator it = nodes_.begin(); | 19 IdToNodeMap::iterator it = nodes_.begin(); |
| 20 if (synchronizer_->OwnsNode(it->second->id())) | 20 if (synchronizer_->OwnsNode(it->second->id())) |
| 21 it->second->Destroy(); | 21 it->second->Destroy(); |
| 22 else | 22 else |
| 23 nodes_.erase(it); | 23 nodes_.erase(it); |
| 24 } | 24 } |
| 25 while (!views_.empty()) { | 25 while (!views_.empty()) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 40 return it != nodes_.end() ? it->second : NULL; | 40 return it != nodes_.end() ? it->second : NULL; |
| 41 } | 41 } |
| 42 | 42 |
| 43 View* ViewManager::GetViewById(TransportViewId id) { | 43 View* ViewManager::GetViewById(TransportViewId id) { |
| 44 IdToViewMap::const_iterator it = views_.find(id); | 44 IdToViewMap::const_iterator it = views_.find(id); |
| 45 return it != views_.end() ? it->second : NULL; | 45 return it != views_.end() ? it->second : NULL; |
| 46 } | 46 } |
| 47 | 47 |
| 48 } // namespace view_manager | 48 } // namespace view_manager |
| 49 } // namespace mojo | 49 } // namespace mojo |
| OLD | NEW |