[Downloads] Cleanup DownloadResourceHandler
[chromium-blink-merge.git] / content / browser / download / download_create_info.cc
blobe381fa854bd79491433611918e306ce72cb61ad7
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"
7 #include <string>
9 #include "base/format_macros.h"
10 #include "base/strings/stringprintf.h"
12 namespace content {
14 DownloadCreateInfo::DownloadCreateInfo(const base::Time& start_time,
15 int64 total_bytes,
16 const net::BoundNetLog& bound_net_log,
17 bool has_user_gesture,
18 PageTransition transition_type,
19 scoped_ptr<DownloadSaveInfo> save_info)
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(save_info.Pass()),
26 request_bound_net_log(bound_net_log) {}
28 DownloadCreateInfo::DownloadCreateInfo()
29 : total_bytes(0),
30 download_id(DownloadItem::kInvalidId),
31 has_user_gesture(false),
32 transition_type(PAGE_TRANSITION_LINK),
33 save_info(new DownloadSaveInfo()) {
36 DownloadCreateInfo::~DownloadCreateInfo() {
39 std::string DownloadCreateInfo::DebugString() const {
40 return base::StringPrintf("{"
41 " download_id = %u"
42 " url = \"%s\""
43 " request_handle = %s"
44 " total_bytes = %" PRId64
45 " }",
46 download_id,
47 url().spec().c_str(),
48 request_handle.DebugString().c_str(),
49 total_bytes);
52 const GURL& DownloadCreateInfo::url() const {
53 return url_chain.empty() ? GURL::EmptyGURL() : url_chain.back();
56 } // namespace content