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 18 matching lines...) Expand all Loading... |
29 public: | 29 public: |
30 ServiceProvider* GetRemoteServiceProvider() { return client(); } | 30 ServiceProvider* GetRemoteServiceProvider() { return client(); } |
31 | 31 |
32 private: | 32 private: |
33 void ConnectToService(const String& service_name, | 33 void ConnectToService(const String& service_name, |
34 ScopedMessagePipeHandle client_handle) override {} | 34 ScopedMessagePipeHandle client_handle) override {} |
35 }; | 35 }; |
36 | 36 |
37 } // namespace | 37 } // namespace |
38 | 38 |
39 ApplicationManager::Delegate::~Delegate() {} | 39 |
| 40 ApplicationManager::Delegate::~Delegate() { |
| 41 } |
| 42 |
| 43 void ApplicationManager::Delegate::OnApplicationError(const GURL& url) { |
| 44 LOG(ERROR) << "Communication error with application: " << url.spec(); |
| 45 } |
| 46 |
| 47 GURL ApplicationManager::Delegate::ResolveURL(const GURL& url) { |
| 48 return url; |
| 49 } |
| 50 |
40 | 51 |
41 class ApplicationManager::LoadCallbacksImpl | 52 class ApplicationManager::LoadCallbacksImpl |
42 : public ApplicationLoader::LoadCallbacks { | 53 : public ApplicationLoader::LoadCallbacks { |
43 public: | 54 public: |
44 LoadCallbacksImpl(base::WeakPtr<ApplicationManager> manager, | 55 LoadCallbacksImpl(base::WeakPtr<ApplicationManager> manager, |
45 const GURL& requested_url, | 56 const GURL& requested_url, |
| 57 const GURL& resolved_url, |
46 const GURL& requestor_url, | 58 const GURL& requestor_url, |
47 ServiceProviderPtr service_provider) | 59 ServiceProviderPtr service_provider) |
48 : manager_(manager), | 60 : manager_(manager), |
49 requested_url_(requested_url), | 61 requested_url_(requested_url), |
| 62 resolved_url_(resolved_url), |
50 requestor_url_(requestor_url), | 63 requestor_url_(requestor_url), |
51 service_provider_(service_provider.Pass()) {} | 64 service_provider_(service_provider.Pass()) {} |
52 | 65 |
53 private: | 66 private: |
54 ~LoadCallbacksImpl() override {} | 67 ~LoadCallbacksImpl() override {} |
55 | 68 |
56 // LoadCallbacks implementation | 69 // LoadCallbacks implementation |
57 ScopedMessagePipeHandle RegisterApplication() override { | 70 ScopedMessagePipeHandle RegisterApplication() override { |
58 ScopedMessagePipeHandle shell_handle; | 71 ScopedMessagePipeHandle shell_handle; |
59 if (manager_) { | 72 if (manager_) { |
60 manager_->RegisterLoadedApplication(requested_url_, | 73 manager_->RegisterLoadedApplication(requested_url_, |
| 74 resolved_url_, |
61 requestor_url_, | 75 requestor_url_, |
62 service_provider_.Pass(), | 76 service_provider_.Pass(), |
63 &shell_handle); | 77 &shell_handle); |
64 } | 78 } |
65 return shell_handle.Pass(); | 79 return shell_handle.Pass(); |
66 } | 80 } |
67 | 81 |
68 void LoadWithContentHandler(const GURL& content_handler_url, | 82 void LoadWithContentHandler(const GURL& content_handler_url, |
69 URLResponsePtr url_response) override { | 83 URLResponsePtr url_response) override { |
70 if (manager_) { | 84 if (manager_) { |
71 manager_->LoadWithContentHandler(requested_url_, | 85 manager_->LoadWithContentHandler(requested_url_, |
| 86 resolved_url_, |
72 requestor_url_, | 87 requestor_url_, |
73 content_handler_url, | 88 content_handler_url, |
74 url_response.Pass(), | 89 url_response.Pass(), |
75 service_provider_.Pass()); | 90 service_provider_.Pass()); |
76 } | 91 } |
77 } | 92 } |
78 | 93 |
79 base::WeakPtr<ApplicationManager> manager_; | 94 base::WeakPtr<ApplicationManager> manager_; |
80 GURL requested_url_; | 95 GURL requested_url_; |
| 96 GURL resolved_url_; |
81 GURL requestor_url_; | 97 GURL requestor_url_; |
82 ServiceProviderPtr service_provider_; | 98 ServiceProviderPtr service_provider_; |
83 }; | 99 }; |
84 | 100 |
85 class ApplicationManager::ShellImpl : public InterfaceImpl<Shell> { | 101 class ApplicationManager::ShellImpl : public InterfaceImpl<Shell> { |
86 public: | 102 public: |
87 ShellImpl(ApplicationManager* manager, const GURL& url) | 103 ShellImpl(ApplicationManager* manager, |
88 : manager_(manager), url_(url) {} | 104 const GURL& requested_url, |
| 105 const GURL& url) |
| 106 : manager_(manager), requested_url_(requested_url), url_(url) {} |
89 | 107 |
90 ~ShellImpl() override {} | 108 ~ShellImpl() override {} |
91 | 109 |
92 void ConnectToClient(const GURL& requestor_url, | 110 void ConnectToClient(const GURL& requestor_url, |
93 ServiceProviderPtr service_provider) { | 111 ServiceProviderPtr service_provider) { |
94 client()->AcceptConnection(String::From(requestor_url), | 112 client()->AcceptConnection(String::From(requestor_url), |
95 service_provider.Pass()); | 113 service_provider.Pass()); |
96 } | 114 } |
97 | 115 |
98 // ServiceProvider implementation: | 116 // ServiceProvider implementation: |
99 void ConnectToApplication( | 117 void ConnectToApplication( |
100 const String& app_url, | 118 const String& app_url, |
101 InterfaceRequest<ServiceProvider> in_service_provider) override { | 119 InterfaceRequest<ServiceProvider> in_service_provider) override { |
102 ServiceProviderPtr out_service_provider; | 120 ServiceProviderPtr out_service_provider; |
103 out_service_provider.Bind(in_service_provider.PassMessagePipe()); | 121 out_service_provider.Bind(in_service_provider.PassMessagePipe()); |
104 manager_->ConnectToApplication( | 122 manager_->ConnectToApplication( |
105 app_url.To<GURL>(), url_, out_service_provider.Pass()); | 123 app_url.To<GURL>(), url_, out_service_provider.Pass()); |
106 } | 124 } |
107 | 125 |
108 const GURL& url() const { return url_; } | 126 const GURL& url() const { return url_; } |
| 127 const GURL& requested_url() const { return requested_url_; } |
109 | 128 |
110 private: | 129 private: |
111 void OnConnectionError() override { manager_->OnShellImplError(this); } | 130 void OnConnectionError() override { manager_->OnShellImplError(this); } |
112 | 131 |
113 ApplicationManager* const manager_; | 132 ApplicationManager* const manager_; |
| 133 const GURL requested_url_; |
114 const GURL url_; | 134 const GURL url_; |
115 | 135 |
116 DISALLOW_COPY_AND_ASSIGN(ShellImpl); | 136 DISALLOW_COPY_AND_ASSIGN(ShellImpl); |
117 }; | 137 }; |
118 | 138 |
119 class ApplicationManager::ContentHandlerConnection : public ErrorHandler { | 139 class ApplicationManager::ContentHandlerConnection : public ErrorHandler { |
120 public: | 140 public: |
121 ContentHandlerConnection(ApplicationManager* manager, | 141 ContentHandlerConnection(ApplicationManager* manager, |
122 const GURL& content_handler_url) | 142 const GURL& content_handler_url) |
123 : manager_(manager), content_handler_url_(content_handler_url) { | 143 : manager_(manager), content_handler_url_(content_handler_url) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 175 |
156 bool ApplicationManager::TestAPI::HasCreatedInstance() { | 176 bool ApplicationManager::TestAPI::HasCreatedInstance() { |
157 return has_created_instance; | 177 return has_created_instance; |
158 } | 178 } |
159 | 179 |
160 bool ApplicationManager::TestAPI::HasFactoryForURL(const GURL& url) const { | 180 bool ApplicationManager::TestAPI::HasFactoryForURL(const GURL& url) const { |
161 return manager_->url_to_shell_impl_.find(url) != | 181 return manager_->url_to_shell_impl_.find(url) != |
162 manager_->url_to_shell_impl_.end(); | 182 manager_->url_to_shell_impl_.end(); |
163 } | 183 } |
164 | 184 |
165 ApplicationManager::ApplicationManager() | 185 ApplicationManager::ApplicationManager(Delegate* delegate) |
166 : delegate_(NULL), | 186 : delegate_(delegate), |
167 interceptor_(NULL), | 187 interceptor_(NULL), |
168 weak_ptr_factory_(this) { | 188 weak_ptr_factory_(this) { |
169 } | 189 } |
170 | 190 |
171 ApplicationManager::~ApplicationManager() { | 191 ApplicationManager::~ApplicationManager() { |
172 STLDeleteValues(&url_to_content_handler_); | 192 STLDeleteValues(&url_to_content_handler_); |
173 TerminateShellConnections(); | 193 TerminateShellConnections(); |
174 STLDeleteValues(&url_to_loader_); | 194 STLDeleteValues(&url_to_loader_); |
175 STLDeleteValues(&scheme_to_loader_); | 195 STLDeleteValues(&scheme_to_loader_); |
176 } | 196 } |
177 | 197 |
178 void ApplicationManager::TerminateShellConnections() { | 198 void ApplicationManager::TerminateShellConnections() { |
179 STLDeleteValues(&url_to_shell_impl_); | 199 STLDeleteValues(&url_to_shell_impl_); |
180 STLDeleteElements(&content_shell_impls_); | 200 STLDeleteElements(&content_shell_impls_); |
181 } | 201 } |
182 | 202 |
183 // static | 203 void ApplicationManager::ConnectToApplication( |
184 ApplicationManager* ApplicationManager::GetInstance() { | 204 const GURL& requested_url, |
185 static base::LazyInstance<ApplicationManager> instance = | 205 const GURL& requestor_url, |
186 LAZY_INSTANCE_INITIALIZER; | 206 ServiceProviderPtr service_provider) { |
187 has_created_instance = true; | 207 ApplicationLoader* loader = GetLoaderForURL(requested_url, |
188 return &instance.Get(); | 208 DONT_INCLUDE_DEFAULT_LOADER); |
| 209 if (loader) { |
| 210 ConnectToApplicationImpl(requested_url, requested_url, requestor_url, |
| 211 service_provider.Pass(), loader); |
| 212 return; |
| 213 } |
| 214 |
| 215 GURL resolved_url = delegate_->ResolveURL(requested_url); |
| 216 loader = GetLoaderForURL(resolved_url, INCLUDE_DEFAULT_LOADER); |
| 217 if (loader) { |
| 218 ConnectToApplicationImpl(requested_url, resolved_url, requestor_url, |
| 219 service_provider.Pass(), loader); |
| 220 return; |
| 221 } |
| 222 |
| 223 LOG(WARNING) << "Could not find loader to load application: " |
| 224 << requested_url.spec(); |
189 } | 225 } |
190 | 226 |
191 void ApplicationManager::ConnectToApplication( | 227 void ApplicationManager::ConnectToApplicationImpl( |
192 const GURL& url, | 228 const GURL& requested_url, const GURL& resolved_url, |
193 const GURL& requestor_url, | 229 const GURL& requestor_url, ServiceProviderPtr service_provider, |
194 ServiceProviderPtr service_provider) { | 230 ApplicationLoader* loader) { |
195 URLToShellImplMap::const_iterator shell_it = url_to_shell_impl_.find(url); | 231 URLToShellImplMap::const_iterator shell_it = |
| 232 url_to_shell_impl_.find(resolved_url); |
196 if (shell_it != url_to_shell_impl_.end()) { | 233 if (shell_it != url_to_shell_impl_.end()) { |
197 ConnectToClient( | 234 ConnectToClient(shell_it->second, resolved_url, requestor_url, |
198 shell_it->second, url, requestor_url, service_provider.Pass()); | 235 service_provider.Pass()); |
199 return; | 236 return; |
200 } | 237 } |
201 | 238 |
202 scoped_refptr<LoadCallbacksImpl> callbacks( | 239 scoped_refptr<LoadCallbacksImpl> callbacks( |
203 new LoadCallbacksImpl(weak_ptr_factory_.GetWeakPtr(), | 240 new LoadCallbacksImpl(weak_ptr_factory_.GetWeakPtr(), |
204 url, | 241 requested_url, |
| 242 resolved_url, |
205 requestor_url, | 243 requestor_url, |
206 service_provider.Pass())); | 244 service_provider.Pass())); |
207 GetLoaderForURL(url)->Load(this, url, callbacks); | 245 loader->Load(this, resolved_url, callbacks); |
208 } | 246 } |
209 | 247 |
210 void ApplicationManager::ConnectToClient(ShellImpl* shell_impl, | 248 void ApplicationManager::ConnectToClient(ShellImpl* shell_impl, |
211 const GURL& url, | 249 const GURL& url, |
212 const GURL& requestor_url, | 250 const GURL& requestor_url, |
213 ServiceProviderPtr service_provider) { | 251 ServiceProviderPtr service_provider) { |
214 if (interceptor_) { | 252 if (interceptor_) { |
215 shell_impl->ConnectToClient( | 253 shell_impl->ConnectToClient( |
216 requestor_url, | 254 requestor_url, |
217 interceptor_->OnConnectToClient(url, service_provider.Pass())); | 255 interceptor_->OnConnectToClient(url, service_provider.Pass())); |
218 } else { | 256 } else { |
219 shell_impl->ConnectToClient(requestor_url, service_provider.Pass()); | 257 shell_impl->ConnectToClient(requestor_url, service_provider.Pass()); |
220 } | 258 } |
221 } | 259 } |
222 | 260 |
223 void ApplicationManager::RegisterExternalApplication( | 261 void ApplicationManager::RegisterExternalApplication( |
224 const GURL& url, | 262 const GURL& url, |
225 ScopedMessagePipeHandle shell_handle) { | 263 ScopedMessagePipeHandle shell_handle) { |
226 ShellImpl* shell_impl = | 264 url_to_shell_impl_[url] = |
227 WeakBindToPipe(new ShellImpl(this, url), shell_handle.Pass()); | 265 WeakBindToPipe(new ShellImpl(this, url, 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()); | |
234 } | 266 } |
235 | 267 |
236 void ApplicationManager::RegisterLoadedApplication( | 268 void ApplicationManager::RegisterLoadedApplication( |
237 const GURL& url, | 269 const GURL& requested_url, |
| 270 const GURL& resolved_url, |
238 const GURL& requestor_url, | 271 const GURL& requestor_url, |
239 ServiceProviderPtr service_provider, | 272 ServiceProviderPtr service_provider, |
240 ScopedMessagePipeHandle* shell_handle) { | 273 ScopedMessagePipeHandle* shell_handle) { |
241 ShellImpl* shell_impl = NULL; | 274 ShellImpl* shell_impl = NULL; |
242 URLToShellImplMap::iterator iter = url_to_shell_impl_.find(url); | 275 URLToShellImplMap::iterator iter = url_to_shell_impl_.find(resolved_url); |
243 if (iter != url_to_shell_impl_.end()) { | 276 if (iter != url_to_shell_impl_.end()) { |
244 // This can happen because services are loaded asynchronously. So if we get | 277 // This can happen because services are loaded asynchronously. So if we get |
245 // two requests for the same service close to each other, we might get here | 278 // two requests for the same service close to each other, we might get here |
246 // and find that we already have it. | 279 // and find that we already have it. |
247 shell_impl = iter->second; | 280 shell_impl = iter->second; |
248 } else { | 281 } else { |
249 MessagePipe pipe; | 282 MessagePipe pipe; |
250 shell_impl = WeakBindToPipe(new ShellImpl(this, url), pipe.handle1.Pass()); | 283 shell_impl = WeakBindToPipe( |
251 url_to_shell_impl_[url] = shell_impl; | 284 new ShellImpl(this, requested_url, resolved_url), pipe.handle1.Pass()); |
| 285 url_to_shell_impl_[resolved_url] = shell_impl; |
252 *shell_handle = pipe.handle0.Pass(); | 286 *shell_handle = pipe.handle0.Pass(); |
253 shell_impl->client()->Initialize(GetArgsForURL(url)); | 287 shell_impl->client()->Initialize(GetArgsForURL(requested_url)); |
254 } | 288 } |
255 | 289 |
256 ConnectToClient(shell_impl, url, requestor_url, service_provider.Pass()); | 290 ConnectToClient(shell_impl, resolved_url, requestor_url, |
| 291 service_provider.Pass()); |
257 } | 292 } |
258 | 293 |
259 void ApplicationManager::LoadWithContentHandler( | 294 void ApplicationManager::LoadWithContentHandler( |
260 const GURL& content_url, | 295 const GURL& requested_url, |
| 296 const GURL& resolved_url, |
261 const GURL& requestor_url, | 297 const GURL& requestor_url, |
262 const GURL& content_handler_url, | 298 const GURL& content_handler_url, |
263 URLResponsePtr url_response, | 299 URLResponsePtr url_response, |
264 ServiceProviderPtr service_provider) { | 300 ServiceProviderPtr service_provider) { |
265 ContentHandlerConnection* connection = NULL; | 301 ContentHandlerConnection* connection = NULL; |
266 URLToContentHandlerMap::iterator iter = | 302 URLToContentHandlerMap::iterator iter = |
267 url_to_content_handler_.find(content_handler_url); | 303 url_to_content_handler_.find(content_handler_url); |
268 if (iter != url_to_content_handler_.end()) { | 304 if (iter != url_to_content_handler_.end()) { |
269 connection = iter->second; | 305 connection = iter->second; |
270 } else { | 306 } else { |
271 connection = new ContentHandlerConnection(this, content_handler_url); | 307 connection = new ContentHandlerConnection(this, content_handler_url); |
272 url_to_content_handler_[content_handler_url] = connection; | 308 url_to_content_handler_[content_handler_url] = connection; |
273 } | 309 } |
274 | 310 |
275 ShellPtr shell_proxy; | 311 ShellPtr shell_proxy; |
276 ShellImpl* shell_impl = | 312 ShellImpl* shell_impl = WeakBindToProxy( |
277 WeakBindToProxy(new ShellImpl(this, content_url), &shell_proxy); | 313 new ShellImpl(this, requested_url, resolved_url), &shell_proxy); |
278 content_shell_impls_.insert(shell_impl); | 314 content_shell_impls_.insert(shell_impl); |
279 shell_impl->client()->Initialize(GetArgsForURL(content_url)); | 315 shell_impl->client()->Initialize(GetArgsForURL(requested_url)); |
280 | 316 |
281 connection->content_handler()->StartApplication(shell_proxy.Pass(), | 317 connection->content_handler()->StartApplication(shell_proxy.Pass(), |
282 url_response.Pass()); | 318 url_response.Pass()); |
283 ConnectToClient( | 319 ConnectToClient( |
284 shell_impl, content_url, requestor_url, service_provider.Pass()); | 320 shell_impl, resolved_url, requestor_url, service_provider.Pass()); |
285 } | 321 } |
286 | 322 |
287 void ApplicationManager::SetLoaderForURL(scoped_ptr<ApplicationLoader> loader, | 323 void ApplicationManager::SetLoaderForURL(scoped_ptr<ApplicationLoader> loader, |
288 const GURL& url) { | 324 const GURL& url) { |
289 URLToLoaderMap::iterator it = url_to_loader_.find(url); | 325 URLToLoaderMap::iterator it = url_to_loader_.find(url); |
290 if (it != url_to_loader_.end()) | 326 if (it != url_to_loader_.end()) |
291 delete it->second; | 327 delete it->second; |
292 url_to_loader_[url] = loader.release(); | 328 url_to_loader_[url] = loader.release(); |
293 } | 329 } |
294 | 330 |
295 void ApplicationManager::SetLoaderForScheme( | 331 void ApplicationManager::SetLoaderForScheme( |
296 scoped_ptr<ApplicationLoader> loader, | 332 scoped_ptr<ApplicationLoader> loader, |
297 const std::string& scheme) { | 333 const std::string& scheme) { |
298 SchemeToLoaderMap::iterator it = scheme_to_loader_.find(scheme); | 334 SchemeToLoaderMap::iterator it = scheme_to_loader_.find(scheme); |
299 if (it != scheme_to_loader_.end()) | 335 if (it != scheme_to_loader_.end()) |
300 delete it->second; | 336 delete it->second; |
301 scheme_to_loader_[scheme] = loader.release(); | 337 scheme_to_loader_[scheme] = loader.release(); |
302 } | 338 } |
303 | 339 |
304 void ApplicationManager::SetArgsForURL(const std::vector<std::string>& args, | 340 void ApplicationManager::SetArgsForURL(const std::vector<std::string>& args, |
305 const GURL& url) { | 341 const GURL& url) { |
306 url_to_args_[url] = args; | 342 url_to_args_[url] = args; |
307 } | 343 } |
308 | 344 |
309 void ApplicationManager::SetInterceptor(Interceptor* interceptor) { | 345 void ApplicationManager::SetInterceptor(Interceptor* interceptor) { |
310 interceptor_ = interceptor; | 346 interceptor_ = interceptor; |
311 } | 347 } |
312 | 348 |
313 ApplicationLoader* ApplicationManager::GetLoaderForURL(const GURL& url) { | 349 ApplicationLoader* ApplicationManager::GetLoaderForURL( |
314 URLToLoaderMap::const_iterator url_it = url_to_loader_.find(url); | 350 const GURL& url, IncludeDefaultLoader include_default_loader) { |
| 351 auto url_it = url_to_loader_.find(url); |
315 if (url_it != url_to_loader_.end()) | 352 if (url_it != url_to_loader_.end()) |
316 return url_it->second; | 353 return url_it->second; |
317 SchemeToLoaderMap::const_iterator scheme_it = | 354 auto scheme_it = scheme_to_loader_.find(url.scheme()); |
318 scheme_to_loader_.find(url.scheme()); | |
319 if (scheme_it != scheme_to_loader_.end()) | 355 if (scheme_it != scheme_to_loader_.end()) |
320 return scheme_it->second; | 356 return scheme_it->second; |
321 return default_loader_.get(); | 357 if (include_default_loader == INCLUDE_DEFAULT_LOADER) |
| 358 return default_loader_.get(); |
| 359 return NULL; |
322 } | 360 } |
323 | 361 |
324 void ApplicationManager::OnShellImplError(ShellImpl* shell_impl) { | 362 void ApplicationManager::OnShellImplError(ShellImpl* shell_impl) { |
325 // Called from ~ShellImpl, so we do not need to call Destroy here. | 363 // Called from ~ShellImpl, so we do not need to call Destroy here. |
326 auto content_shell_it = content_shell_impls_.find(shell_impl); | 364 auto content_shell_it = content_shell_impls_.find(shell_impl); |
327 if (content_shell_it != content_shell_impls_.end()) { | 365 if (content_shell_it != content_shell_impls_.end()) { |
328 delete (*content_shell_it); | 366 delete (*content_shell_it); |
329 content_shell_impls_.erase(content_shell_it); | 367 content_shell_impls_.erase(content_shell_it); |
330 return; | 368 return; |
331 } | 369 } |
332 const GURL url = shell_impl->url(); | 370 const GURL url = shell_impl->url(); |
| 371 const GURL requested_url = shell_impl->requested_url(); |
333 // Remove the shell. | 372 // Remove the shell. |
334 URLToShellImplMap::iterator it = url_to_shell_impl_.find(url); | 373 URLToShellImplMap::iterator it = url_to_shell_impl_.find(url); |
335 DCHECK(it != url_to_shell_impl_.end()); | 374 DCHECK(it != url_to_shell_impl_.end()); |
336 delete it->second; | 375 delete it->second; |
337 url_to_shell_impl_.erase(it); | 376 url_to_shell_impl_.erase(it); |
338 ApplicationLoader* loader = GetLoaderForURL(url); | 377 ApplicationLoader* loader = GetLoaderForURL(requested_url, |
| 378 INCLUDE_DEFAULT_LOADER); |
339 if (loader) | 379 if (loader) |
340 loader->OnApplicationError(this, url); | 380 loader->OnApplicationError(this, url); |
341 if (delegate_) | 381 delegate_->OnApplicationError(requested_url); |
342 delegate_->OnApplicationError(url); | |
343 } | 382 } |
344 | 383 |
345 void ApplicationManager::OnContentHandlerError( | 384 void ApplicationManager::OnContentHandlerError( |
346 ContentHandlerConnection* content_handler) { | 385 ContentHandlerConnection* content_handler) { |
347 // Remove the mapping to the content handler. | 386 // Remove the mapping to the content handler. |
348 auto it = | 387 auto it = |
349 url_to_content_handler_.find(content_handler->content_handler_url()); | 388 url_to_content_handler_.find(content_handler->content_handler_url()); |
350 DCHECK(it != url_to_content_handler_.end()); | 389 DCHECK(it != url_to_content_handler_.end()); |
351 delete it->second; | 390 delete it->second; |
352 url_to_content_handler_.erase(it); | 391 url_to_content_handler_.erase(it); |
(...skipping 12 matching lines...) Expand all Loading... |
365 return pipe.handle0.Pass(); | 404 return pipe.handle0.Pass(); |
366 } | 405 } |
367 | 406 |
368 Array<String> ApplicationManager::GetArgsForURL(const GURL& url) { | 407 Array<String> ApplicationManager::GetArgsForURL(const GURL& url) { |
369 URLToArgsMap::const_iterator args_it = url_to_args_.find(url); | 408 URLToArgsMap::const_iterator args_it = url_to_args_.find(url); |
370 if (args_it != url_to_args_.end()) | 409 if (args_it != url_to_args_.end()) |
371 return Array<String>::From(args_it->second); | 410 return Array<String>::From(args_it->second); |
372 return Array<String>(); | 411 return Array<String>(); |
373 } | 412 } |
374 } // namespace mojo | 413 } // namespace mojo |
OLD | NEW |