Add an ApplicationConnector interface, etc.
Also do a bit of (minimal) cleanup of ApplicationImpl.
From the Shell interface, you can mint ApplicationConnectors, which
allows you to connect to other applications. This is useful if you want
to connect to applications from other threads or other environments
(e.g., inside a VM).
TODO(vtl): Maybe add a Duplicate() to ApplicationConnector. The reason
we don't just add a Duplicate() to Shell is that Shell is associated
with low-level stuff (e.g., process lifetime), and we may want to add
more low-level process-y stuff (which shouldn't be delegated) to it in
the future.
R=jamesr@chromium.org
Review URL: https://codereview.chromium.org/1435153003 .
diff --git a/shell/application_manager/shell_impl.cc b/shell/application_manager/shell_impl.cc
index f75c028..4d0532e 100644
--- a/shell/application_manager/shell_impl.cc
+++ b/shell/application_manager/shell_impl.cc
@@ -21,7 +21,8 @@
identity_(identity),
on_application_end_(on_application_end),
application_(application.Pass()),
- binding_(this) {
+ binding_(this),
+ application_connector_impl_(this) {
binding_.set_connection_error_handler(
[this]() { manager_->OnShellImplError(this); });
}
@@ -45,7 +46,6 @@
requested_url.spec());
}
-// Shell implementation:
void ShellImpl::ConnectToApplication(
const mojo::String& app_url,
mojo::InterfaceRequest<ServiceProvider> services,
@@ -59,4 +59,11 @@
exposed_services.Pass(), base::Closure());
}
+void ShellImpl::CreateApplicationConnector(
+ mojo::InterfaceRequest<mojo::ApplicationConnector>
+ application_connector_request) {
+ application_connectors_.AddBinding(&application_connector_impl_,
+ application_connector_request.Pass());
+}
+
} // namespace shell