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

Unified Diff: shell/application_manager/shell_impl.h

Issue 1435153003: Add an ApplicationConnector interface, etc. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: grrr Created 5 years, 1 month 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
Index: shell/application_manager/shell_impl.h
diff --git a/shell/application_manager/shell_impl.h b/shell/application_manager/shell_impl.h
index 015572024fe49567a4fc52517be48e1d08528b6d..2fc4846c07fe361375bb9e96a59fcbe9b3b871d5 100644
--- a/shell/application_manager/shell_impl.h
+++ b/shell/application_manager/shell_impl.h
@@ -6,8 +6,11 @@
#define SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_
#include "base/callback.h"
+#include "base/macros.h"
+#include "mojo/common/binding_set.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/interfaces/application/application.mojom.h"
+#include "mojo/public/interfaces/application/application_connector.mojom.h"
#include "mojo/public/interfaces/application/shell.mojom.h"
#include "shell/application_manager/identity.h"
#include "url/gurl.h"
@@ -16,6 +19,11 @@ namespace shell {
class ApplicationManager;
+// TODO(vtl): This both implements the |Shell| interface and holds the
+// |ApplicationPtr| (from back when they were paired interfaces on the same
+// message pipe). The way it manages lifetime is dubious/wrong. We should have
+// an object holding stuff associated to an application, namely its "real"
+// |ShellImpl|, its |ApplicationPtr|, and tracking its |ApplicationConnector|s.
class ShellImpl : public mojo::Shell {
public:
ShellImpl(mojo::ApplicationPtr application,
@@ -37,11 +45,32 @@ class ShellImpl : public mojo::Shell {
base::Closure on_application_end() const { return on_application_end_; }
private:
+ class ApplicationConnectorImpl : public mojo::ApplicationConnector {
+ public:
+ explicit ApplicationConnectorImpl(mojo::Shell* shell) : shell_(shell) {}
+ ~ApplicationConnectorImpl() override {}
+
+ void ConnectToApplication(
+ const mojo::String& app_url,
+ mojo::InterfaceRequest<mojo::ServiceProvider> services,
+ mojo::ServiceProviderPtr exposed_services) override {
+ shell_->ConnectToApplication(app_url, services.Pass(),
+ exposed_services.Pass());
+ }
+
+ private:
+ mojo::Shell* const shell_;
+ DISALLOW_COPY_AND_ASSIGN(ApplicationConnectorImpl);
+ };
+
// mojo::Shell implementation:
void ConnectToApplication(
const mojo::String& app_url,
mojo::InterfaceRequest<mojo::ServiceProvider> services,
mojo::ServiceProviderPtr exposed_services) override;
+ void CreateApplicationConnector(
+ mojo::InterfaceRequest<mojo::ApplicationConnector>
+ application_connector_request) override;
ApplicationManager* const manager_;
const Identity identity_;
@@ -49,6 +78,9 @@ class ShellImpl : public mojo::Shell {
mojo::ApplicationPtr application_;
mojo::Binding<mojo::Shell> binding_;
+ ApplicationConnectorImpl application_connector_impl_;
+ mojo::BindingSet<mojo::ApplicationConnector> application_connectors_;
+
DISALLOW_COPY_AND_ASSIGN(ShellImpl);
};

Powered by Google App Engine
This is Rietveld 408576698