| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 78 |
| 79 virtual bool PeekFirstLine(std::string* line) = 0; | 79 virtual bool PeekFirstLine(std::string* line) = 0; |
| 80 | 80 |
| 81 void Load() { | 81 void Load() { |
| 82 // If the response begins with a #!mojo:<content-handler-url>, use it. | 82 // If the response begins with a #!mojo:<content-handler-url>, use it. |
| 83 GURL url; | 83 GURL url; |
| 84 std::string shebang; | 84 std::string shebang; |
| 85 if (PeekContentHandler(&shebang, &url)) { | 85 if (PeekContentHandler(&shebang, &url)) { |
| 86 load_callbacks_->LoadWithContentHandler( | 86 load_callbacks_->LoadWithContentHandler( |
| 87 url, AsURLResponse(context_->task_runners()->blocking_pool(), | 87 url, AsURLResponse(context_->task_runners()->blocking_pool(), |
| 88 shebang.size())); | 88 static_cast<int>(shebang.size()))); |
| 89 return; | 89 return; |
| 90 } | 90 } |
| 91 | 91 |
| 92 MimeTypeToURLMap::iterator iter = mime_type_to_url_->find(MimeType()); | 92 MimeTypeToURLMap::iterator iter = mime_type_to_url_->find(MimeType()); |
| 93 if (iter != mime_type_to_url_->end()) { | 93 if (iter != mime_type_to_url_->end()) { |
| 94 load_callbacks_->LoadWithContentHandler( | 94 load_callbacks_->LoadWithContentHandler( |
| 95 iter->second, | 95 iter->second, |
| 96 AsURLResponse(context_->task_runners()->blocking_pool(), 0)); | 96 AsURLResponse(context_->task_runners()->blocking_pool(), 0)); |
| 97 return; | 97 return; |
| 98 } | 98 } |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 // TODO(darin): What should we do about service errors? This implies that | 391 // 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? | 392 // the app closed its handle to the service manager. Maybe we don't care? |
| 393 } | 393 } |
| 394 | 394 |
| 395 void DynamicApplicationLoader::LoaderComplete(Loader* loader) { | 395 void DynamicApplicationLoader::LoaderComplete(Loader* loader) { |
| 396 loaders_.erase(std::find(loaders_.begin(), loaders_.end(), loader)); | 396 loaders_.erase(std::find(loaders_.begin(), loaders_.end(), loader)); |
| 397 } | 397 } |
| 398 | 398 |
| 399 } // namespace shell | 399 } // namespace shell |
| 400 } // namespace mojo | 400 } // namespace mojo |
| OLD | NEW |