| 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/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 << response->error->description << ") while fetching " | 153 << response->error->description << ") while fetching " |
| 154 << response->url; | 154 << response->url; |
| 155 LoaderComplete(); | 155 LoaderComplete(); |
| 156 return; | 156 return; |
| 157 } | 157 } |
| 158 | 158 |
| 159 MimeTypeToURLMap::iterator iter = | 159 MimeTypeToURLMap::iterator iter = |
| 160 mime_type_to_url_->find(response->mime_type); | 160 mime_type_to_url_->find(response->mime_type); |
| 161 if (iter != mime_type_to_url_->end()) { | 161 if (iter != mime_type_to_url_->end()) { |
| 162 load_callbacks_->LoadWithContentHandler(iter->second, response.Pass()); | 162 load_callbacks_->LoadWithContentHandler(iter->second, response.Pass()); |
| 163 LoaderComplete(); | |
| 164 return; | 163 return; |
| 165 } | 164 } |
| 166 | 165 |
| 167 base::CreateTemporaryFile(&file_); | 166 base::CreateTemporaryFile(&file_); |
| 168 common::CopyToFile( | 167 common::CopyToFile( |
| 169 response->body.Pass(), | 168 response->body.Pass(), |
| 170 file_, | 169 file_, |
| 171 context_->task_runners()->blocking_pool(), | 170 context_->task_runners()->blocking_pool(), |
| 172 base::Bind( | 171 base::Bind( |
| 173 &NetworkLoader::RunLibrary, weak_ptr_factory_.GetWeakPtr(), file_)); | 172 &NetworkLoader::RunLibrary, weak_ptr_factory_.GetWeakPtr(), file_)); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 // TODO(darin): What should we do about service errors? This implies that | 239 // TODO(darin): What should we do about service errors? This implies that |
| 241 // the app closed its handle to the service manager. Maybe we don't care? | 240 // the app closed its handle to the service manager. Maybe we don't care? |
| 242 } | 241 } |
| 243 | 242 |
| 244 void DynamicApplicationLoader::LoaderComplete(Loader* loader) { | 243 void DynamicApplicationLoader::LoaderComplete(Loader* loader) { |
| 245 loaders_.erase(std::find(loaders_.begin(), loaders_.end(), loader)); | 244 loaders_.erase(std::find(loaders_.begin(), loaders_.end(), loader)); |
| 246 } | 245 } |
| 247 | 246 |
| 248 } // namespace shell | 247 } // namespace shell |
| 249 } // namespace mojo | 248 } // namespace mojo |
| OLD | NEW |