OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/fetcher/network_fetcher.h" | 5 #include "mojo/fetcher/network_fetcher.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.h" | 9 #include "base/files/file.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 TRACE_EVENT_ASYNC_END0("mojo_shell", "NetworkFetcher::NetworkRequest", this); | 235 TRACE_EVENT_ASYNC_END0("mojo_shell", "NetworkFetcher::NetworkRequest", this); |
236 scoped_ptr<Fetcher> owner(this); | 236 scoped_ptr<Fetcher> owner(this); |
237 if (response->error) { | 237 if (response->error) { |
238 LOG(ERROR) << "Error (" << response->error->code << ": " | 238 LOG(ERROR) << "Error (" << response->error->code << ": " |
239 << response->error->description << ") while fetching " | 239 << response->error->description << ") while fetching " |
240 << response->url; | 240 << response->url; |
241 loader_callback_.Run(nullptr); | 241 loader_callback_.Run(nullptr); |
242 return; | 242 return; |
243 } | 243 } |
244 | 244 |
245 if (response->status_code >= 400 && response->status_code < 600) { | |
246 LOG(ERROR) << "Error (" << response->status_code << ": " | |
247 << response->status_line << "): " | |
248 << "while fetching " << response->url; | |
249 loader_callback_.Run(nullptr); | |
250 return; | |
251 } | |
252 | |
253 response_ = response.Pass(); | 245 response_ = response.Pass(); |
254 loader_callback_.Run(owner.Pass()); | 246 loader_callback_.Run(owner.Pass()); |
255 } | 247 } |
256 | 248 |
257 } // namespace fetcher | 249 } // namespace fetcher |
258 } // namespace mojo | 250 } // namespace mojo |
OLD | NEW |