| 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/renderer_host/buffered_resource_handler.h" | 5 #include "content/browser/renderer_host/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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 if (has_plugin) | 322 if (has_plugin) |
| 323 return true; | 323 return true; |
| 324 } | 324 } |
| 325 | 325 |
| 326 // Install download handler | 326 // Install download handler |
| 327 info->set_is_download(true); | 327 info->set_is_download(true); |
| 328 scoped_ptr<ResourceHandler> handler( | 328 scoped_ptr<ResourceHandler> handler( |
| 329 host_->CreateResourceHandlerForDownload( | 329 host_->CreateResourceHandlerForDownload( |
| 330 request_, | 330 request_, |
| 331 true, // is_content_initiated | 331 true, // is_content_initiated |
| 332 DownloadSaveInfo(), | 332 scoped_ptr<DownloadSaveInfo>(new DownloadSaveInfo()), |
| 333 DownloadResourceHandler::OnStartedCallback())); | 333 DownloadResourceHandler::OnStartedCallback())); |
| 334 return UseAlternateNextHandler(handler.Pass()); | 334 return UseAlternateNextHandler(handler.Pass()); |
| 335 } | 335 } |
| 336 | 336 |
| 337 bool BufferedResourceHandler::UseAlternateNextHandler( | 337 bool BufferedResourceHandler::UseAlternateNextHandler( |
| 338 scoped_ptr<ResourceHandler> new_handler) { | 338 scoped_ptr<ResourceHandler> new_handler) { |
| 339 if (response_->head.headers && // Can be NULL if FTP. | 339 if (response_->head.headers && // Can be NULL if FTP. |
| 340 response_->head.headers->response_code() / 100 != 2) { | 340 response_->head.headers->response_code() / 100 != 2) { |
| 341 // The response code indicates that this is an error page, but we don't | 341 // The response code indicates that this is an error page, but we don't |
| 342 // know how to display the content. We follow Firefox here and show our | 342 // know how to display the content. We follow Firefox here and show our |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 const std::vector<webkit::WebPluginInfo>& plugins) { | 443 const std::vector<webkit::WebPluginInfo>& plugins) { |
| 444 bool defer = false; | 444 bool defer = false; |
| 445 if (!ProcessResponse(&defer)) { | 445 if (!ProcessResponse(&defer)) { |
| 446 controller()->Cancel(); | 446 controller()->Cancel(); |
| 447 } else if (!defer) { | 447 } else if (!defer) { |
| 448 controller()->Resume(); | 448 controller()->Resume(); |
| 449 } | 449 } |
| 450 } | 450 } |
| 451 | 451 |
| 452 } // namespace content | 452 } // namespace content |
| OLD | NEW |