| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 | 267 |
| 268 std::unique_ptr<DownloadCreateInfo> | 268 std::unique_ptr<DownloadCreateInfo> |
| 269 DownloadRequestCore::CreateDownloadCreateInfo(DownloadInterruptReason result) { | 269 DownloadRequestCore::CreateDownloadCreateInfo(DownloadInterruptReason result) { |
| 270 DCHECK(!started_); | 270 DCHECK(!started_); |
| 271 started_ = true; | 271 started_ = true; |
| 272 std::unique_ptr<DownloadCreateInfo> create_info(new DownloadCreateInfo( | 272 std::unique_ptr<DownloadCreateInfo> create_info(new DownloadCreateInfo( |
| 273 base::Time::Now(), request()->net_log(), std::move(save_info_))); | 273 base::Time::Now(), request()->net_log(), std::move(save_info_))); |
| 274 | 274 |
| 275 if (result == DOWNLOAD_INTERRUPT_REASON_NONE) | 275 if (result == DOWNLOAD_INTERRUPT_REASON_NONE) |
| 276 create_info->remote_address = request()->GetSocketAddress().host(); | 276 create_info->remote_address = request()->GetSocketAddress().host(); |
| 277 create_info->connection_info = request()->response_info().connection_info; |
| 277 create_info->url_chain = request()->url_chain(); | 278 create_info->url_chain = request()->url_chain(); |
| 278 create_info->referrer_url = GURL(request()->referrer()); | 279 create_info->referrer_url = GURL(request()->referrer()); |
| 279 create_info->result = result; | 280 create_info->result = result; |
| 280 create_info->download_id = download_id_; | 281 create_info->download_id = download_id_; |
| 281 create_info->offset = create_info->save_info->offset; | 282 create_info->offset = create_info->save_info->offset; |
| 282 return create_info; | 283 return create_info; |
| 283 } | 284 } |
| 284 | 285 |
| 285 bool DownloadRequestCore::OnResponseStarted( | 286 bool DownloadRequestCore::OnResponseStarted( |
| 286 const std::string& override_mime_type) { | 287 const std::string& override_mime_type) { |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 return DOWNLOAD_INTERRUPT_REASON_NONE; | 662 return DOWNLOAD_INTERRUPT_REASON_NONE; |
| 662 } | 663 } |
| 663 | 664 |
| 664 if (http_headers.response_code() == net::HTTP_PARTIAL_CONTENT) | 665 if (http_headers.response_code() == net::HTTP_PARTIAL_CONTENT) |
| 665 return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT; | 666 return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT; |
| 666 | 667 |
| 667 return DOWNLOAD_INTERRUPT_REASON_NONE; | 668 return DOWNLOAD_INTERRUPT_REASON_NONE; |
| 668 } | 669 } |
| 669 | 670 |
| 670 } // namespace content | 671 } // namespace content |
| OLD | NEW |