| 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/application_manager/application_manager.h" | 5 #include "mojo/application_manager/application_manager.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 requestor_url, | 216 requestor_url, |
| 217 interceptor_->OnConnectToClient(url, service_provider.Pass())); | 217 interceptor_->OnConnectToClient(url, service_provider.Pass())); |
| 218 } else { | 218 } else { |
| 219 shell_impl->ConnectToClient(requestor_url, service_provider.Pass()); | 219 shell_impl->ConnectToClient(requestor_url, service_provider.Pass()); |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 | 222 |
| 223 void ApplicationManager::RegisterExternalApplication( | 223 void ApplicationManager::RegisterExternalApplication( |
| 224 const GURL& url, | 224 const GURL& url, |
| 225 ScopedMessagePipeHandle shell_handle) { | 225 ScopedMessagePipeHandle shell_handle) { |
| 226 url_to_shell_impl_[url] = | 226 ShellImpl* shell_impl = |
| 227 WeakBindToPipe(new ShellImpl(this, url), shell_handle.Pass()); | 227 WeakBindToPipe(new ShellImpl(this, url), shell_handle.Pass()); |
| 228 url_to_shell_impl_[url] = shell_impl; |
| 229 URLToArgsMap::const_iterator args_it = url_to_args_.find(url); |
| 230 Array<String> args; |
| 231 if (args_it != url_to_args_.end()) |
| 232 args = Array<String>::From(args_it->second); |
| 233 shell_impl->client()->Initialize(args.Pass()); |
| 228 } | 234 } |
| 229 | 235 |
| 230 void ApplicationManager::RegisterLoadedApplication( | 236 void ApplicationManager::RegisterLoadedApplication( |
| 231 const GURL& url, | 237 const GURL& url, |
| 232 const GURL& requestor_url, | 238 const GURL& requestor_url, |
| 233 ServiceProviderPtr service_provider, | 239 ServiceProviderPtr service_provider, |
| 234 ScopedMessagePipeHandle* shell_handle) { | 240 ScopedMessagePipeHandle* shell_handle) { |
| 235 ShellImpl* shell_impl = NULL; | 241 ShellImpl* shell_impl = NULL; |
| 236 URLToShellImplMap::iterator iter = url_to_shell_impl_.find(url); | 242 URLToShellImplMap::iterator iter = url_to_shell_impl_.find(url); |
| 237 if (iter != url_to_shell_impl_.end()) { | 243 if (iter != url_to_shell_impl_.end()) { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 return pipe.handle0.Pass(); | 365 return pipe.handle0.Pass(); |
| 360 } | 366 } |
| 361 | 367 |
| 362 Array<String> ApplicationManager::GetArgsForURL(const GURL& url) { | 368 Array<String> ApplicationManager::GetArgsForURL(const GURL& url) { |
| 363 URLToArgsMap::const_iterator args_it = url_to_args_.find(url); | 369 URLToArgsMap::const_iterator args_it = url_to_args_.find(url); |
| 364 if (args_it != url_to_args_.end()) | 370 if (args_it != url_to_args_.end()) |
| 365 return Array<String>::From(args_it->second); | 371 return Array<String>::From(args_it->second); |
| 366 return Array<String>(); | 372 return Array<String>(); |
| 367 } | 373 } |
| 368 } // namespace mojo | 374 } // namespace mojo |
| OLD | NEW |