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 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CREATE_INFO_H_ | |
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CREATE_INFO_H_ | |
7 #pragma once | |
8 | |
9 #include <string> | |
10 #include <vector> | |
11 | |
12 #include "base/basictypes.h" | |
13 #include "base/file_path.h" | |
14 #include "base/time.h" | |
15 #include "chrome/browser/download/download_file.h" | |
16 #include "chrome/browser/download/download_process_handle.h" | |
17 #include "googleurl/src/gurl.h" | |
18 | |
19 // Used for informing the download database of a new download, where we don't | |
Randy Smith (Not in Mondays)
2011/05/20 19:49:29
I think this comment is out of date. Maybe "Used
ahendrickson
2011/05/20 22:12:45
Modified.
| |
20 // want to pass DownloadItems between threads. | |
21 struct DownloadCreateInfo { | |
22 DownloadCreateInfo(const FilePath& path, | |
23 const GURL& url, | |
24 const base::Time& start_time, | |
25 int64 received_bytes, | |
26 int64 total_bytes, | |
27 int32 state, | |
28 int32 download_id, | |
29 bool has_user_gesture); | |
30 DownloadCreateInfo(); | |
31 ~DownloadCreateInfo(); | |
32 | |
33 // Returns true if the download is dangerous. | |
34 bool IsDangerous() const; | |
Randy Smith (Not in Mondays)
2011/05/20 19:49:29
Do we need this anymore?
ahendrickson
2011/05/20 22:12:45
Removed.
| |
35 | |
36 std::string DebugString() const; | |
37 | |
38 // The URL from which we are downloading. This is the final URL after any | |
39 // redirection by the server for |url_chain|. | |
40 const GURL& url() const; | |
41 | |
42 // DownloadItem fields | |
43 // The path where we want to save the download file. | |
44 FilePath path; | |
45 | |
46 // The chain of redirects that leading up to and including the final URL. | |
47 std::vector<GURL> url_chain; | |
48 | |
49 // The URL that referred us. | |
50 GURL referrer_url; | |
51 | |
52 // The default path for the download (may be overridden). | |
53 FilePath suggested_path; | |
54 | |
55 // A number that should be added to the suggested path to make it unique. | |
56 // 0 means no number should be appended. Not actually stored in the db. | |
57 int path_uniquifier; | |
58 | |
59 // The time when the download started. | |
60 base::Time start_time; | |
61 | |
62 // The number of bytes that have been received. | |
63 int64 received_bytes; | |
64 | |
65 // The total download size. | |
66 int64 total_bytes; | |
67 | |
68 // The current state of the download. | |
69 int32 state; | |
70 | |
71 // The (per-session) ID of the download. | |
72 int32 download_id; | |
73 | |
74 // True if the download was initiated by user action. | |
75 bool has_user_gesture; | |
76 | |
77 // The handle to the process information. Used for operations outside the | |
78 // download system. | |
79 DownloadProcessHandle process_handle; | |
80 | |
81 // The handle of the download in the history database. | |
82 int64 db_handle; | |
83 | |
84 // The content-disposition string from the response header. | |
85 std::string content_disposition; | |
86 | |
87 // The mime type string from the response header (may be overridden). | |
88 std::string mime_type; | |
89 | |
90 // The value of the content type header sent with the downloaded item. It | |
91 // may be different from |mime_type|, which may be set based on heuristics | |
92 // which may look at the file extension and first few bytes of the file. | |
93 std::string original_mime_type; | |
94 | |
95 // True if we should display the 'save as...' UI and prompt the user | |
96 // for the download location. | |
97 // False if the UI should be supressed and the download performed to the | |
98 // default location. | |
99 bool prompt_user_for_save_location; | |
100 | |
101 // Whether this download file is potentially dangerous (ex: exe, dll, ...). | |
102 bool is_dangerous_file; | |
103 | |
104 // If safebrowsing believes this URL leads to malware. | |
105 bool is_dangerous_url; | |
106 | |
107 // The original name for a dangerous download. | |
108 FilePath original_name; | |
109 | |
110 // Whether this download is for extension install or not. | |
111 bool is_extension_install; | |
112 | |
113 // The charset of the referring page where the download request comes from. | |
114 // It's used to construct a suggested filename. | |
115 std::string referrer_charset; | |
116 | |
117 // The download file save info. | |
118 DownloadSaveInfo save_info; | |
119 }; | |
120 | |
121 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CREATE_INFO_H_ | |
OLD | NEW |