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

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

Issue 23496076: WIP - Refactor programmatic downloads Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
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 #include "content/browser/byte_stream.h"
12 #include "content/public/browser/download_save_info.h"
11 13
12 namespace content { 14 namespace content {
13 15
14 DownloadCreateInfo::DownloadCreateInfo( 16 DownloadCreateInfo::DownloadCreateInfo(const base::Time& start_time,
15 const base::Time& start_time, 17 int64 total_bytes,
16 int64 total_bytes, 18 const net::BoundNetLog& bound_net_log,
17 const net::BoundNetLog& bound_net_log, 19 bool has_user_gesture,
18 bool has_user_gesture, 20 PageTransition transition_type,
19 PageTransition transition_type) 21 scoped_ptr<DownloadSaveInfo> save_info)
20 : start_time(start_time), 22 : is_save_package_download(false),
23 start_time(start_time),
21 total_bytes(total_bytes), 24 total_bytes(total_bytes),
22 download_id(DownloadItem::kInvalidId),
23 has_user_gesture(has_user_gesture), 25 has_user_gesture(has_user_gesture),
24 transition_type(transition_type), 26 transition_type(transition_type),
25 save_info(new DownloadSaveInfo()), 27 save_info(save_info.Pass()),
26 request_bound_net_log(bound_net_log) { 28 request_bound_net_log(bound_net_log) {}
27 }
28 29
29 DownloadCreateInfo::DownloadCreateInfo() 30 DownloadCreateInfo::DownloadCreateInfo()
30 : total_bytes(0), 31 : is_save_package_download(false),
31 download_id(DownloadItem::kInvalidId), 32 total_bytes(0),
32 has_user_gesture(false), 33 has_user_gesture(false),
33 transition_type(PAGE_TRANSITION_LINK), 34 transition_type(PAGE_TRANSITION_LINK),
34 save_info(new DownloadSaveInfo()) { 35 save_info(new DownloadSaveInfo()) {}
35 }
36 36
37 DownloadCreateInfo::~DownloadCreateInfo() { 37 DownloadCreateInfo::~DownloadCreateInfo() {
38 } 38 }
39 39
40 std::string DownloadCreateInfo::DebugString() const { 40 std::string DownloadCreateInfo::DebugString() const {
41 return base::StringPrintf("{" 41 return base::StringPrintf(
42 " download_id = %u" 42 "{"
43 " url = \"%s\"" 43 " url = \"%s\""
44 " request_handle = %s" 44 " total_bytes = %" PRId64 " }",
45 " total_bytes = %" PRId64 45 url().spec().c_str(),
46 " }", 46 total_bytes);
47 download_id,
48 url().spec().c_str(),
49 request_handle.DebugString().c_str(),
50 total_bytes);
51 } 47 }
52 48
53 const GURL& DownloadCreateInfo::url() const { 49 const GURL& DownloadCreateInfo::url() const {
54 return url_chain.empty() ? GURL::EmptyGURL() : url_chain.back(); 50 return url_chain.empty() ? GURL::EmptyGURL() : url_chain.back();
55 } 51 }
56 52
57 } // namespace content 53 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_create_info.h ('k') | content/browser/download/download_interrupt_reasons_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698