| 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_create_info.h" | 5 #include "content/browser/download/download_create_info.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | |
| 9 | 8 |
| 10 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 11 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 12 | 11 |
| 13 namespace content { | 12 namespace content { |
| 14 | 13 |
| 15 DownloadCreateInfo::DownloadCreateInfo(const base::Time& start_time, | 14 DownloadCreateInfo::DownloadCreateInfo(const base::Time& start_time, |
| 16 int64_t total_bytes, | |
| 17 const net::BoundNetLog& bound_net_log, | 15 const net::BoundNetLog& bound_net_log, |
| 18 scoped_ptr<DownloadSaveInfo> save_info) | 16 scoped_ptr<DownloadSaveInfo> save_info) |
| 19 : start_time(start_time), | 17 : download_id(DownloadItem::kInvalidId), |
| 20 total_bytes(total_bytes), | 18 start_time(start_time), |
| 21 download_id(DownloadItem::kInvalidId), | 19 total_bytes(0), |
| 22 has_user_gesture(false), | 20 has_user_gesture(false), |
| 23 transition_type(ui::PAGE_TRANSITION_LINK), | 21 transition_type(ui::PAGE_TRANSITION_LINK), |
| 22 result(DOWNLOAD_INTERRUPT_REASON_NONE), |
| 24 save_info(std::move(save_info)), | 23 save_info(std::move(save_info)), |
| 25 request_bound_net_log(bound_net_log) {} | 24 request_bound_net_log(bound_net_log) {} |
| 26 | 25 |
| 27 DownloadCreateInfo::DownloadCreateInfo() | 26 DownloadCreateInfo::DownloadCreateInfo() |
| 28 : DownloadCreateInfo(base::Time(), | 27 : DownloadCreateInfo(base::Time(), |
| 29 0, | |
| 30 net::BoundNetLog(), | 28 net::BoundNetLog(), |
| 31 make_scoped_ptr(new DownloadSaveInfo)) {} | 29 make_scoped_ptr(new DownloadSaveInfo)) {} |
| 32 | 30 |
| 33 DownloadCreateInfo::~DownloadCreateInfo() {} | 31 DownloadCreateInfo::~DownloadCreateInfo() {} |
| 34 | 32 |
| 35 std::string DownloadCreateInfo::DebugString() const { | 33 std::string DownloadCreateInfo::DebugString() const { |
| 36 return base::StringPrintf( | 34 return base::StringPrintf( |
| 37 "{" | 35 "{" |
| 38 " download_id = %u" | 36 " download_id = %u" |
| 39 " url = \"%s\"" | 37 " url = \"%s\"" |
| 40 " request_handle = %s" | 38 " request_handle = %s" |
| 41 " total_bytes = %" PRId64 " }", | 39 " total_bytes = %" PRId64 " }", |
| 42 download_id, url().spec().c_str(), request_handle->DebugString().c_str(), | 40 download_id, url().spec().c_str(), request_handle->DebugString().c_str(), |
| 43 total_bytes); | 41 total_bytes); |
| 44 } | 42 } |
| 45 | 43 |
| 46 const GURL& DownloadCreateInfo::url() const { | 44 const GURL& DownloadCreateInfo::url() const { |
| 47 return url_chain.empty() ? GURL::EmptyGURL() : url_chain.back(); | 45 return url_chain.empty() ? GURL::EmptyGURL() : url_chain.back(); |
| 48 } | 46 } |
| 49 | 47 |
| 50 } // namespace content | 48 } // namespace content |
| OLD | NEW |