| 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/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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 base::Bind(&DynamicApplicationLoader::LoaderComplete, | 355 base::Bind(&DynamicApplicationLoader::LoaderComplete, |
| 356 base::Unretained(this))) { | 356 base::Unretained(this))) { |
| 357 } | 357 } |
| 358 | 358 |
| 359 DynamicApplicationLoader::~DynamicApplicationLoader() { | 359 DynamicApplicationLoader::~DynamicApplicationLoader() { |
| 360 } | 360 } |
| 361 | 361 |
| 362 void DynamicApplicationLoader::RegisterContentHandler( | 362 void DynamicApplicationLoader::RegisterContentHandler( |
| 363 const std::string& mime_type, | 363 const std::string& mime_type, |
| 364 const GURL& content_handler_url) { | 364 const GURL& content_handler_url) { |
| 365 DCHECK(content_handler_url.is_valid()) |
| 366 << "Content handler URL is invalid for mime type " << mime_type; |
| 365 mime_type_to_url_[mime_type] = content_handler_url; | 367 mime_type_to_url_[mime_type] = content_handler_url; |
| 366 } | 368 } |
| 367 | 369 |
| 368 void DynamicApplicationLoader::Load( | 370 void DynamicApplicationLoader::Load( |
| 369 ApplicationManager* manager, | 371 ApplicationManager* manager, |
| 370 const GURL& url, | 372 const GURL& url, |
| 371 scoped_refptr<LoadCallbacks> load_callbacks) { | 373 scoped_refptr<LoadCallbacks> load_callbacks) { |
| 372 if (url.SchemeIsFile()) { | 374 if (url.SchemeIsFile()) { |
| 373 loaders_.push_back(new LocalLoader(url, &mime_type_to_url_, context_, | 375 loaders_.push_back(new LocalLoader(url, &mime_type_to_url_, context_, |
| 374 runner_factory_.get(), load_callbacks, | 376 runner_factory_.get(), load_callbacks, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 391 // TODO(darin): What should we do about service errors? This implies that | 393 // TODO(darin): What should we do about service errors? This implies that |
| 392 // the app closed its handle to the service manager. Maybe we don't care? | 394 // the app closed its handle to the service manager. Maybe we don't care? |
| 393 } | 395 } |
| 394 | 396 |
| 395 void DynamicApplicationLoader::LoaderComplete(Loader* loader) { | 397 void DynamicApplicationLoader::LoaderComplete(Loader* loader) { |
| 396 loaders_.erase(std::find(loaders_.begin(), loaders_.end(), loader)); | 398 loaders_.erase(std::find(loaders_.begin(), loaders_.end(), loader)); |
| 397 } | 399 } |
| 398 | 400 |
| 399 } // namespace shell | 401 } // namespace shell |
| 400 } // namespace mojo | 402 } // namespace mojo |
| OLD | NEW |