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

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

Issue 308803002: Change type of interface created by mojo:view_manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup 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
« no previous file with comments | « mojo/services/view_manager/view_manager_init_connection.h ('k') | mojo/shell/view_manager_loader.h » ('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_connection.cc
diff --git a/mojo/services/view_manager/view_manager_init_connection.cc b/mojo/services/view_manager/view_manager_init_connection.cc
new file mode 100644
index 0000000000000000000000000000000000000000..dd201e5663ba52a9a89d38440714d6aa0a304962
--- /dev/null
+++ b/mojo/services/view_manager/view_manager_init_connection.cc
@@ -0,0 +1,61 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/services/view_manager/view_manager_init_connection.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_connection.h"
+
+namespace mojo {
+namespace view_manager {
+namespace service {
+
+ViewManagerInitConnection::ConnectParams::ConnectParams() {}
+
+ViewManagerInitConnection::ConnectParams::~ConnectParams() {}
+
+ViewManagerInitConnection::ViewManagerInitConnection(
+ ServiceProvider* service_provider)
+ : service_provider_(service_provider),
+ root_node_manager_(service_provider, this),
+ is_tree_host_ready_(false) {
+}
+
+ViewManagerInitConnection::~ViewManagerInitConnection() {
+}
+
+void ViewManagerInitConnection::MaybeConnect(
+ const std::string& url,
+ const Callback<void(bool)>& callback) {
+ if (!is_tree_host_ready_)
+ return;
+
+ root_node_manager_.InitialConnect(url);
+ callback.Run(true);
+}
+
+void ViewManagerInitConnection::Connect(const String& url,
+ const Callback<void(bool)>& callback) {
+ if (connect_params_.get()) {
+ DVLOG(1) << "Ignoring second connect";
+ callback.Run(false);
+ return;
+ }
+ connect_params_.reset(new ConnectParams);
+ connect_params_->url = url.To<std::string>();
+ connect_params_->callback = callback;
+ MaybeConnect(url.To<std::string>(), callback);
+}
+
+void ViewManagerInitConnection::OnRootViewManagerWindowTreeHostCreated() {
+ DCHECK(!is_tree_host_ready_);
+ is_tree_host_ready_ = true;
+ if (connect_params_.get())
+ MaybeConnect(connect_params_->url, connect_params_->callback);
+}
+
+} // namespace service
+} // namespace view_manager
+} // namespace mojo
« no previous file with comments | « mojo/services/view_manager/view_manager_init_connection.h ('k') | mojo/shell/view_manager_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698