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