Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(604)

Unified Diff: mojo/services/public/cpp/view_manager/lib/view_manager.cc

Issue 303163005: Embedding demo in View manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/services/public/cpp/view_manager/lib/view_manager.cc
diff --git a/mojo/services/public/cpp/view_manager/lib/view_manager.cc b/mojo/services/public/cpp/view_manager/lib/view_manager.cc
index 93d99e8ea50b94c373ee73812c1e6bfa5d033956..74fa6998ff2d02e77338cb4eb922ec937420931d 100644
--- a/mojo/services/public/cpp/view_manager/lib/view_manager.cc
+++ b/mojo/services/public/cpp/view_manager/lib/view_manager.cc
@@ -4,6 +4,8 @@
#include "mojo/services/public/cpp/view_manager/view_manager.h"
+#include "base/message_loop/message_loop.h"
+#include "mojo/public/cpp/application/application.h"
#include "mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h"
#include "mojo/services/public/cpp/view_manager/lib/view_tree_node_private.h"
#include "mojo/services/public/cpp/view_manager/view.h"
@@ -11,8 +13,13 @@
namespace mojo {
namespace view_manager {
-ViewManager::ViewManager(ServiceProvider* service_provider)
- : service_provider_(service_provider) {}
+ViewManager::ViewManager(Application* application)
+ : synchronizer_(NULL),
+ tree_(NULL) {
+ application->AddService<ViewManagerSynchronizer>(this);
+ // Block in a nested message loop until the ViewManagerSynchronizer is set up.
+ base::MessageLoop::current()->Run();
+}
ViewManager::~ViewManager() {
while (!nodes_.empty()) {
@@ -31,10 +38,6 @@ ViewManager::~ViewManager() {
}
}
-void ViewManager::Init() {
- synchronizer_.reset(new ViewManagerSynchronizer(this));
-}
-
ViewTreeNode* ViewManager::GetNodeById(TransportNodeId id) {
IdToNodeMap::const_iterator it = nodes_.find(id);
return it != nodes_.end() ? it->second : NULL;
@@ -45,5 +48,9 @@ View* ViewManager::GetViewById(TransportViewId id) {
return it != views_.end() ? it->second : NULL;
}
+void ViewManager::Embed(const String& url, ViewTreeNode* node) {
+ synchronizer_->Embed(url, node->id());
+}
+
} // namespace view_manager
} // namespace mojo
« no previous file with comments | « mojo/services/public/cpp/view_manager/lib/view.cc ('k') | mojo/services/public/cpp/view_manager/lib/view_manager_private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698