| 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 "mojo/public/cpp/bindings/binding.h" | 9 #include "mojo/public/cpp/bindings/binding.h" |
| 10 #include "mojo/public/cpp/bindings/error_handler.h" | 10 #include "mojo/public/cpp/bindings/error_handler.h" |
| 11 #include "mojo/public/interfaces/application/application.mojom.h" | 11 #include "mojo/public/interfaces/application/application.mojom.h" |
| 12 #include "mojo/public/interfaces/application/shell.mojom.h" | 12 #include "mojo/public/interfaces/application/shell.mojom.h" |
| 13 #include "shell/application_manager/identity.h" | 13 #include "shell/application_manager/identity.h" |
| 14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 15 | 15 |
| 16 namespace shell { | 16 namespace shell { |
| 17 | 17 |
| 18 class ApplicationManager; | 18 class ApplicationManager; |
| 19 | 19 |
| 20 class ShellImpl : public mojo::Shell, public mojo::ErrorHandler { | 20 class ShellImpl : public mojo::Shell { |
| 21 public: | 21 public: |
| 22 ShellImpl(mojo::ApplicationPtr application, | 22 ShellImpl(mojo::ApplicationPtr application, |
| 23 ApplicationManager* manager, | 23 ApplicationManager* manager, |
| 24 const Identity& resolved_identity, | 24 const Identity& resolved_identity, |
| 25 const base::Closure& on_application_end); | 25 const base::Closure& on_application_end); |
| 26 | 26 |
| 27 ~ShellImpl() override; | 27 ~ShellImpl() override; |
| 28 | 28 |
| 29 void InitializeApplication(mojo::Array<mojo::String> args); | 29 void InitializeApplication(mojo::Array<mojo::String> args); |
| 30 | 30 |
| 31 void ConnectToClient(const GURL& requested_url, | 31 void ConnectToClient(const GURL& requested_url, |
| 32 const GURL& requestor_url, | 32 const GURL& requestor_url, |
| 33 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 33 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 34 mojo::ServiceProviderPtr exposed_services); | 34 mojo::ServiceProviderPtr exposed_services); |
| 35 | 35 |
| 36 mojo::Application* application() { return application_.get(); } | 36 mojo::Application* application() { return application_.get(); } |
| 37 const Identity& identity() const { return identity_; } | 37 const Identity& identity() const { return identity_; } |
| 38 base::Closure on_application_end() const { return on_application_end_; } | 38 base::Closure on_application_end() const { return on_application_end_; } |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 // mojo::Shell implementation: | 41 // mojo::Shell implementation: |
| 42 void ConnectToApplication( | 42 void ConnectToApplication( |
| 43 const mojo::String& app_url, | 43 const mojo::String& app_url, |
| 44 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 44 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 45 mojo::ServiceProviderPtr exposed_services) override; | 45 mojo::ServiceProviderPtr exposed_services) override; |
| 46 | 46 |
| 47 // mojo::ErrorHandler implementation: | |
| 48 void OnConnectionError() override; | |
| 49 | |
| 50 ApplicationManager* const manager_; | 47 ApplicationManager* const manager_; |
| 51 const Identity identity_; | 48 const Identity identity_; |
| 52 base::Closure on_application_end_; | 49 base::Closure on_application_end_; |
| 53 mojo::ApplicationPtr application_; | 50 mojo::ApplicationPtr application_; |
| 54 mojo::Binding<mojo::Shell> binding_; | 51 mojo::Binding<mojo::Shell> binding_; |
| 55 | 52 |
| 56 DISALLOW_COPY_AND_ASSIGN(ShellImpl); | 53 DISALLOW_COPY_AND_ASSIGN(ShellImpl); |
| 57 }; | 54 }; |
| 58 | 55 |
| 59 } // namespace shell | 56 } // namespace shell |
| 60 | 57 |
| 61 #endif // SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_ | 58 #endif // SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_ |
| OLD | NEW |