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 #include "shell/application_manager/shell_impl.h" | 5 #include "shell/application_manager/shell_impl.h" |
6 | 6 |
7 #include "mojo/common/common_type_converters.h" | 7 #include "mojo/common/common_type_converters.h" |
8 #include "mojo/services/content_handler/public/interfaces/content_handler.mojom.
h" | 8 #include "mojo/services/content_handler/public/interfaces/content_handler.mojom.
h" |
9 #include "shell/application_manager/application_manager.h" | 9 #include "shell/application_manager/application_manager.h" |
10 | 10 |
11 using mojo::ServiceProvider; | 11 using mojo::ServiceProvider; |
12 using mojo::ServiceProviderPtr; | 12 using mojo::ServiceProviderPtr; |
13 | 13 |
14 namespace shell { | 14 namespace shell { |
15 | 15 |
16 ShellImpl::ShellImpl(mojo::ApplicationPtr application, | 16 ShellImpl::ShellImpl(mojo::ApplicationPtr application, |
17 ApplicationManager* manager, | 17 ApplicationManager* manager, |
18 const Identity& identity, | 18 const Identity& identity, |
19 const base::Closure& on_application_end) | 19 const base::Closure& on_application_end) |
20 : manager_(manager), | 20 : manager_(manager), |
21 identity_(identity), | 21 identity_(identity), |
22 on_application_end_(on_application_end), | 22 on_application_end_(on_application_end), |
23 application_(application.Pass()), | 23 application_(application.Pass()), |
24 binding_(this) { | 24 binding_(this) { |
25 binding_.set_error_handler(this); | 25 binding_.set_connection_error_handler( |
| 26 [this]() { manager_->OnShellImplError(this); }); |
26 } | 27 } |
27 | 28 |
28 ShellImpl::~ShellImpl() { | 29 ShellImpl::~ShellImpl() { |
29 } | 30 } |
30 | 31 |
31 void ShellImpl::InitializeApplication(mojo::Array<mojo::String> args) { | 32 void ShellImpl::InitializeApplication(mojo::Array<mojo::String> args) { |
32 mojo::ShellPtr shell; | 33 mojo::ShellPtr shell; |
33 binding_.Bind(mojo::GetProxy(&shell)); | 34 binding_.Bind(mojo::GetProxy(&shell)); |
34 application_->Initialize(shell.Pass(), args.Pass(), identity_.url.spec()); | 35 application_->Initialize(shell.Pass(), args.Pass(), identity_.url.spec()); |
35 } | 36 } |
(...skipping 15 matching lines...) Expand all Loading... |
51 ServiceProviderPtr exposed_services) { | 52 ServiceProviderPtr exposed_services) { |
52 GURL app_gurl(app_url); | 53 GURL app_gurl(app_url); |
53 if (!app_gurl.is_valid()) { | 54 if (!app_gurl.is_valid()) { |
54 LOG(ERROR) << "Error: invalid URL: " << app_url; | 55 LOG(ERROR) << "Error: invalid URL: " << app_url; |
55 return; | 56 return; |
56 } | 57 } |
57 manager_->ConnectToApplication(app_gurl, identity_.url, services.Pass(), | 58 manager_->ConnectToApplication(app_gurl, identity_.url, services.Pass(), |
58 exposed_services.Pass(), base::Closure()); | 59 exposed_services.Pass(), base::Closure()); |
59 } | 60 } |
60 | 61 |
61 void ShellImpl::OnConnectionError() { | |
62 manager_->OnShellImplError(this); | |
63 } | |
64 | |
65 } // namespace shell | 62 } // namespace shell |
OLD | NEW |