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

Side by Side Diff: chrome/browser/history/download_create_info.cc

Issue 6932046: Added DownloadProcessHandle class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed code extraneous to this CL. Created 9 years, 7 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/history/download_create_info.h" 5 #include "chrome/browser/history/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/stringprintf.h" 10 #include "base/stringprintf.h"
11 11
12 DownloadCreateInfo::DownloadCreateInfo(const FilePath& path, 12 DownloadCreateInfo::DownloadCreateInfo(const FilePath& path,
13 const GURL& url, 13 const GURL& url,
14 base::Time start_time, 14 base::Time start_time,
15 int64 received_bytes, 15 int64 received_bytes,
16 int64 total_bytes, 16 int64 total_bytes,
17 int32 state, 17 int32 state,
18 int32 download_id, 18 int32 download_id,
19 bool has_user_gesture) 19 bool has_user_gesture)
20 : path(path), 20 : path(path),
21 url_chain(1, url), 21 url_chain(1, url),
22 path_uniquifier(0), 22 path_uniquifier(0),
23 start_time(start_time), 23 start_time(start_time),
24 received_bytes(received_bytes), 24 received_bytes(received_bytes),
25 total_bytes(total_bytes), 25 total_bytes(total_bytes),
26 state(state), 26 state(state),
27 download_id(download_id), 27 download_id(download_id),
28 has_user_gesture(has_user_gesture), 28 has_user_gesture(has_user_gesture),
29 child_id(-1),
30 render_view_id(-1),
31 request_id(-1),
32 db_handle(0), 29 db_handle(0),
33 prompt_user_for_save_location(false), 30 prompt_user_for_save_location(false),
34 is_dangerous_file(false), 31 is_dangerous_file(false),
35 is_dangerous_url(false), 32 is_dangerous_url(false),
36 is_extension_install(false) { 33 is_extension_install(false) {
37 } 34 }
38 35
39 DownloadCreateInfo::DownloadCreateInfo() 36 DownloadCreateInfo::DownloadCreateInfo()
40 : path_uniquifier(0), 37 : path_uniquifier(0),
41 received_bytes(0), 38 received_bytes(0),
42 total_bytes(0), 39 total_bytes(0),
43 state(-1), 40 state(-1),
44 download_id(-1), 41 download_id(-1),
45 has_user_gesture(false), 42 has_user_gesture(false),
46 child_id(-1),
47 render_view_id(-1),
48 request_id(-1),
49 db_handle(0), 43 db_handle(0),
50 prompt_user_for_save_location(false), 44 prompt_user_for_save_location(false),
51 is_dangerous_file(false), 45 is_dangerous_file(false),
52 is_dangerous_url(false), 46 is_dangerous_url(false),
53 is_extension_install(false) { 47 is_extension_install(false) {
54 } 48 }
55 49
56 DownloadCreateInfo::~DownloadCreateInfo() { 50 DownloadCreateInfo::~DownloadCreateInfo() {
57 } 51 }
58 52
59 bool DownloadCreateInfo::IsDangerous() { 53 bool DownloadCreateInfo::IsDangerous() {
60 return is_dangerous_url || is_dangerous_file; 54 return is_dangerous_url || is_dangerous_file;
61 } 55 }
62 56
63 std::string DownloadCreateInfo::DebugString() const { 57 std::string DownloadCreateInfo::DebugString() const {
64 return base::StringPrintf("{" 58 return base::StringPrintf("{"
65 " url_ = \"%s\"" 59 " download_id = %d"
60 " url = \"%s\""
66 " path = \"%" PRFilePath "\"" 61 " path = \"%" PRFilePath "\""
67 " received_bytes = %" PRId64 62 " received_bytes = %" PRId64
68 " total_bytes = %" PRId64 63 " total_bytes = %" PRId64
69 " child_id = %d" 64 " child_id = %d"
70 " render_view_id = %d" 65 " render_view_id = %d"
71 " request_id = %d" 66 " request_id = %d"
72 " download_id = %d"
73 " prompt_user_for_save_location = %c" 67 " prompt_user_for_save_location = %c"
74 " }", 68 " }",
69 download_id,
75 url().spec().c_str(), 70 url().spec().c_str(),
76 path.value().c_str(), 71 path.value().c_str(),
77 received_bytes, 72 received_bytes,
78 total_bytes, 73 total_bytes,
79 child_id, 74 process_handle.child_id(),
80 render_view_id, 75 process_handle.render_view_id(),
81 request_id, 76 process_handle.request_id(),
82 download_id,
83 prompt_user_for_save_location ? 'T' : 'F'); 77 prompt_user_for_save_location ? 'T' : 'F');
84 } 78 }
85 79
86 const GURL& DownloadCreateInfo::url() const { 80 const GURL& DownloadCreateInfo::url() const {
87 return url_chain.empty() ? GURL::EmptyGURL() : url_chain.back(); 81 return url_chain.empty() ? GURL::EmptyGURL() : url_chain.back();
88 } 82 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698