| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/loader/buffered_resource_handler.h" | 5 #include "content/browser/loader/buffered_resource_handler.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 358 |
| 359 bool BufferedResourceHandler::UseAlternateNextHandler( | 359 bool BufferedResourceHandler::UseAlternateNextHandler( |
| 360 scoped_ptr<ResourceHandler> new_handler) { | 360 scoped_ptr<ResourceHandler> new_handler) { |
| 361 if (response_->head.headers.get() && // Can be NULL if FTP. | 361 if (response_->head.headers.get() && // Can be NULL if FTP. |
| 362 response_->head.headers->response_code() / 100 != 2) { | 362 response_->head.headers->response_code() / 100 != 2) { |
| 363 // The response code indicates that this is an error page, but we don't | 363 // The response code indicates that this is an error page, but we don't |
| 364 // know how to display the content. We follow Firefox here and show our | 364 // know how to display the content. We follow Firefox here and show our |
| 365 // own error page instead of triggering a download. | 365 // own error page instead of triggering a download. |
| 366 // TODO(abarth): We should abstract the response_code test, but this kind | 366 // TODO(abarth): We should abstract the response_code test, but this kind |
| 367 // of check is scattered throughout our codebase. | 367 // of check is scattered throughout our codebase. |
| 368 request()->CancelWithError(net::ERR_FILE_NOT_FOUND); | 368 request()->CancelWithError(net::ERR_INVALID_RESPONSE); |
| 369 return false; | 369 return false; |
| 370 } | 370 } |
| 371 | 371 |
| 372 int request_id = GetRequestID(); | 372 int request_id = GetRequestID(); |
| 373 | 373 |
| 374 // Inform the original ResourceHandler that this will be handled entirely by | 374 // Inform the original ResourceHandler that this will be handled entirely by |
| 375 // the new ResourceHandler. | 375 // the new ResourceHandler. |
| 376 // TODO(darin): We should probably check the return values of these. | 376 // TODO(darin): We should probably check the return values of these. |
| 377 bool defer_ignored = false; | 377 bool defer_ignored = false; |
| 378 next_handler_->OnResponseStarted(request_id, response_.get(), &defer_ignored); | 378 next_handler_->OnResponseStarted(request_id, response_.get(), &defer_ignored); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 request()->LogUnblocked(); | 477 request()->LogUnblocked(); |
| 478 bool defer = false; | 478 bool defer = false; |
| 479 if (!ProcessResponse(&defer)) { | 479 if (!ProcessResponse(&defer)) { |
| 480 controller()->Cancel(); | 480 controller()->Cancel(); |
| 481 } else if (!defer) { | 481 } else if (!defer) { |
| 482 controller()->Resume(); | 482 controller()->Resume(); |
| 483 } | 483 } |
| 484 } | 484 } |
| 485 | 485 |
| 486 } // namespace content | 486 } // namespace content |
| OLD | NEW |