| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_ | 5 #ifndef SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_ |
| 6 #define SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_ | 6 #define SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "mojo/common/binding_set.h" | 10 #include "mojo/common/binding_set.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 public: | 28 public: |
| 29 ShellImpl(mojo::ApplicationPtr application, | 29 ShellImpl(mojo::ApplicationPtr application, |
| 30 ApplicationManager* manager, | 30 ApplicationManager* manager, |
| 31 const Identity& resolved_identity, | 31 const Identity& resolved_identity, |
| 32 const base::Closure& on_application_end); | 32 const base::Closure& on_application_end); |
| 33 | 33 |
| 34 ~ShellImpl() override; | 34 ~ShellImpl() override; |
| 35 | 35 |
| 36 void InitializeApplication(mojo::Array<mojo::String> args); | 36 void InitializeApplication(mojo::Array<mojo::String> args); |
| 37 | 37 |
| 38 void ConnectToClient(const GURL& requested_url, | 38 void ConnectToClient( |
| 39 const GURL& requestor_url, | 39 const GURL& requested_url, |
| 40 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 40 const GURL& requestor_url, |
| 41 mojo::ServiceProviderPtr exposed_services); | 41 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 42 mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services); |
| 42 | 43 |
| 43 mojo::Application* application() { return application_.get(); } | 44 mojo::Application* application() { return application_.get(); } |
| 44 const Identity& identity() const { return identity_; } | 45 const Identity& identity() const { return identity_; } |
| 45 base::Closure on_application_end() const { return on_application_end_; } | 46 base::Closure on_application_end() const { return on_application_end_; } |
| 46 | 47 |
| 47 private: | 48 private: |
| 48 // This is a per-|ShellImpl| singleton. | 49 // This is a per-|ShellImpl| singleton. |
| 49 class ApplicationConnectorImpl : public mojo::ApplicationConnector { | 50 class ApplicationConnectorImpl : public mojo::ApplicationConnector { |
| 50 public: | 51 public: |
| 51 explicit ApplicationConnectorImpl(mojo::Shell* shell); | 52 explicit ApplicationConnectorImpl(mojo::Shell* shell); |
| 52 ~ApplicationConnectorImpl() override; | 53 ~ApplicationConnectorImpl() override; |
| 53 | 54 |
| 54 void ConnectToApplication( | 55 void ConnectToApplication( |
| 55 const mojo::String& app_url, | 56 const mojo::String& app_url, |
| 56 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 57 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 57 mojo::ServiceProviderPtr exposed_services) override; | 58 mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) override; |
| 58 void Duplicate(mojo::InterfaceRequest<mojo::ApplicationConnector> | 59 void Duplicate(mojo::InterfaceRequest<mojo::ApplicationConnector> |
| 59 application_connector_request) override; | 60 application_connector_request) override; |
| 60 | 61 |
| 61 private: | 62 private: |
| 62 mojo::Shell* const shell_; | 63 mojo::Shell* const shell_; |
| 63 mojo::BindingSet<mojo::ApplicationConnector> bindings_; | 64 mojo::BindingSet<mojo::ApplicationConnector> bindings_; |
| 64 | 65 |
| 65 DISALLOW_COPY_AND_ASSIGN(ApplicationConnectorImpl); | 66 DISALLOW_COPY_AND_ASSIGN(ApplicationConnectorImpl); |
| 66 }; | 67 }; |
| 67 | 68 |
| 68 // mojo::Shell implementation: | 69 // mojo::Shell implementation: |
| 69 void ConnectToApplication( | 70 void ConnectToApplication( |
| 70 const mojo::String& app_url, | 71 const mojo::String& app_url, |
| 71 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 72 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 72 mojo::ServiceProviderPtr exposed_services) override; | 73 mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) override; |
| 73 void CreateApplicationConnector( | 74 void CreateApplicationConnector( |
| 74 mojo::InterfaceRequest<mojo::ApplicationConnector> | 75 mojo::InterfaceRequest<mojo::ApplicationConnector> |
| 75 application_connector_request) override; | 76 application_connector_request) override; |
| 76 | 77 |
| 77 ApplicationManager* const manager_; | 78 ApplicationManager* const manager_; |
| 78 const Identity identity_; | 79 const Identity identity_; |
| 79 base::Closure on_application_end_; | 80 base::Closure on_application_end_; |
| 80 mojo::ApplicationPtr application_; | 81 mojo::ApplicationPtr application_; |
| 81 mojo::Binding<mojo::Shell> binding_; | 82 mojo::Binding<mojo::Shell> binding_; |
| 82 | 83 |
| 83 ApplicationConnectorImpl application_connector_impl_; | 84 ApplicationConnectorImpl application_connector_impl_; |
| 84 | 85 |
| 85 DISALLOW_COPY_AND_ASSIGN(ShellImpl); | 86 DISALLOW_COPY_AND_ASSIGN(ShellImpl); |
| 86 }; | 87 }; |
| 87 | 88 |
| 88 } // namespace shell | 89 } // namespace shell |
| 89 | 90 |
| 90 #endif // SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_ | 91 #endif // SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_ |
| OLD | NEW |