Index: shell/application_manager/shell_impl.cc |
diff --git a/shell/application_manager/shell_impl.cc b/shell/application_manager/shell_impl.cc |
index 4d0532ecc0af7c6f3a21eebc3bac39043270bb56..a54adb5825ca317dd3340cfb65ab27f01d060aba 100644 |
--- a/shell/application_manager/shell_impl.cc |
+++ b/shell/application_manager/shell_impl.cc |
@@ -4,23 +4,54 @@ |
#include "shell/application_manager/shell_impl.h" |
+#include <utility> |
+ |
#include "mojo/converters/url/url_type_converters.h" |
#include "mojo/services/content_handler/interfaces/content_handler.mojom.h" |
#include "shell/application_manager/application_manager.h" |
+using mojo::ApplicationConnector; |
+using mojo::ApplicationPtr; |
+using mojo::Array; |
+using mojo::InterfaceRequest; |
using mojo::ServiceProvider; |
using mojo::ServiceProviderPtr; |
+using mojo::Shell; |
+using mojo::ShellPtr; |
+using mojo::String; |
namespace shell { |
-ShellImpl::ShellImpl(mojo::ApplicationPtr application, |
+// ShellImpl::ApplicationConnectorImpl ----------------------------------------- |
+ |
+ShellImpl::ApplicationConnectorImpl::ApplicationConnectorImpl(Shell* shell) |
+ : shell_(shell) {} |
+ |
+ShellImpl::ApplicationConnectorImpl::~ApplicationConnectorImpl() {} |
+ |
+void ShellImpl::ApplicationConnectorImpl::ConnectToApplication( |
+ const String& app_url, |
+ InterfaceRequest<ServiceProvider> services, |
+ ServiceProviderPtr exposed_services) { |
+ shell_->ConnectToApplication(app_url, std::move(services), |
+ std::move(exposed_services)); |
+} |
+ |
+void ShellImpl::ApplicationConnectorImpl::Duplicate( |
+ InterfaceRequest<ApplicationConnector> application_connector_request) { |
+ bindings_.AddBinding(this, std::move(application_connector_request)); |
+} |
+ |
+// ShellImpl ------------------------------------------------------------------- |
+ |
+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()), |
+ application_(std::move(application)), |
binding_(this), |
application_connector_impl_(this) { |
binding_.set_connection_error_handler( |
@@ -30,40 +61,38 @@ ShellImpl::ShellImpl(mojo::ApplicationPtr application, |
ShellImpl::~ShellImpl() { |
} |
-void ShellImpl::InitializeApplication(mojo::Array<mojo::String> args) { |
- mojo::ShellPtr shell; |
- binding_.Bind(mojo::GetProxy(&shell)); |
- application_->Initialize(shell.Pass(), args.Pass(), identity_.url.spec()); |
+void ShellImpl::InitializeApplication(Array<String> args) { |
+ ShellPtr shell; |
+ binding_.Bind(GetProxy(&shell)); |
+ application_->Initialize(std::move(shell), std::move(args), |
+ identity_.url.spec()); |
} |
-void ShellImpl::ConnectToClient( |
- const GURL& requested_url, |
- const GURL& requestor_url, |
- mojo::InterfaceRequest<ServiceProvider> services, |
- ServiceProviderPtr exposed_services) { |
- application_->AcceptConnection(mojo::String::From(requestor_url), |
- services.Pass(), exposed_services.Pass(), |
- requested_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), std::move(services), |
+ std::move(exposed_services), requested_url.spec()); |
} |
-void ShellImpl::ConnectToApplication( |
- const mojo::String& app_url, |
- mojo::InterfaceRequest<ServiceProvider> services, |
- ServiceProviderPtr exposed_services) { |
+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()); |
+ manager_->ConnectToApplication(app_gurl, identity_.url, std::move(services), |
+ std::move(exposed_services), base::Closure()); |
} |
void ShellImpl::CreateApplicationConnector( |
- mojo::InterfaceRequest<mojo::ApplicationConnector> |
- application_connector_request) { |
- application_connectors_.AddBinding(&application_connector_impl_, |
- application_connector_request.Pass()); |
+ InterfaceRequest<ApplicationConnector> application_connector_request) { |
+ application_connector_impl_.Duplicate( |
+ std::move(application_connector_request)); |
} |
} // namespace shell |