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/application_manager/application_manager.h" | 5 #include "shell/application_manager/application_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
14 #include "mojo/public/cpp/bindings/binding.h" | 14 #include "mojo/public/cpp/bindings/binding.h" |
15 #include "mojo/public/cpp/bindings/error_handler.h" | 15 #include "mojo/public/cpp/bindings/error_handler.h" |
16 #include "mojo/services/content_handler/public/interfaces/content_handler.mojom.
h" | 16 #include "mojo/services/content_handler/public/interfaces/content_handler.mojom.
h" |
17 #include "shell/application_manager/fetcher.h" | 17 #include "shell/application_manager/fetcher.h" |
18 #include "shell/application_manager/local_fetcher.h" | 18 #include "shell/application_manager/local_fetcher.h" |
19 #include "shell/application_manager/network_fetcher.h" | 19 #include "shell/application_manager/network_fetcher.h" |
20 #include "shell/application_manager/query_util.h" | 20 #include "shell/application_manager/query_util.h" |
21 #include "shell/application_manager/shell_impl.h" | 21 #include "shell/application_manager/shell_impl.h" |
22 #include "shell/switches.h" | 22 #include "shell/switches.h" |
23 | 23 |
24 namespace mojo { | |
25 namespace shell { | 24 namespace shell { |
26 | 25 |
27 namespace { | 26 namespace { |
28 | 27 |
29 // Used by TestAPI. | 28 // Used by TestAPI. |
30 bool has_created_instance = false; | 29 bool has_created_instance = false; |
31 | 30 |
32 std::vector<std::string> Concatenate(const std::vector<std::string>& v1, | 31 std::vector<std::string> Concatenate(const std::vector<std::string>& v1, |
33 const std::vector<std::string>& v2) { | 32 const std::vector<std::string>& v2) { |
34 if (!v1.size()) | 33 if (!v1.size()) |
(...skipping 11 matching lines...) Expand all Loading... |
46 } | 45 } |
47 | 46 |
48 GURL ApplicationManager::Delegate::ResolveURL(const GURL& url) { | 47 GURL ApplicationManager::Delegate::ResolveURL(const GURL& url) { |
49 return url; | 48 return url; |
50 } | 49 } |
51 | 50 |
52 GURL ApplicationManager::Delegate::ResolveMappings(const GURL& url) { | 51 GURL ApplicationManager::Delegate::ResolveMappings(const GURL& url) { |
53 return url; | 52 return url; |
54 } | 53 } |
55 | 54 |
56 class ApplicationManager::ContentHandlerConnection : public ErrorHandler { | 55 class ApplicationManager::ContentHandlerConnection : public mojo::ErrorHandler { |
57 public: | 56 public: |
58 ContentHandlerConnection(ApplicationManager* manager, | 57 ContentHandlerConnection(ApplicationManager* manager, |
59 const GURL& content_handler_url) | 58 const GURL& content_handler_url) |
60 : manager_(manager), content_handler_url_(content_handler_url) { | 59 : manager_(manager), content_handler_url_(content_handler_url) { |
61 ServiceProviderPtr services; | 60 mojo::ServiceProviderPtr services; |
62 manager->ConnectToApplication(content_handler_url, GURL(), | 61 manager->ConnectToApplication(content_handler_url, GURL(), |
63 GetProxy(&services), nullptr, | 62 mojo::GetProxy(&services), nullptr, |
64 base::Closure()); | 63 base::Closure()); |
65 MessagePipe pipe; | 64 mojo::MessagePipe pipe; |
66 content_handler_.Bind(pipe.handle0.Pass()); | 65 content_handler_.Bind(pipe.handle0.Pass()); |
67 services->ConnectToService(ContentHandler::Name_, pipe.handle1.Pass()); | 66 services->ConnectToService(mojo::ContentHandler::Name_, |
| 67 pipe.handle1.Pass()); |
68 content_handler_.set_error_handler(this); | 68 content_handler_.set_error_handler(this); |
69 } | 69 } |
70 | 70 |
71 ContentHandler* content_handler() { return content_handler_.get(); } | 71 mojo::ContentHandler* content_handler() { return content_handler_.get(); } |
72 | 72 |
73 GURL content_handler_url() { return content_handler_url_; } | 73 GURL content_handler_url() { return content_handler_url_; } |
74 | 74 |
75 private: | 75 private: |
76 // ErrorHandler implementation: | 76 // mojo::ErrorHandler implementation: |
77 void OnConnectionError() override { manager_->OnContentHandlerError(this); } | 77 void OnConnectionError() override { manager_->OnContentHandlerError(this); } |
78 | 78 |
79 ApplicationManager* manager_; | 79 ApplicationManager* manager_; |
80 GURL content_handler_url_; | 80 GURL content_handler_url_; |
81 ContentHandlerPtr content_handler_; | 81 mojo::ContentHandlerPtr content_handler_; |
82 | 82 |
83 DISALLOW_COPY_AND_ASSIGN(ContentHandlerConnection); | 83 DISALLOW_COPY_AND_ASSIGN(ContentHandlerConnection); |
84 }; | 84 }; |
85 | 85 |
86 // static | 86 // static |
87 ApplicationManager::TestAPI::TestAPI(ApplicationManager* manager) | 87 ApplicationManager::TestAPI::TestAPI(ApplicationManager* manager) |
88 : manager_(manager) { | 88 : manager_(manager) { |
89 } | 89 } |
90 | 90 |
91 ApplicationManager::TestAPI::~TestAPI() { | 91 ApplicationManager::TestAPI::~TestAPI() { |
(...skipping 19 matching lines...) Expand all Loading... |
111 STLDeleteValues(&scheme_to_loader_); | 111 STLDeleteValues(&scheme_to_loader_); |
112 } | 112 } |
113 | 113 |
114 void ApplicationManager::TerminateShellConnections() { | 114 void ApplicationManager::TerminateShellConnections() { |
115 STLDeleteValues(&identity_to_shell_impl_); | 115 STLDeleteValues(&identity_to_shell_impl_); |
116 } | 116 } |
117 | 117 |
118 void ApplicationManager::ConnectToApplication( | 118 void ApplicationManager::ConnectToApplication( |
119 const GURL& requested_url, | 119 const GURL& requested_url, |
120 const GURL& requestor_url, | 120 const GURL& requestor_url, |
121 InterfaceRequest<ServiceProvider> services, | 121 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
122 ServiceProviderPtr exposed_services, | 122 mojo::ServiceProviderPtr exposed_services, |
123 const base::Closure& on_application_end) { | 123 const base::Closure& on_application_end) { |
124 ConnectToApplicationWithParameters( | 124 ConnectToApplicationWithParameters( |
125 requested_url, requestor_url, services.Pass(), exposed_services.Pass(), | 125 requested_url, requestor_url, services.Pass(), exposed_services.Pass(), |
126 on_application_end, std::vector<std::string>()); | 126 on_application_end, std::vector<std::string>()); |
127 } | 127 } |
128 | 128 |
129 void ApplicationManager::ConnectToApplicationWithParameters( | 129 void ApplicationManager::ConnectToApplicationWithParameters( |
130 const GURL& requested_url, | 130 const GURL& requested_url, |
131 const GURL& requestor_url, | 131 const GURL& requestor_url, |
132 InterfaceRequest<ServiceProvider> services, | 132 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
133 ServiceProviderPtr exposed_services, | 133 mojo::ServiceProviderPtr exposed_services, |
134 const base::Closure& on_application_end, | 134 const base::Closure& on_application_end, |
135 const std::vector<std::string>& pre_redirect_parameters) { | 135 const std::vector<std::string>& pre_redirect_parameters) { |
136 TRACE_EVENT_INSTANT1( | 136 TRACE_EVENT_INSTANT1( |
137 "mojo_shell", "ApplicationManager::ConnectToApplicationWithParameters", | 137 "mojo_shell", "ApplicationManager::ConnectToApplicationWithParameters", |
138 TRACE_EVENT_SCOPE_THREAD, "requested_url", requested_url.spec()); | 138 TRACE_EVENT_SCOPE_THREAD, "requested_url", requested_url.spec()); |
139 DCHECK(requested_url.is_valid()); | 139 DCHECK(requested_url.is_valid()); |
140 | 140 |
141 // We check both the mapped and resolved urls for existing shell_impls because | 141 // We check both the mapped and resolved urls for existing shell_impls because |
142 // external applications can be registered for the unresolved mojo:foo urls. | 142 // external applications can be registered for the unresolved mojo:foo urls. |
143 | 143 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 ? NativeApplicationCleanup::DONT_DELETE | 197 ? NativeApplicationCleanup::DONT_DELETE |
198 : NativeApplicationCleanup::DELETE; | 198 : NativeApplicationCleanup::DELETE; |
199 | 199 |
200 new NetworkFetcher(disable_cache_, resolved_url, network_service_.get(), | 200 new NetworkFetcher(disable_cache_, resolved_url, network_service_.get(), |
201 base::Bind(callback, cleanup)); | 201 base::Bind(callback, cleanup)); |
202 } | 202 } |
203 | 203 |
204 bool ApplicationManager::ConnectToRunningApplication( | 204 bool ApplicationManager::ConnectToRunningApplication( |
205 const GURL& resolved_url, | 205 const GURL& resolved_url, |
206 const GURL& requestor_url, | 206 const GURL& requestor_url, |
207 InterfaceRequest<ServiceProvider>* services, | 207 mojo::InterfaceRequest<mojo::ServiceProvider>* services, |
208 ServiceProviderPtr* exposed_services) { | 208 mojo::ServiceProviderPtr* exposed_services) { |
209 GURL application_url = GetBaseURLAndQuery(resolved_url, nullptr); | 209 GURL application_url = GetBaseURLAndQuery(resolved_url, nullptr); |
210 ShellImpl* shell_impl = GetShellImpl(application_url); | 210 ShellImpl* shell_impl = GetShellImpl(application_url); |
211 if (!shell_impl) | 211 if (!shell_impl) |
212 return false; | 212 return false; |
213 | 213 |
214 ConnectToClient(shell_impl, resolved_url, requestor_url, services->Pass(), | 214 ConnectToClient(shell_impl, resolved_url, requestor_url, services->Pass(), |
215 exposed_services->Pass()); | 215 exposed_services->Pass()); |
216 return true; | 216 return true; |
217 } | 217 } |
218 | 218 |
219 bool ApplicationManager::ConnectToApplicationWithLoader( | 219 bool ApplicationManager::ConnectToApplicationWithLoader( |
220 const GURL& resolved_url, | 220 const GURL& resolved_url, |
221 const GURL& requestor_url, | 221 const GURL& requestor_url, |
222 InterfaceRequest<ServiceProvider>* services, | 222 mojo::InterfaceRequest<mojo::ServiceProvider>* services, |
223 ServiceProviderPtr* exposed_services, | 223 mojo::ServiceProviderPtr* exposed_services, |
224 const base::Closure& on_application_end, | 224 const base::Closure& on_application_end, |
225 const std::vector<std::string>& parameters, | 225 const std::vector<std::string>& parameters, |
226 ApplicationLoader* loader) { | 226 ApplicationLoader* loader) { |
227 if (!loader) | 227 if (!loader) |
228 return false; | 228 return false; |
229 | 229 |
230 loader->Load( | 230 loader->Load( |
231 resolved_url, | 231 resolved_url, |
232 RegisterShell(resolved_url, requestor_url, services->Pass(), | 232 RegisterShell(resolved_url, requestor_url, services->Pass(), |
233 exposed_services->Pass(), on_application_end, parameters)); | 233 exposed_services->Pass(), on_application_end, parameters)); |
234 return true; | 234 return true; |
235 } | 235 } |
236 | 236 |
237 InterfaceRequest<Application> ApplicationManager::RegisterShell( | 237 mojo::InterfaceRequest<mojo::Application> ApplicationManager::RegisterShell( |
238 const GURL& resolved_url, | 238 const GURL& resolved_url, |
239 const GURL& requestor_url, | 239 const GURL& requestor_url, |
240 InterfaceRequest<ServiceProvider> services, | 240 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
241 ServiceProviderPtr exposed_services, | 241 mojo::ServiceProviderPtr exposed_services, |
242 const base::Closure& on_application_end, | 242 const base::Closure& on_application_end, |
243 const std::vector<std::string>& parameters) { | 243 const std::vector<std::string>& parameters) { |
244 Identity app_identity(resolved_url); | 244 Identity app_identity(resolved_url); |
245 | 245 |
246 ApplicationPtr application; | 246 mojo::ApplicationPtr application; |
247 InterfaceRequest<Application> application_request = GetProxy(&application); | 247 mojo::InterfaceRequest<mojo::Application> application_request = |
| 248 mojo::GetProxy(&application); |
248 ShellImpl* shell = | 249 ShellImpl* shell = |
249 new ShellImpl(application.Pass(), this, app_identity, on_application_end); | 250 new ShellImpl(application.Pass(), this, app_identity, on_application_end); |
250 identity_to_shell_impl_[app_identity] = shell; | 251 identity_to_shell_impl_[app_identity] = shell; |
251 shell->InitializeApplication(Array<String>::From(parameters)); | 252 shell->InitializeApplication(mojo::Array<mojo::String>::From(parameters)); |
252 ConnectToClient(shell, resolved_url, requestor_url, services.Pass(), | 253 ConnectToClient(shell, resolved_url, requestor_url, services.Pass(), |
253 exposed_services.Pass()); | 254 exposed_services.Pass()); |
254 return application_request.Pass(); | 255 return application_request.Pass(); |
255 } | 256 } |
256 | 257 |
257 ShellImpl* ApplicationManager::GetShellImpl(const GURL& url) { | 258 ShellImpl* ApplicationManager::GetShellImpl(const GURL& url) { |
258 const auto& shell_it = identity_to_shell_impl_.find(Identity(url)); | 259 const auto& shell_it = identity_to_shell_impl_.find(Identity(url)); |
259 if (shell_it != identity_to_shell_impl_.end()) | 260 if (shell_it != identity_to_shell_impl_.end()) |
260 return shell_it->second; | 261 return shell_it->second; |
261 return nullptr; | 262 return nullptr; |
262 } | 263 } |
263 | 264 |
264 void ApplicationManager::ConnectToClient( | 265 void ApplicationManager::ConnectToClient( |
265 ShellImpl* shell_impl, | 266 ShellImpl* shell_impl, |
266 const GURL& resolved_url, | 267 const GURL& resolved_url, |
267 const GURL& requestor_url, | 268 const GURL& requestor_url, |
268 InterfaceRequest<ServiceProvider> services, | 269 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
269 ServiceProviderPtr exposed_services) { | 270 mojo::ServiceProviderPtr exposed_services) { |
270 shell_impl->ConnectToClient(resolved_url, requestor_url, services.Pass(), | 271 shell_impl->ConnectToClient(resolved_url, requestor_url, services.Pass(), |
271 exposed_services.Pass()); | 272 exposed_services.Pass()); |
272 } | 273 } |
273 | 274 |
274 void ApplicationManager::HandleFetchCallback( | 275 void ApplicationManager::HandleFetchCallback( |
275 const GURL& requestor_url, | 276 const GURL& requestor_url, |
276 InterfaceRequest<ServiceProvider> services, | 277 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
277 ServiceProviderPtr exposed_services, | 278 mojo::ServiceProviderPtr exposed_services, |
278 const base::Closure& on_application_end, | 279 const base::Closure& on_application_end, |
279 const std::vector<std::string>& parameters, | 280 const std::vector<std::string>& parameters, |
280 NativeApplicationCleanup cleanup, | 281 NativeApplicationCleanup cleanup, |
281 scoped_ptr<Fetcher> fetcher) { | 282 scoped_ptr<Fetcher> fetcher) { |
282 if (!fetcher) { | 283 if (!fetcher) { |
283 // Network error. Drop |application_request| to tell requestor. | 284 // Network error. Drop |application_request| to tell requestor. |
284 return; | 285 return; |
285 } | 286 } |
286 | 287 |
287 GURL redirect_url = fetcher->GetRedirectURL(); | 288 GURL redirect_url = fetcher->GetRedirectURL(); |
288 if (!redirect_url.is_empty()) { | 289 if (!redirect_url.is_empty()) { |
289 // And around we go again... Whee! | 290 // And around we go again... Whee! |
290 ConnectToApplicationWithParameters(redirect_url, requestor_url, | 291 ConnectToApplicationWithParameters(redirect_url, requestor_url, |
291 services.Pass(), exposed_services.Pass(), | 292 services.Pass(), exposed_services.Pass(), |
292 on_application_end, parameters); | 293 on_application_end, parameters); |
293 return; | 294 return; |
294 } | 295 } |
295 | 296 |
296 // We already checked if the application was running before we fetched it, but | 297 // We already checked if the application was running before we fetched it, but |
297 // it might have started while the fetch was outstanding. We don't want to | 298 // it might have started while the fetch was outstanding. We don't want to |
298 // have two copies of the app running, so check again. | 299 // have two copies of the app running, so check again. |
299 // | 300 // |
300 // Also, it's possible the original URL was redirected to an app that is | 301 // Also, it's possible the original URL was redirected to an app that is |
301 // already running. | 302 // already running. |
302 if (ConnectToRunningApplication(fetcher->GetURL(), requestor_url, &services, | 303 if (ConnectToRunningApplication(fetcher->GetURL(), requestor_url, &services, |
303 &exposed_services)) { | 304 &exposed_services)) { |
304 return; | 305 return; |
305 } | 306 } |
306 | 307 |
307 InterfaceRequest<Application> request( | 308 mojo::InterfaceRequest<mojo::Application> request( |
308 RegisterShell(fetcher->GetURL(), requestor_url, services.Pass(), | 309 RegisterShell(fetcher->GetURL(), requestor_url, services.Pass(), |
309 exposed_services.Pass(), on_application_end, parameters)); | 310 exposed_services.Pass(), on_application_end, parameters)); |
310 | 311 |
311 // If the response begins with a #!mojo <content-handler-url>, use it. | 312 // If the response begins with a #!mojo <content-handler-url>, use it. |
312 GURL content_handler_url; | 313 GURL content_handler_url; |
313 std::string shebang; | 314 std::string shebang; |
314 if (fetcher->PeekContentHandler(&shebang, &content_handler_url)) { | 315 if (fetcher->PeekContentHandler(&shebang, &content_handler_url)) { |
315 LoadWithContentHandler( | 316 LoadWithContentHandler( |
316 content_handler_url, request.Pass(), | 317 content_handler_url, request.Pass(), |
317 fetcher->AsURLResponse(blocking_pool_, | 318 fetcher->AsURLResponse(blocking_pool_, |
(...skipping 24 matching lines...) Expand all Loading... |
342 } | 343 } |
343 | 344 |
344 fetcher->AsPath( | 345 fetcher->AsPath( |
345 blocking_pool_, | 346 blocking_pool_, |
346 base::Bind(&ApplicationManager::RunNativeApplication, | 347 base::Bind(&ApplicationManager::RunNativeApplication, |
347 weak_ptr_factory_.GetWeakPtr(), base::Passed(request.Pass()), | 348 weak_ptr_factory_.GetWeakPtr(), base::Passed(request.Pass()), |
348 options, cleanup, base::Passed(fetcher.Pass()))); | 349 options, cleanup, base::Passed(fetcher.Pass()))); |
349 } | 350 } |
350 | 351 |
351 void ApplicationManager::RunNativeApplication( | 352 void ApplicationManager::RunNativeApplication( |
352 InterfaceRequest<Application> application_request, | 353 mojo::InterfaceRequest<mojo::Application> application_request, |
353 const NativeRunnerFactory::Options& options, | 354 const NativeRunnerFactory::Options& options, |
354 NativeApplicationCleanup cleanup, | 355 NativeApplicationCleanup cleanup, |
355 scoped_ptr<Fetcher> fetcher, | 356 scoped_ptr<Fetcher> fetcher, |
356 const base::FilePath& path, | 357 const base::FilePath& path, |
357 bool path_exists) { | 358 bool path_exists) { |
358 // We only passed fetcher to keep it alive. Done with it now. | 359 // We only passed fetcher to keep it alive. Done with it now. |
359 fetcher.reset(); | 360 fetcher.reset(); |
360 | 361 |
361 DCHECK(application_request.is_pending()); | 362 DCHECK(application_request.is_pending()); |
362 | 363 |
(...skipping 15 matching lines...) Expand all Loading... |
378 void ApplicationManager::RegisterContentHandler( | 379 void ApplicationManager::RegisterContentHandler( |
379 const std::string& mime_type, | 380 const std::string& mime_type, |
380 const GURL& content_handler_url) { | 381 const GURL& content_handler_url) { |
381 DCHECK(content_handler_url.is_valid()) | 382 DCHECK(content_handler_url.is_valid()) |
382 << "Content handler URL is invalid for mime type " << mime_type; | 383 << "Content handler URL is invalid for mime type " << mime_type; |
383 mime_type_to_url_[mime_type] = content_handler_url; | 384 mime_type_to_url_[mime_type] = content_handler_url; |
384 } | 385 } |
385 | 386 |
386 void ApplicationManager::LoadWithContentHandler( | 387 void ApplicationManager::LoadWithContentHandler( |
387 const GURL& content_handler_url, | 388 const GURL& content_handler_url, |
388 InterfaceRequest<Application> application_request, | 389 mojo::InterfaceRequest<mojo::Application> application_request, |
389 URLResponsePtr url_response) { | 390 mojo::URLResponsePtr url_response) { |
390 ContentHandlerConnection* connection = nullptr; | 391 ContentHandlerConnection* connection = nullptr; |
391 URLToContentHandlerMap::iterator iter = | 392 URLToContentHandlerMap::iterator iter = |
392 url_to_content_handler_.find(content_handler_url); | 393 url_to_content_handler_.find(content_handler_url); |
393 if (iter != url_to_content_handler_.end()) { | 394 if (iter != url_to_content_handler_.end()) { |
394 connection = iter->second; | 395 connection = iter->second; |
395 } else { | 396 } else { |
396 connection = new ContentHandlerConnection(this, content_handler_url); | 397 connection = new ContentHandlerConnection(this, content_handler_url); |
397 url_to_content_handler_[content_handler_url] = connection; | 398 url_to_content_handler_[content_handler_url] = connection; |
398 } | 399 } |
399 | 400 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 void ApplicationManager::OnContentHandlerError( | 474 void ApplicationManager::OnContentHandlerError( |
474 ContentHandlerConnection* content_handler) { | 475 ContentHandlerConnection* content_handler) { |
475 // Remove the mapping to the content handler. | 476 // Remove the mapping to the content handler. |
476 auto it = | 477 auto it = |
477 url_to_content_handler_.find(content_handler->content_handler_url()); | 478 url_to_content_handler_.find(content_handler->content_handler_url()); |
478 DCHECK(it != url_to_content_handler_.end()); | 479 DCHECK(it != url_to_content_handler_.end()); |
479 delete it->second; | 480 delete it->second; |
480 url_to_content_handler_.erase(it); | 481 url_to_content_handler_.erase(it); |
481 } | 482 } |
482 | 483 |
483 ScopedMessagePipeHandle ApplicationManager::ConnectToServiceByName( | 484 mojo::ScopedMessagePipeHandle ApplicationManager::ConnectToServiceByName( |
484 const GURL& application_url, | 485 const GURL& application_url, |
485 const std::string& interface_name) { | 486 const std::string& interface_name) { |
486 ServiceProviderPtr services; | 487 mojo::ServiceProviderPtr services; |
487 ConnectToApplication(application_url, GURL(), GetProxy(&services), nullptr, | 488 ConnectToApplication(application_url, GURL(), mojo::GetProxy(&services), |
488 base::Closure()); | 489 nullptr, base::Closure()); |
489 MessagePipe pipe; | 490 mojo::MessagePipe pipe; |
490 services->ConnectToService(interface_name, pipe.handle1.Pass()); | 491 services->ConnectToService(interface_name, pipe.handle1.Pass()); |
491 return pipe.handle0.Pass(); | 492 return pipe.handle0.Pass(); |
492 } | 493 } |
493 | 494 |
494 std::vector<std::string> ApplicationManager::GetArgsForURL(const GURL& url) { | 495 std::vector<std::string> ApplicationManager::GetArgsForURL(const GURL& url) { |
495 const auto& args_it = url_to_args_.find(url); | 496 const auto& args_it = url_to_args_.find(url); |
496 if (args_it != url_to_args_.end()) | 497 if (args_it != url_to_args_.end()) |
497 return args_it->second; | 498 return args_it->second; |
498 return std::vector<std::string>(); | 499 return std::vector<std::string>(); |
499 } | 500 } |
500 | 501 |
501 void ApplicationManager::CleanupRunner(NativeRunner* runner) { | 502 void ApplicationManager::CleanupRunner(NativeRunner* runner) { |
502 native_runners_.erase( | 503 native_runners_.erase( |
503 std::find(native_runners_.begin(), native_runners_.end(), runner)); | 504 std::find(native_runners_.begin(), native_runners_.end(), runner)); |
504 } | 505 } |
505 | 506 |
506 } // namespace shell | 507 } // namespace shell |
507 } // namespace mojo | |
OLD | NEW |