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 "shell/external_application_listener.h" | 5 #include "shell/external_application_listener.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 ~RegistrarImpl() override; | 43 ~RegistrarImpl() override; |
44 | 44 |
45 void OnConnectionError() override; | 45 void OnConnectionError() override; |
46 | 46 |
47 embedder::ChannelInit channel_init; | 47 embedder::ChannelInit channel_init; |
48 | 48 |
49 private: | 49 private: |
50 virtual void Register( | 50 virtual void Register( |
51 const String& app_url, | 51 const String& app_url, |
52 Array<String> args, | 52 Array<String> args, |
53 const mojo::Callback<void(ShellPtr)>& callback) override; | 53 const mojo::Callback<void(InterfaceRequest<Application>)>& callback) |
| 54 override; |
54 | 55 |
55 const RegisterCallback register_callback_; | 56 const RegisterCallback register_callback_; |
56 }; | 57 }; |
57 | 58 |
58 ExternalApplicationListener::ExternalApplicationListener( | 59 ExternalApplicationListener::ExternalApplicationListener( |
59 const scoped_refptr<base::SequencedTaskRunner>& shell_runner, | 60 const scoped_refptr<base::SequencedTaskRunner>& shell_runner, |
60 const scoped_refptr<base::SequencedTaskRunner>& io_runner) | 61 const scoped_refptr<base::SequencedTaskRunner>& io_runner) |
61 : shell_runner_(shell_runner), | 62 : shell_runner_(shell_runner), |
62 io_runner_(io_runner), | 63 io_runner_(io_runner), |
63 signal_on_listening_(true, false), | 64 signal_on_listening_(true, false), |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 ExternalApplicationListener::RegistrarImpl::~RegistrarImpl() { | 168 ExternalApplicationListener::RegistrarImpl::~RegistrarImpl() { |
168 } | 169 } |
169 | 170 |
170 void ExternalApplicationListener::RegistrarImpl::OnConnectionError() { | 171 void ExternalApplicationListener::RegistrarImpl::OnConnectionError() { |
171 channel_init.WillDestroySoon(); | 172 channel_init.WillDestroySoon(); |
172 } | 173 } |
173 | 174 |
174 void ExternalApplicationListener::RegistrarImpl::Register( | 175 void ExternalApplicationListener::RegistrarImpl::Register( |
175 const String& app_url, | 176 const String& app_url, |
176 Array<String> args, | 177 Array<String> args, |
177 const mojo::Callback<void(ShellPtr)>& callback) { | 178 const mojo::Callback<void(InterfaceRequest<Application>)>& callback) { |
178 MessagePipe pipe; | 179 ApplicationPtr application; |
| 180 InterfaceRequest<Application> application_request = GetProxy(&application); |
179 register_callback_.Run(app_url.To<GURL>(), | 181 register_callback_.Run(app_url.To<GURL>(), |
180 args.To<std::vector<std::string>>(), | 182 args.To<std::vector<std::string>>(), |
181 pipe.handle0.Pass()); | 183 application.Pass()); |
182 callback.Run(MakeProxy<Shell>(pipe.handle1.Pass())); | 184 callback.Run(application_request.Pass()); |
183 } | 185 } |
184 | 186 |
185 } // namespace shell | 187 } // namespace shell |
186 } // namespace mojo | 188 } // namespace mojo |
OLD | NEW |