| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 *defer = true; | 337 *defer = true; |
| 338 return true; | 338 return true; |
| 339 } | 339 } |
| 340 if (has_plugin) | 340 if (has_plugin) |
| 341 return true; | 341 return true; |
| 342 #endif | 342 #endif |
| 343 } | 343 } |
| 344 | 344 |
| 345 // Install download handler | 345 // Install download handler |
| 346 info->set_is_download(true); | 346 info->set_is_download(true); |
| 347 scoped_ptr<ResourceHandler> handler( | 347 scoped_ptr<ResourceHandler> handler(host_->CreateResourceHandlerForDownload( |
| 348 host_->CreateResourceHandlerForDownload( | 348 request_, |
| 349 request_, | 349 must_download)); |
| 350 true, // is_content_initiated | |
| 351 must_download, | |
| 352 content::DownloadItem::kInvalidId, | |
| 353 scoped_ptr<DownloadSaveInfo>(new DownloadSaveInfo()), | |
| 354 DownloadUrlParameters::OnStartedCallback())); | |
| 355 return UseAlternateNextHandler(handler.Pass()); | 350 return UseAlternateNextHandler(handler.Pass()); |
| 356 } | 351 } |
| 357 | 352 |
| 358 bool BufferedResourceHandler::UseAlternateNextHandler( | 353 bool BufferedResourceHandler::UseAlternateNextHandler( |
| 359 scoped_ptr<ResourceHandler> new_handler) { | 354 scoped_ptr<ResourceHandler> new_handler) { |
| 360 if (response_->head.headers.get() && // Can be NULL if FTP. | 355 if (response_->head.headers.get() && // Can be NULL if FTP. |
| 361 response_->head.headers->response_code() / 100 != 2) { | 356 response_->head.headers->response_code() / 100 != 2) { |
| 362 // The response code indicates that this is an error page, but we don't | 357 // The response code indicates that this is an error page, but we don't |
| 363 // know how to display the content. We follow Firefox here and show our | 358 // know how to display the content. We follow Firefox here and show our |
| 364 // own error page instead of triggering a download. | 359 // own error page instead of triggering a download. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 const std::vector<WebPluginInfo>& plugins) { | 459 const std::vector<WebPluginInfo>& plugins) { |
| 465 bool defer = false; | 460 bool defer = false; |
| 466 if (!ProcessResponse(&defer)) { | 461 if (!ProcessResponse(&defer)) { |
| 467 controller()->Cancel(); | 462 controller()->Cancel(); |
| 468 } else if (!defer) { | 463 } else if (!defer) { |
| 469 controller()->Resume(); | 464 controller()->Resume(); |
| 470 } | 465 } |
| 471 } | 466 } |
| 472 | 467 |
| 473 } // namespace content | 468 } // namespace content |
| OLD | NEW |