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