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