OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/public/cpp/application/application_impl.h" | 5 #include "mojo/public/cpp/application/application_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "mojo/public/cpp/application/application_delegate.h" | 9 #include "mojo/public/cpp/application/application_delegate.h" |
10 #include "mojo/public/cpp/application/lib/service_registry.h" | 10 #include "mojo/public/cpp/application/lib/service_registry.h" |
11 #include "mojo/public/cpp/bindings/interface_ptr.h" | 11 #include "mojo/public/cpp/bindings/interface_ptr.h" |
12 #include "mojo/public/cpp/bindings/interface_request.h" | 12 #include "mojo/public/cpp/bindings/interface_request.h" |
13 #include "mojo/public/cpp/environment/logging.h" | 13 #include "mojo/public/cpp/environment/logging.h" |
14 #include "mojo/public/cpp/system/message_pipe.h" | 14 #include "mojo/public/cpp/system/message_pipe.h" |
15 | 15 |
16 namespace mojo { | 16 namespace mojo { |
17 | 17 |
18 ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate, | 18 ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate, |
19 InterfaceRequest<Application> request) | 19 InterfaceRequest<Application> request) |
20 : delegate_(delegate), binding_(this, request.Pass()) {} | 20 : delegate_(delegate), binding_(this, request.Pass()) {} |
21 | 21 |
22 ApplicationImpl::~ApplicationImpl() {} | 22 ApplicationImpl::~ApplicationImpl() {} |
23 | 23 |
24 bool ApplicationImpl::HasArg(const std::string& arg) const { | 24 bool ApplicationImpl::HasArg(const std::string& arg) const { |
25 return std::find(args_.begin(), args_.end(), arg) != args_.end(); | 25 return std::find(args_.begin(), args_.end(), arg) != args_.end(); |
26 } | 26 } |
27 | 27 |
28 InterfacePtrInfo<ApplicationConnector> | 28 InterfaceHandle<ApplicationConnector> |
29 ApplicationImpl::CreateApplicationConnector() { | 29 ApplicationImpl::CreateApplicationConnector() { |
30 MOJO_CHECK(shell_); | 30 MOJO_CHECK(shell_); |
31 MessagePipe pipe; | 31 MessagePipe pipe; |
32 shell_->CreateApplicationConnector( | 32 shell_->CreateApplicationConnector( |
33 MakeRequest<ApplicationConnector>(pipe.handle1.Pass())); | 33 MakeRequest<ApplicationConnector>(pipe.handle1.Pass())); |
34 return InterfacePtrInfo<ApplicationConnector>(pipe.handle0.Pass(), 0u); | 34 return InterfaceHandle<ApplicationConnector>(pipe.handle0.Pass(), 0u); |
35 } | 35 } |
36 | 36 |
37 ApplicationConnection* ApplicationImpl::ConnectToApplication( | 37 ApplicationConnection* ApplicationImpl::ConnectToApplication( |
38 const String& application_url) { | 38 const String& application_url) { |
39 MOJO_CHECK(shell_); | 39 MOJO_CHECK(shell_); |
40 ServiceProviderPtr local_services; | 40 ServiceProviderPtr local_services; |
41 InterfaceRequest<ServiceProvider> local_request = GetProxy(&local_services); | 41 InterfaceRequest<ServiceProvider> local_request = GetProxy(&local_services); |
42 ServiceProviderPtr remote_services; | 42 ServiceProviderPtr remote_services; |
43 shell_->ConnectToApplication(application_url, GetProxy(&remote_services), | 43 shell_->ConnectToApplication(application_url, GetProxy(&remote_services), |
44 local_services.Pass()); | 44 local_services.Pass()); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 return; | 88 return; |
89 incoming_service_registries_.push_back(std::move(registry)); | 89 incoming_service_registries_.push_back(std::move(registry)); |
90 } | 90 } |
91 | 91 |
92 void ApplicationImpl::RequestQuit() { | 92 void ApplicationImpl::RequestQuit() { |
93 delegate_->Quit(); | 93 delegate_->Quit(); |
94 Terminate(); | 94 Terminate(); |
95 } | 95 } |
96 | 96 |
97 } // namespace mojo | 97 } // namespace mojo |
OLD | NEW |