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

Unified Diff: mojo/services/view_manager/view_manager_init_service_impl.cc

Issue 400113005: A new WM bootstrap flow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 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
« no previous file with comments | « mojo/services/view_manager/view_manager_init_service_impl.h ('k') | mojo/services/window_manager/main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/view_manager/view_manager_init_service_impl.cc
diff --git a/mojo/services/view_manager/view_manager_init_service_impl.cc b/mojo/services/view_manager/view_manager_init_service_impl.cc
index 79cc6c48fb91747d70b98e7b3b48ecb9108e1d8d..e375439f46be8c2f95c9ee86d440f1fb898a32b6 100644
--- a/mojo/services/view_manager/view_manager_init_service_impl.cc
+++ b/mojo/services/view_manager/view_manager_init_service_impl.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "mojo/public/interfaces/service_provider/service_provider.mojom.h"
#include "mojo/services/view_manager/ids.h"
+#include "mojo/services/view_manager/view_manager_init_service_context.h"
#include "mojo/services/view_manager/view_manager_service_impl.h"
namespace mojo {
@@ -19,25 +20,34 @@ ViewManagerInitServiceImpl::ConnectParams::ConnectParams() {}
ViewManagerInitServiceImpl::ConnectParams::~ConnectParams() {}
ViewManagerInitServiceImpl::ViewManagerInitServiceImpl(
- ApplicationConnection* connection)
- : root_node_manager_(
- connection,
- this,
- base::Bind(&ViewManagerInitServiceImpl::OnNativeViewportDeleted,
- base::Unretained(this))),
- is_tree_host_ready_(false) {
+ ApplicationConnection* connection,
+ ViewManagerInitServiceContext* context)
+ : context_(context) {
+ context_->AddConnection(this);
}
ViewManagerInitServiceImpl::~ViewManagerInitServiceImpl() {
+ context_->RemoveConnection(this);
+}
+
+void ViewManagerInitServiceImpl::OnNativeViewportDeleted() {
+ // TODO(beng): Should not have to rely on implementation detail of
+ // InterfaceImpl to close the connection. Instead should simply
+ // be able to delete this object.
+ internal_state()->router()->CloseMessagePipe();
+}
+
+void ViewManagerInitServiceImpl::OnRootViewManagerWindowTreeHostCreated() {
+ MaybeEmbed();
}
void ViewManagerInitServiceImpl::MaybeEmbed() {
- if (!is_tree_host_ready_)
+ if (!context_->is_tree_host_ready())
return;
ScopedVector<ConnectParams>::const_iterator it = connect_params_.begin();
for (; it != connect_params_.end(); ++it) {
- root_node_manager_.EmbedRoot((*it)->url);
+ context_->root_node_manager()->EmbedRoot((*it)->url);
(*it)->callback.Run(true);
}
connect_params_.clear();
@@ -53,19 +63,6 @@ void ViewManagerInitServiceImpl::Embed(
MaybeEmbed();
}
-void ViewManagerInitServiceImpl::OnRootViewManagerWindowTreeHostCreated() {
- DCHECK(!is_tree_host_ready_);
- is_tree_host_ready_ = true;
- MaybeEmbed();
-}
-
-void ViewManagerInitServiceImpl::OnNativeViewportDeleted() {
- // TODO(beng): Should not have to rely on implementation detail of
- // InterfaceImpl to close the connection. Instead should simply
- // be able to delete this object.
- internal_state()->router()->CloseMessagePipe();
-}
-
} // namespace service
} // namespace view_manager
} // namespace mojo
« no previous file with comments | « mojo/services/view_manager/view_manager_init_service_impl.h ('k') | mojo/services/window_manager/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698