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
3 // found in the LICENSE file.
5 #include "content/browser/download/download_create_info.h"
9 #include "base/format_macros.h"
10 #include "base/strings/stringprintf.h"
14 DownloadCreateInfo::DownloadCreateInfo(
15 const base::Time
& start_time
,
17 const net::BoundNetLog
& bound_net_log
,
18 bool has_user_gesture
,
19 PageTransition transition_type
)
20 : start_time(start_time
),
21 total_bytes(total_bytes
),
22 download_id(DownloadItem::kInvalidId
),
23 has_user_gesture(has_user_gesture
),
24 transition_type(transition_type
),
25 save_info(new DownloadSaveInfo()),
26 request_bound_net_log(bound_net_log
) {
29 DownloadCreateInfo::DownloadCreateInfo()
31 download_id(DownloadItem::kInvalidId
),
32 has_user_gesture(false),
33 transition_type(PAGE_TRANSITION_LINK
),
34 save_info(new DownloadSaveInfo()) {
37 DownloadCreateInfo::~DownloadCreateInfo() {
40 std::string
DownloadCreateInfo::DebugString() const {
41 return base::StringPrintf("{"
44 " request_handle = %s"
45 " total_bytes = %" PRId64
49 request_handle
.DebugString().c_str(),
53 const GURL
& DownloadCreateInfo::url() const {
54 return url_chain
.empty() ? GURL::EmptyGURL() : url_chain
.back();
57 } // namespace content