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

Unified Diff: mojo/shell/application_manager/shell_impl.cc

Issue 1049993002: Get mojo_shell building inside chromium checkout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix presubmit Created 5 years, 9 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/shell/application_manager/shell_impl.h ('k') | mojo/shell/application_manager/test.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/application_manager/shell_impl.cc
diff --git a/mojo/shell/application_manager/shell_impl.cc b/mojo/shell/application_manager/shell_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ed8c5ea021a96453a33e600cfa1626491247e9cd
--- /dev/null
+++ b/mojo/shell/application_manager/shell_impl.cc
@@ -0,0 +1,62 @@
+// Copyright 2015 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/shell/application_manager/shell_impl.h"
+
+#include "mojo/common/common_type_converters.h"
+#include "mojo/common/url_type_converters.h"
+#include "mojo/shell/application_manager/application_manager.h"
+#include "third_party/mojo_services/src/content_handler/public/interfaces/content_handler.mojom.h"
+
+namespace mojo {
+namespace shell {
+
+ShellImpl::ShellImpl(ApplicationPtr application,
+ ApplicationManager* manager,
+ const Identity& identity,
+ const base::Closure& on_application_end)
+ : manager_(manager),
+ identity_(identity),
+ on_application_end_(on_application_end),
+ application_(application.Pass()),
+ binding_(this) {
+ binding_.set_error_handler(this);
+}
+
+ShellImpl::~ShellImpl() {
+}
+
+void ShellImpl::InitializeApplication(Array<String> args) {
+ ShellPtr shell;
+ binding_.Bind(GetProxy(&shell));
+ application_->Initialize(shell.Pass(), args.Pass(), identity_.url.spec());
+}
+
+void ShellImpl::ConnectToClient(const GURL& requested_url,
+ const GURL& requestor_url,
+ InterfaceRequest<ServiceProvider> services,
+ ServiceProviderPtr exposed_services) {
+ application_->AcceptConnection(String::From(requestor_url), services.Pass(),
+ exposed_services.Pass(), requested_url.spec());
+}
+
+// Shell implementation:
+void ShellImpl::ConnectToApplication(const String& app_url,
+ InterfaceRequest<ServiceProvider> services,
+ ServiceProviderPtr exposed_services) {
+ GURL app_gurl(app_url);
+ if (!app_gurl.is_valid()) {
+ LOG(ERROR) << "Error: invalid URL: " << app_url;
+ return;
+ }
+ manager_->ConnectToApplication(app_gurl, identity_.url, services.Pass(),
+ exposed_services.Pass(), base::Closure());
+}
+
+void ShellImpl::OnConnectionError() {
+ manager_->OnShellImplError(this);
+}
+
+} // namespace shell
+} // namespace mojo
« no previous file with comments | « mojo/shell/application_manager/shell_impl.h ('k') | mojo/shell/application_manager/test.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698