Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: mojo/shell/dynamic_application_loader.cc

Issue 696563002: Cache ShellImpl by resolved URL, not initial URL (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebase Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/shell/context.cc ('k') | mojo/shell/external_application_listener_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/shell/dynamic_application_loader.h" 5 #include "mojo/shell/dynamic_application_loader.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/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 void DynamicApplicationLoader::RegisterContentHandler( 257 void DynamicApplicationLoader::RegisterContentHandler(
258 const std::string& mime_type, 258 const std::string& mime_type,
259 const GURL& content_handler_url) { 259 const GURL& content_handler_url) {
260 mime_type_to_url_[mime_type] = content_handler_url; 260 mime_type_to_url_[mime_type] = content_handler_url;
261 } 261 }
262 262
263 void DynamicApplicationLoader::Load( 263 void DynamicApplicationLoader::Load(
264 ApplicationManager* manager, 264 ApplicationManager* manager,
265 const GURL& url, 265 const GURL& url,
266 scoped_refptr<LoadCallbacks> load_callbacks) { 266 scoped_refptr<LoadCallbacks> load_callbacks) {
267 GURL resolved_url; 267 if (url.SchemeIsFile()) {
268 if (url.SchemeIs("mojo")) { 268 loaders_.push_back(new LocalLoader(url,
269 resolved_url = context_->mojo_url_resolver()->Resolve(url);
270 } else {
271 resolved_url = url;
272 }
273
274 if (resolved_url.SchemeIsFile()) {
275 loaders_.push_back(new LocalLoader(resolved_url,
276 context_, 269 context_,
277 runner_factory_.get(), 270 runner_factory_.get(),
278 load_callbacks, 271 load_callbacks,
279 loader_complete_callback_)); 272 loader_complete_callback_));
280 return; 273 return;
281 } 274 }
282 275
283 if (!network_service_) { 276 if (!network_service_) {
284 context_->application_manager()->ConnectToService( 277 context_->application_manager()->ConnectToService(
285 GURL("mojo:network_service"), &network_service_); 278 GURL("mojo:network_service"), &network_service_);
286 } 279 }
287 280
288 loaders_.push_back(new NetworkLoader(resolved_url, 281 loaders_.push_back(new NetworkLoader(url,
289 &mime_type_to_url_, 282 &mime_type_to_url_,
290 context_, 283 context_,
291 runner_factory_.get(), 284 runner_factory_.get(),
292 network_service_.get(), 285 network_service_.get(),
293 load_callbacks, 286 load_callbacks,
294 loader_complete_callback_)); 287 loader_complete_callback_));
295 } 288 }
296 289
297 void DynamicApplicationLoader::OnApplicationError(ApplicationManager* manager, 290 void DynamicApplicationLoader::OnApplicationError(ApplicationManager* manager,
298 const GURL& url) { 291 const GURL& url) {
299 // TODO(darin): What should we do about service errors? This implies that 292 // TODO(darin): What should we do about service errors? This implies that
300 // the app closed its handle to the service manager. Maybe we don't care? 293 // the app closed its handle to the service manager. Maybe we don't care?
301 } 294 }
302 295
303 void DynamicApplicationLoader::LoaderComplete(Loader* loader) { 296 void DynamicApplicationLoader::LoaderComplete(Loader* loader) {
304 loaders_.erase(std::find(loaders_.begin(), loaders_.end(), loader)); 297 loaders_.erase(std::find(loaders_.begin(), loaders_.end(), loader));
305 } 298 }
306 299
307 } // namespace shell 300 } // namespace shell
308 } // namespace mojo 301 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/context.cc ('k') | mojo/shell/external_application_listener_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698