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/mime_type_resource_handler.h" | 5 #include "content/browser/loader/mime_type_resource_handler.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 bool handled_by_plugin; | 378 bool handled_by_plugin; |
379 if (!SelectPluginHandler(defer, &handled_by_plugin)) | 379 if (!SelectPluginHandler(defer, &handled_by_plugin)) |
380 return false; | 380 return false; |
381 if (handled_by_plugin || *defer) | 381 if (handled_by_plugin || *defer) |
382 return true; | 382 return true; |
383 } | 383 } |
384 | 384 |
385 // Install download handler | 385 // Install download handler |
386 info->set_is_download(true); | 386 info->set_is_download(true); |
387 scoped_ptr<ResourceHandler> handler( | 387 scoped_ptr<ResourceHandler> handler( |
388 host_->CreateResourceHandlerForDownload( | 388 host_->CreateResourceHandlerForDownload(request(), |
389 request(), | 389 true, // is_content_initiated |
390 true, // is_content_initiated | 390 must_download)); |
391 must_download, | |
392 DownloadItem::kInvalidId, | |
393 scoped_ptr<DownloadSaveInfo>(new DownloadSaveInfo()), | |
394 DownloadUrlParameters::OnStartedCallback())); | |
395 return UseAlternateNextHandler(std::move(handler), std::string()); | 391 return UseAlternateNextHandler(std::move(handler), std::string()); |
396 } | 392 } |
397 | 393 |
398 bool MimeTypeResourceHandler::UseAlternateNextHandler( | 394 bool MimeTypeResourceHandler::UseAlternateNextHandler( |
399 scoped_ptr<ResourceHandler> new_handler, | 395 scoped_ptr<ResourceHandler> new_handler, |
400 const std::string& payload_for_old_handler) { | 396 const std::string& payload_for_old_handler) { |
401 if (response_->head.headers.get() && // Can be NULL if FTP. | 397 if (response_->head.headers.get() && // Can be NULL if FTP. |
402 response_->head.headers->response_code() / 100 != 2) { | 398 response_->head.headers->response_code() / 100 != 2) { |
403 // The response code indicates that this is an error page, but we don't | 399 // The response code indicates that this is an error page, but we don't |
404 // know how to display the content. We follow Firefox here and show our | 400 // know how to display the content. We follow Firefox here and show our |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 request()->LogUnblocked(); | 511 request()->LogUnblocked(); |
516 bool defer = false; | 512 bool defer = false; |
517 if (!ProcessResponse(&defer)) { | 513 if (!ProcessResponse(&defer)) { |
518 controller()->Cancel(); | 514 controller()->Cancel(); |
519 } else if (!defer) { | 515 } else if (!defer) { |
520 controller()->Resume(); | 516 controller()->Resume(); |
521 } | 517 } |
522 } | 518 } |
523 | 519 |
524 } // namespace content | 520 } // namespace content |
OLD | NEW |