Chromium Code Reviews| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 } | 153 } |
| 154 | 154 |
| 155 ~NetworkLoader() override { | 155 ~NetworkLoader() override { |
| 156 if (!file_.empty()) | 156 if (!file_.empty()) |
| 157 base::DeleteFile(file_, false); | 157 base::DeleteFile(file_, false); |
| 158 } | 158 } |
| 159 | 159 |
| 160 private: | 160 private: |
| 161 void OnLoadComplete(URLResponsePtr response) { | 161 void OnLoadComplete(URLResponsePtr response) { |
| 162 if (response->error) { | 162 if (response->error) { |
| 163 LOG(ERROR) << "Error (" << response->error->code << ": " | 163 if (response->url->is_valid()) { |
| 164 << response->error->description << ") while fetching " | 164 LOG(ERROR) << "Error (" << response->error->code << ": " |
| 165 << response->url; | 165 << response->error->description << ") while fetching " |
| 166 << response->url; | |
| 167 } else { | |
| 168 // If the URL was not valid, it's not possible to get the spec. | |
|
Aaron Boodman
2014/11/19 20:29:28
I think you can use possibly_invalid_spec() here.
azani
2014/11/19 23:08:54
Nope. Also returns an empty string. It looks like
| |
| 169 LOG(ERROR) << "Error (" << response->error->code << ": " | |
| 170 << response->error->description << ")"; | |
| 171 } | |
| 166 LoaderComplete(); | 172 LoaderComplete(); |
| 167 return; | 173 return; |
| 168 } | 174 } |
| 169 | 175 |
| 170 MimeTypeToURLMap::iterator iter = | 176 MimeTypeToURLMap::iterator iter = |
| 171 mime_type_to_url_->find(response->mime_type); | 177 mime_type_to_url_->find(response->mime_type); |
| 172 if (iter != mime_type_to_url_->end()) { | 178 if (iter != mime_type_to_url_->end()) { |
| 173 load_callbacks_->LoadWithContentHandler(iter->second, response.Pass()); | 179 load_callbacks_->LoadWithContentHandler(iter->second, response.Pass()); |
| 174 return; | 180 return; |
| 175 } | 181 } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 // TODO(darin): What should we do about service errors? This implies that | 259 // 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? | 260 // the app closed its handle to the service manager. Maybe we don't care? |
| 255 } | 261 } |
| 256 | 262 |
| 257 void DynamicApplicationLoader::LoaderComplete(Loader* loader) { | 263 void DynamicApplicationLoader::LoaderComplete(Loader* loader) { |
| 258 loaders_.erase(std::find(loaders_.begin(), loaders_.end(), loader)); | 264 loaders_.erase(std::find(loaders_.begin(), loaders_.end(), loader)); |
| 259 } | 265 } |
| 260 | 266 |
| 261 } // namespace shell | 267 } // namespace shell |
| 262 } // namespace mojo | 268 } // namespace mojo |
| OLD | NEW |