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 namespace mojo { | |
12 namespace shell { | 11 namespace shell { |
13 | 12 |
14 ShellImpl::ShellImpl(ApplicationPtr application, | 13 ShellImpl::ShellImpl(mojo::ApplicationPtr application, |
15 ApplicationManager* manager, | 14 ApplicationManager* manager, |
16 const Identity& identity, | 15 const Identity& identity, |
17 const base::Closure& on_application_end) | 16 const base::Closure& on_application_end) |
18 : manager_(manager), | 17 : manager_(manager), |
19 identity_(identity), | 18 identity_(identity), |
20 on_application_end_(on_application_end), | 19 on_application_end_(on_application_end), |
21 application_(application.Pass()), | 20 application_(application.Pass()), |
22 binding_(this) { | 21 binding_(this) { |
23 binding_.set_error_handler(this); | 22 binding_.set_error_handler(this); |
24 } | 23 } |
25 | 24 |
26 ShellImpl::~ShellImpl() { | 25 ShellImpl::~ShellImpl() { |
27 } | 26 } |
28 | 27 |
29 void ShellImpl::InitializeApplication(Array<String> args) { | 28 void ShellImpl::InitializeApplication(mojo::Array<mojo::String> args) { |
30 ShellPtr shell; | 29 mojo::ShellPtr shell; |
31 binding_.Bind(GetProxy(&shell)); | 30 binding_.Bind(mojo::GetProxy(&shell)); |
32 application_->Initialize(shell.Pass(), args.Pass(), identity_.url.spec()); | 31 application_->Initialize(shell.Pass(), args.Pass(), identity_.url.spec()); |
33 } | 32 } |
34 | 33 |
35 void ShellImpl::ConnectToClient(const GURL& requested_url, | 34 void ShellImpl::ConnectToClient( |
36 const GURL& requestor_url, | 35 const GURL& requested_url, |
37 InterfaceRequest<ServiceProvider> services, | 36 const GURL& requestor_url, |
38 ServiceProviderPtr exposed_services) { | 37 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
39 application_->AcceptConnection(String::From(requestor_url), services.Pass(), | 38 mojo::ServiceProviderPtr exposed_services) { |
40 exposed_services.Pass(), requested_url.spec()); | 39 application_->AcceptConnection(mojo::String::From(requestor_url), |
| 40 services.Pass(), exposed_services.Pass(), |
| 41 requested_url.spec()); |
41 } | 42 } |
42 | 43 |
43 // Shell implementation: | 44 // Shell implementation: |
44 void ShellImpl::ConnectToApplication(const String& app_url, | 45 void ShellImpl::ConnectToApplication( |
45 InterfaceRequest<ServiceProvider> services, | 46 const mojo::String& app_url, |
46 ServiceProviderPtr exposed_services) { | 47 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 48 mojo::ServiceProviderPtr exposed_services) { |
47 GURL app_gurl(app_url); | 49 GURL app_gurl(app_url); |
48 if (!app_gurl.is_valid()) { | 50 if (!app_gurl.is_valid()) { |
49 LOG(ERROR) << "Error: invalid URL: " << app_url; | 51 LOG(ERROR) << "Error: invalid URL: " << app_url; |
50 return; | 52 return; |
51 } | 53 } |
52 manager_->ConnectToApplication(app_gurl, identity_.url, services.Pass(), | 54 manager_->ConnectToApplication(app_gurl, identity_.url, services.Pass(), |
53 exposed_services.Pass(), base::Closure()); | 55 exposed_services.Pass(), base::Closure()); |
54 } | 56 } |
55 | 57 |
56 void ShellImpl::OnConnectionError() { | 58 void ShellImpl::OnConnectionError() { |
57 manager_->OnShellImplError(this); | 59 manager_->OnShellImplError(this); |
58 } | 60 } |
59 | 61 |
60 } // namespace shell | 62 } // namespace shell |
61 } // namespace mojo | |
OLD | NEW |