OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/download/download_create_info.h" | |
6 | |
7 #include <string> | |
8 | |
9 #include "base/format_macros.h" | |
10 #include "base/stringprintf.h" | |
11 | |
12 DownloadCreateInfo::DownloadCreateInfo(const FilePath& path, | |
13 const GURL& url, | |
14 const base::Time& start_time, | |
15 int64 received_bytes, | |
16 int64 total_bytes, | |
17 int32 state, | |
18 int32 download_id, | |
19 bool has_user_gesture) | |
20 : path(path), | |
21 url_chain(1, url), | |
22 path_uniquifier(0), | |
23 start_time(start_time), | |
24 received_bytes(received_bytes), | |
25 total_bytes(total_bytes), | |
26 state(state), | |
27 download_id(download_id), | |
28 has_user_gesture(has_user_gesture), | |
29 db_handle(0), | |
30 prompt_user_for_save_location(false), | |
31 is_extension_install(false) { | |
32 } | |
33 | |
34 DownloadCreateInfo::DownloadCreateInfo() | |
35 : path_uniquifier(0), | |
36 received_bytes(0), | |
37 total_bytes(0), | |
38 state(-1), | |
39 download_id(-1), | |
40 has_user_gesture(false), | |
41 db_handle(0), | |
42 prompt_user_for_save_location(false), | |
43 is_extension_install(false) { | |
44 } | |
45 | |
46 DownloadCreateInfo::~DownloadCreateInfo() { | |
47 } | |
48 | |
49 std::string DownloadCreateInfo::DebugString() const { | |
50 return base::StringPrintf("{" | |
51 " download_id = %d" | |
52 " url = \"%s\"" | |
53 " path = \"%" PRFilePath "\"" | |
54 " received_bytes = %" PRId64 | |
55 " total_bytes = %" PRId64 | |
56 " request_handle = %s" | |
57 " prompt_user_for_save_location = %c" | |
58 " }", | |
59 download_id, | |
60 url().spec().c_str(), | |
61 path.value().c_str(), | |
62 received_bytes, | |
63 total_bytes, | |
64 request_handle.DebugString().c_str(), | |
65 prompt_user_for_save_location ? 'T' : 'F'); | |
66 } | |
67 | |
68 const GURL& DownloadCreateInfo::url() const { | |
69 return url_chain.empty() ? GURL::EmptyGURL() : url_chain.back(); | |
70 } | |
OLD | NEW |