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/download/download_request_core.h" | 5 #include "content/browser/download/download_request_core.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 | 360 |
361 // Blink verifies that the requester of this download is allowed to set a | 361 // Blink verifies that the requester of this download is allowed to set a |
362 // suggested name for the security origin of the download URL. However, this | 362 // suggested name for the security origin of the download URL. However, this |
363 // assumption doesn't hold if there were cross origin redirects. Therefore, | 363 // assumption doesn't hold if there were cross origin redirects. Therefore, |
364 // clear the suggested_name for such requests. | 364 // clear the suggested_name for such requests. |
365 if (create_info->url_chain.size() > 1 && | 365 if (create_info->url_chain.size() > 1 && |
366 create_info->url_chain.front().GetOrigin() != | 366 create_info->url_chain.front().GetOrigin() != |
367 create_info->url_chain.back().GetOrigin()) | 367 create_info->url_chain.back().GetOrigin()) |
368 create_info->save_info->suggested_name.clear(); | 368 create_info->save_info->suggested_name.clear(); |
369 | 369 |
370 RecordDownloadMimeType(create_info->mime_type); | |
371 RecordDownloadContentDisposition(create_info->content_disposition); | 370 RecordDownloadContentDisposition(create_info->content_disposition); |
372 RecordDownloadSourcePageTransitionType(create_info->transition_type); | 371 RecordDownloadSourcePageTransitionType(create_info->transition_type); |
373 | 372 |
374 delegate_->OnStart(std::move(create_info), std::move(stream_reader), | 373 delegate_->OnStart(std::move(create_info), std::move(stream_reader), |
375 base::ResetAndReturn(&on_started_callback_)); | 374 base::ResetAndReturn(&on_started_callback_)); |
376 return true; | 375 return true; |
377 } | 376 } |
378 | 377 |
379 bool DownloadRequestCore::OnRequestRedirected() { | 378 bool DownloadRequestCore::OnRequestRedirected() { |
380 DVLOG(20) << __func__ << "() " << DebugString(); | 379 DVLOG(20) << __func__ << "() " << DebugString(); |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 return DOWNLOAD_INTERRUPT_REASON_NONE; | 661 return DOWNLOAD_INTERRUPT_REASON_NONE; |
663 } | 662 } |
664 | 663 |
665 if (http_headers.response_code() == net::HTTP_PARTIAL_CONTENT) | 664 if (http_headers.response_code() == net::HTTP_PARTIAL_CONTENT) |
666 return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT; | 665 return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT; |
667 | 666 |
668 return DOWNLOAD_INTERRUPT_REASON_NONE; | 667 return DOWNLOAD_INTERRUPT_REASON_NONE; |
669 } | 668 } |
670 | 669 |
671 } // namespace content | 670 } // namespace content |
OLD | NEW |