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

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: cleanup 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
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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 void DynamicApplicationLoader::RegisterContentHandler( 211 void DynamicApplicationLoader::RegisterContentHandler(
212 const std::string& mime_type, 212 const std::string& mime_type,
213 const GURL& content_handler_url) { 213 const GURL& content_handler_url) {
214 mime_type_to_url_[mime_type] = content_handler_url; 214 mime_type_to_url_[mime_type] = content_handler_url;
215 } 215 }
216 216
217 void DynamicApplicationLoader::Load( 217 void DynamicApplicationLoader::Load(
218 ApplicationManager* manager, 218 ApplicationManager* manager,
219 const GURL& url, 219 const GURL& url,
220 scoped_refptr<LoadCallbacks> load_callbacks) { 220 scoped_refptr<LoadCallbacks> load_callbacks) {
221 GURL resolved_url; 221 if (url.SchemeIsFile()) {
222 if (url.SchemeIs("mojo")) { 222 loaders_.push_back(new LocalLoader(url,
223 resolved_url = context_->mojo_url_resolver()->Resolve(url);
224 } else {
225 resolved_url = url;
226 }
227
228 if (resolved_url.SchemeIsFile()) {
229 loaders_.push_back(new LocalLoader(resolved_url,
230 context_, 223 context_,
231 runner_factory_.get(), 224 runner_factory_.get(),
232 load_callbacks, 225 load_callbacks,
233 loader_complete_callback_)); 226 loader_complete_callback_));
234 return; 227 return;
235 } 228 }
236 229
237 if (!network_service_) { 230 if (!network_service_) {
238 context_->application_manager()->ConnectToService( 231 context_->application_manager()->ConnectToService(
239 GURL("mojo:network_service"), &network_service_); 232 GURL("mojo:network_service"), &network_service_);
240 } 233 }
241 234
242 loaders_.push_back(new NetworkLoader(resolved_url, 235 loaders_.push_back(new NetworkLoader(url,
243 &mime_type_to_url_, 236 &mime_type_to_url_,
244 context_, 237 context_,
245 runner_factory_.get(), 238 runner_factory_.get(),
246 network_service_.get(), 239 network_service_.get(),
247 load_callbacks, 240 load_callbacks,
248 loader_complete_callback_)); 241 loader_complete_callback_));
249 } 242 }
250 243
251 void DynamicApplicationLoader::OnApplicationError(ApplicationManager* manager, 244 void DynamicApplicationLoader::OnApplicationError(ApplicationManager* manager,
252 const GURL& url) { 245 const GURL& url) {
253 // TODO(darin): What should we do about service errors? This implies that 246 // TODO(darin): What should we do about service errors? This implies that
254 // the app closed its handle to the service manager. Maybe we don't care? 247 // the app closed its handle to the service manager. Maybe we don't care?
255 } 248 }
256 249
257 void DynamicApplicationLoader::LoaderComplete(Loader* loader) { 250 void DynamicApplicationLoader::LoaderComplete(Loader* loader) {
258 loaders_.erase(std::find(loaders_.begin(), loaders_.end(), loader)); 251 loaders_.erase(std::find(loaders_.begin(), loaders_.end(), loader));
259 } 252 }
260 253
261 } // namespace shell 254 } // namespace shell
262 } // namespace mojo 255 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698