Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: content/browser/download/download_create_info.cc

Issue 1533583002: [Downloads] Factor out request handling logic between DRH and UD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments and change .Pass() -> std::move(...) per PRESUBMIT check Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 DownloadCreateInfo::DownloadCreateInfo(const base::Time& start_time, 14 DownloadCreateInfo::DownloadCreateInfo(const base::Time& start_time,
15 int64 total_bytes, 15 int64 total_bytes,
16 const net::BoundNetLog& bound_net_log, 16 const net::BoundNetLog& bound_net_log,
17 bool has_user_gesture,
18 ui::PageTransition transition_type,
19 scoped_ptr<DownloadSaveInfo> save_info) 17 scoped_ptr<DownloadSaveInfo> save_info)
20 : start_time(start_time), 18 : start_time(start_time),
21 total_bytes(total_bytes), 19 total_bytes(total_bytes),
22 download_id(DownloadItem::kInvalidId), 20 download_id(DownloadItem::kInvalidId),
23 has_user_gesture(has_user_gesture), 21 has_user_gesture(false),
24 transition_type(transition_type), 22 transition_type(ui::PAGE_TRANSITION_LINK),
25 save_info(save_info.Pass()), 23 save_info(save_info.Pass()),
26 request_bound_net_log(bound_net_log) {} 24 request_bound_net_log(bound_net_log) {}
27 25
28 DownloadCreateInfo::DownloadCreateInfo() 26 DownloadCreateInfo::DownloadCreateInfo()
29 : total_bytes(0), 27 : DownloadCreateInfo(base::Time(),
30 download_id(DownloadItem::kInvalidId), 28 0,
31 has_user_gesture(false), 29 net::BoundNetLog(),
32 transition_type(ui::PAGE_TRANSITION_LINK), 30 make_scoped_ptr(new DownloadSaveInfo)) {}
33 save_info(new DownloadSaveInfo()) {
34 }
35 31
36 DownloadCreateInfo::~DownloadCreateInfo() { 32 DownloadCreateInfo::~DownloadCreateInfo() {}
37 }
38 33
39 std::string DownloadCreateInfo::DebugString() const { 34 std::string DownloadCreateInfo::DebugString() const {
40 return base::StringPrintf("{" 35 return base::StringPrintf(
41 " download_id = %u" 36 "{"
42 " url = \"%s\"" 37 " download_id = %u"
43 " request_handle = %s" 38 " url = \"%s\""
44 " total_bytes = %" PRId64 39 " request_handle = %s"
45 " }", 40 " total_bytes = %" PRId64 " }",
46 download_id, 41 download_id, url().spec().c_str(), request_handle->DebugString().c_str(),
47 url().spec().c_str(), 42 total_bytes);
48 request_handle.DebugString().c_str(),
49 total_bytes);
50 } 43 }
51 44
52 const GURL& DownloadCreateInfo::url() const { 45 const GURL& DownloadCreateInfo::url() const {
53 return url_chain.empty() ? GURL::EmptyGURL() : url_chain.back(); 46 return url_chain.empty() ? GURL::EmptyGURL() : url_chain.back();
54 } 47 }
55 48
56 } // namespace content 49 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_create_info.h ('k') | content/browser/download/download_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698