| 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 "shell/dynamic_application_loader.h" | 5 #include "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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 void DynamicApplicationLoader::RegisterContentHandler( | 403 void DynamicApplicationLoader::RegisterContentHandler( |
| 404 const std::string& mime_type, | 404 const std::string& mime_type, |
| 405 const GURL& content_handler_url) { | 405 const GURL& content_handler_url) { |
| 406 DCHECK(content_handler_url.is_valid()) | 406 DCHECK(content_handler_url.is_valid()) |
| 407 << "Content handler URL is invalid for mime type " << mime_type; | 407 << "Content handler URL is invalid for mime type " << mime_type; |
| 408 mime_type_to_url_[mime_type] = content_handler_url; | 408 mime_type_to_url_[mime_type] = content_handler_url; |
| 409 } | 409 } |
| 410 | 410 |
| 411 void DynamicApplicationLoader::Load(ApplicationManager* manager, | 411 void DynamicApplicationLoader::Load(ApplicationManager* manager, |
| 412 const GURL& url, | 412 const GURL& url, |
| 413 ScopedMessagePipeHandle shell_handle, | 413 ShellPtr shell, |
| 414 LoadCallback load_callback) { | 414 LoadCallback load_callback) { |
| 415 if (url.SchemeIsFile()) { | 415 if (url.SchemeIsFile()) { |
| 416 loaders_.push_back(new LocalLoader( | 416 loaders_.push_back(new LocalLoader( |
| 417 url, &mime_type_to_url_, context_, runner_factory_.get(), | 417 url, &mime_type_to_url_, context_, runner_factory_.get(), |
| 418 shell_handle.Pass(), load_callback, loader_complete_callback_)); | 418 shell.PassMessagePipe(), load_callback, loader_complete_callback_)); |
| 419 return; | 419 return; |
| 420 } | 420 } |
| 421 | 421 |
| 422 if (!network_service_) { | 422 if (!network_service_) { |
| 423 context_->application_manager()->ConnectToService( | 423 context_->application_manager()->ConnectToService( |
| 424 GURL("mojo:network_service"), &network_service_); | 424 GURL("mojo:network_service"), &network_service_); |
| 425 } | 425 } |
| 426 | 426 |
| 427 loaders_.push_back( | 427 loaders_.push_back(new NetworkLoader( |
| 428 new NetworkLoader(url, network_service_.get(), &mime_type_to_url_, | 428 url, network_service_.get(), &mime_type_to_url_, context_, |
| 429 context_, runner_factory_.get(), shell_handle.Pass(), | 429 runner_factory_.get(), shell.PassMessagePipe(), load_callback, |
| 430 load_callback, loader_complete_callback_)); | 430 loader_complete_callback_)); |
| 431 } | 431 } |
| 432 | 432 |
| 433 void DynamicApplicationLoader::OnApplicationError(ApplicationManager* manager, | 433 void DynamicApplicationLoader::OnApplicationError(ApplicationManager* manager, |
| 434 const GURL& url) { | 434 const GURL& url) { |
| 435 // TODO(darin): What should we do about service errors? This implies that | 435 // TODO(darin): What should we do about service errors? This implies that |
| 436 // the app closed its handle to the service manager. Maybe we don't care? | 436 // the app closed its handle to the service manager. Maybe we don't care? |
| 437 } | 437 } |
| 438 | 438 |
| 439 void DynamicApplicationLoader::LoaderComplete(Loader* loader) { | 439 void DynamicApplicationLoader::LoaderComplete(Loader* loader) { |
| 440 loaders_.erase(std::find(loaders_.begin(), loaders_.end(), loader)); | 440 loaders_.erase(std::find(loaders_.begin(), loaders_.end(), loader)); |
| 441 } | 441 } |
| 442 | 442 |
| 443 } // namespace shell | 443 } // namespace shell |
| 444 } // namespace mojo | 444 } // namespace mojo |
| OLD | NEW |