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

Unified Diff: mojo/application_manager/shell_impl.cc

Issue 821123005: Move application_manager's ShellImpl to own file (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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/application_manager/shell_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/application_manager/shell_impl.cc
diff --git a/mojo/application_manager/shell_impl.cc b/mojo/application_manager/shell_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..52d5380a3b8a90020fe571550a2431e97b96d892
--- /dev/null
+++ b/mojo/application_manager/shell_impl.cc
@@ -0,0 +1,66 @@
+// 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/application_manager/shell_impl.h"
+
+#include "mojo/application_manager/application_manager.h"
+#include "mojo/common/common_type_converters.h"
+#include "mojo/services/content_handler/public/interfaces/content_handler.mojom.h"
+
+namespace mojo {
+
+ShellImpl::ShellImpl(ScopedMessagePipeHandle handle,
+ ApplicationManager* manager,
+ const GURL& requested_url,
+ const GURL& url)
+ : ShellImpl(manager, requested_url, url) {
+ binding_.Bind(handle.Pass());
+}
+
+ShellImpl::ShellImpl(ShellPtr* ptr,
+ ApplicationManager* manager,
+ const GURL& requested_url,
+ const GURL& url)
+ : ShellImpl(manager, requested_url, url) {
+ binding_.Bind(ptr);
+}
+
+ShellImpl::~ShellImpl() {
+}
+
+void ShellImpl::ConnectToClient(const GURL& requestor_url,
+ ServiceProviderPtr service_provider) {
+ client()->AcceptConnection(String::From(requestor_url),
+ service_provider.Pass());
+}
+
+ShellImpl::ShellImpl(ApplicationManager* manager,
+ const GURL& requested_url,
+ const GURL& url)
+ : manager_(manager),
+ requested_url_(requested_url),
+ url_(url),
+ binding_(this) {
+ binding_.set_error_handler(this);
+}
+
+// Shell implementation:
+void ShellImpl::ConnectToApplication(
+ const String& app_url,
+ InterfaceRequest<ServiceProvider> in_service_provider) {
+ ServiceProviderPtr out_service_provider;
+ out_service_provider.Bind(in_service_provider.PassMessagePipe());
+ GURL app_gurl(app_url);
+ if (!app_gurl.is_valid()) {
+ LOG(ERROR) << "Error: invalid URL: " << app_url;
+ return;
+ }
+ manager_->ConnectToApplication(app_gurl, url_, out_service_provider.Pass());
+}
+
+void ShellImpl::OnConnectionError() {
+ manager_->OnShellImplError(this);
+}
+
+} // namespace mojo
« no previous file with comments | « mojo/application_manager/shell_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698