OLD | NEW |
---|---|
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 // Each download is represented by a DownloadItem, and all DownloadItems | 5 // Each download is represented by a DownloadItem, and all DownloadItems |
6 // are owned by the DownloadManager which maintains a global list of all | 6 // are owned by the DownloadManager which maintains a global list of all |
7 // downloads. DownloadItems are created when a user initiates a download, | 7 // downloads. DownloadItems are created when a user initiates a download, |
8 // and exist for the duration of the browser life time. | 8 // and exist for the duration of the browser life time. |
9 // | 9 // |
10 // Download observers: | 10 // Download observers: |
11 // DownloadItem::Observer: | 11 // DownloadItem::Observer: |
12 // - allows observers to receive notifications about one download from start | 12 // - allows observers to receive notifications about one download from start |
13 // to completion | 13 // to completion |
14 // Use AddObserver() / RemoveObserver() on the appropriate download object to | 14 // Use AddObserver() / RemoveObserver() on the appropriate download object to |
15 // receive state updates. | 15 // receive state updates. |
16 | 16 |
17 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ | 17 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ |
18 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ | 18 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ |
19 #pragma once | 19 #pragma once |
20 | 20 |
21 #include <string> | 21 #include <string> |
22 | 22 |
23 #include "base/basictypes.h" | 23 #include "base/basictypes.h" |
24 #include "base/file_path.h" | 24 #include "base/file_path.h" |
25 #include "base/observer_list.h" | 25 #include "base/observer_list.h" |
26 #include "base/time.h" | 26 #include "base/time.h" |
27 #include "base/timer.h" | 27 #include "base/timer.h" |
28 #include "chrome/browser/download/download_process_handle.h" | 28 #include "chrome/browser/download/download_process_handle.h" |
29 #include "chrome/browser/history/download_history_info.h" | |
29 #include "googleurl/src/gurl.h" | 30 #include "googleurl/src/gurl.h" |
30 | 31 |
32 struct DownloadCreateInfo; | |
31 class DownloadFileManager; | 33 class DownloadFileManager; |
32 class DownloadManager; | 34 class DownloadManager; |
33 struct DownloadCreateInfo; | |
34 | 35 |
35 // One DownloadItem per download. This is the model class that stores all the | 36 // One DownloadItem per download. This is the model class that stores all the |
36 // state for a download. Multiple views, such as a tab's download shelf and the | 37 // state for a download. Multiple views, such as a tab's download shelf and the |
37 // Destination tab's download view, may refer to a given DownloadItem. | 38 // Destination tab's download view, may refer to a given DownloadItem. |
38 // | 39 // |
39 // This is intended to be used only on the UI thread. | 40 // This is intended to be used only on the UI thread. |
40 class DownloadItem { | 41 class DownloadItem { |
41 public: | 42 public: |
42 enum DownloadState { | 43 enum DownloadState { |
43 // Download is actively progressing. | 44 // Download is actively progressing. |
44 IN_PROGRESS, | 45 IN_PROGRESS, |
45 | 46 |
46 // Download is completely finished. | 47 // Download is completely finished. |
47 COMPLETE, | 48 COMPLETE, |
48 | 49 |
49 // Download has been cancelled. | 50 // Download has been cancelled. |
50 CANCELLED, | 51 CANCELLED, |
51 | 52 |
52 // This state indicates that the download item is about to be destroyed, | 53 // This state indicates that the download item is about to be destroyed, |
53 // and observers seeing this state should release all references. | 54 // and observers seeing this state should release all references. |
54 REMOVING, | 55 REMOVING, |
55 | 56 |
56 // This state indicates that the download has been interrupted. | 57 // This state indicates that the download has been interrupted. |
57 INTERRUPTED | 58 INTERRUPTED, |
59 | |
60 // Maximum value. | |
61 MAX_DOWNLOAD_STATE | |
58 }; | 62 }; |
59 | 63 |
60 enum SafetyState { | 64 enum SafetyState { |
61 SAFE = 0, | 65 SAFE = 0, |
62 DANGEROUS, | 66 DANGEROUS, |
63 DANGEROUS_BUT_VALIDATED // Dangerous but the user confirmed the download. | 67 DANGEROUS_BUT_VALIDATED // Dangerous but the user confirmed the download. |
64 }; | 68 }; |
65 | 69 |
66 // This enum is used by histograms. Do not change the ordering or remove | 70 // This enum is used by histograms. Do not change the ordering or remove |
67 // items. | 71 // items. |
(...skipping 11 matching lines...) Expand all Loading... | |
79 // ALWAYS ADD NEW VALUES BEFORE THIS ONE. | 83 // ALWAYS ADD NEW VALUES BEFORE THIS ONE. |
80 DANGEROUS_TYPE_MAX | 84 DANGEROUS_TYPE_MAX |
81 }; | 85 }; |
82 | 86 |
83 // Reason for deleting the download. Passed to Delete(). | 87 // Reason for deleting the download. Passed to Delete(). |
84 enum DeleteReason { | 88 enum DeleteReason { |
85 DELETE_DUE_TO_BROWSER_SHUTDOWN = 0, | 89 DELETE_DUE_TO_BROWSER_SHUTDOWN = 0, |
86 DELETE_DUE_TO_USER_DISCARD | 90 DELETE_DUE_TO_USER_DISCARD |
87 }; | 91 }; |
88 | 92 |
93 // Contains information relating to the process of determining what to do with | |
94 // the download. | |
95 struct DownloadStateInfo { | |
96 DownloadStateInfo(); | |
97 DownloadStateInfo(bool has_user_gesture, | |
98 bool prompt_user_for_save_location); | |
99 DownloadStateInfo(const FilePath& target, | |
100 const FilePath& forced_name, | |
101 bool has_user_gesture, | |
102 bool prompt_user_for_save_location, | |
103 int uniquifier, | |
104 bool dangerous_file, | |
105 bool dangerous_url, | |
106 bool extension_install); | |
107 | |
108 // Indicates if the download is dangerous. | |
109 bool IsDangerous() const; | |
110 | |
111 // The original name for a dangerous download, specified by the request. | |
112 FilePath target_name; | |
113 | |
114 FilePath suggested_path; | |
Paweł Hajdan Jr.
2011/05/20 09:04:42
nit: Some member variables are still not commented
ahendrickson
2011/05/20 18:31:25
Done.
| |
115 | |
116 // A number that should be added to the suggested path to make it unique. | |
117 // 0 means no number should be appended. It is eventually incorporated | |
118 // into the final file name. | |
119 int path_uniquifier; | |
120 | |
121 bool has_user_gesture; | |
122 | |
123 // True if we should display the 'save as...' UI and prompt the user | |
124 // for the download location. | |
125 // False if the UI should be suppressed and the download performed to the | |
126 // default location. | |
127 bool prompt_user_for_save_location; | |
128 | |
129 // Whether this download file is potentially dangerous (ex: exe, dll, ...). | |
130 bool is_dangerous_file; | |
131 | |
132 // If safebrowsing believes this URL leads to malware. | |
133 bool is_dangerous_url; | |
134 | |
135 // Whether this download is for extension install or not. | |
136 bool is_extension_install; | |
137 | |
138 // Whether this download's file name was specified initially. | |
Paweł Hajdan Jr.
2011/05/20 09:04:42
nit: A "whether" applied to FilePath is very cumbe
ahendrickson
2011/05/20 18:31:25
Done.
| |
139 FilePath force_file_name; | |
140 }; | |
141 | |
89 // Interface that observers of a particular download must implement in order | 142 // Interface that observers of a particular download must implement in order |
90 // to receive updates to the download's status. | 143 // to receive updates to the download's status. |
91 class Observer { | 144 class Observer { |
92 public: | 145 public: |
93 virtual void OnDownloadUpdated(DownloadItem* download) = 0; | 146 virtual void OnDownloadUpdated(DownloadItem* download) = 0; |
94 | 147 |
95 // Called when a downloaded file has been opened. | 148 // Called when a downloaded file has been opened. |
96 virtual void OnDownloadOpened(DownloadItem* download) = 0; | 149 virtual void OnDownloadOpened(DownloadItem* download) = 0; |
97 | 150 |
98 protected: | 151 protected: |
99 virtual ~Observer() {} | 152 virtual ~Observer() {} |
100 }; | 153 }; |
101 | 154 |
102 // Constructing from persistent store: | 155 // Constructing from persistent store: |
103 DownloadItem(DownloadManager* download_manager, | 156 DownloadItem(DownloadManager* download_manager, |
104 const DownloadCreateInfo& info); | 157 const DownloadHistoryInfo& info); |
105 | 158 |
106 // Constructing for a regular download: | 159 // Constructing for a regular download: |
107 DownloadItem(DownloadManager* download_manager, | 160 DownloadItem(DownloadManager* download_manager, |
108 const DownloadCreateInfo& info, | 161 const DownloadCreateInfo& info, |
109 bool is_otr); | 162 bool is_otr); |
110 | 163 |
111 // Constructing for the "Save Page As..." feature: | 164 // Constructing for the "Save Page As..." feature: |
112 DownloadItem(DownloadManager* download_manager, | 165 DownloadItem(DownloadManager* download_manager, |
113 const FilePath& path, | 166 const FilePath& path, |
114 const GURL& url, | 167 const GURL& url, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 // not estimate. | 237 // not estimate. |
185 bool TimeRemaining(base::TimeDelta* remaining) const; | 238 bool TimeRemaining(base::TimeDelta* remaining) const; |
186 | 239 |
187 // Simple speed estimate in bytes/s | 240 // Simple speed estimate in bytes/s |
188 int64 CurrentSpeed() const; | 241 int64 CurrentSpeed() const; |
189 | 242 |
190 // Rough percent complete, -1 means we don't know (since we didn't receive a | 243 // Rough percent complete, -1 means we don't know (since we didn't receive a |
191 // total size). | 244 // total size). |
192 int PercentComplete() const; | 245 int PercentComplete() const; |
193 | 246 |
247 // Called when the final path has been determined. | |
248 void OnPathDetermined(const FilePath& path) { history_info_.path = path; } | |
249 | |
194 // Whether or not this download has saved all of its data. | 250 // Whether or not this download has saved all of its data. |
195 bool all_data_saved() const { return all_data_saved_; } | 251 bool all_data_saved() const { return all_data_saved_; } |
196 | 252 |
197 // Update the fields that may have changed in DownloadCreateInfo as a | 253 // Update the fields that may have changed in DownloadStateInfo as a |
198 // result of analyzing the file and figuring out its type, location, etc. | 254 // result of analyzing the file and figuring out its type, location, etc. |
199 // May only be called once. | 255 // May only be called once. |
200 void SetFileCheckResults(const FilePath& path, | 256 void SetFileCheckResults(const DownloadStateInfo& state); |
201 bool is_dangerous_file, | 257 |
202 bool is_dangerous_url, | 258 // Updates the target file. |
203 int path_uniquifier, | 259 void UpdateTarget(); |
204 bool prompt, | |
205 bool is_extension_install, | |
206 const FilePath& original_name); | |
207 | 260 |
208 // Update the download's path, the actual file is renamed on the download | 261 // Update the download's path, the actual file is renamed on the download |
209 // thread. | 262 // thread. |
210 void Rename(const FilePath& full_path); | 263 void Rename(const FilePath& full_path); |
211 | 264 |
212 // Allow the user to temporarily pause a download or resume a paused download. | 265 // Allow the user to temporarily pause a download or resume a paused download. |
213 void TogglePause(); | 266 void TogglePause(); |
214 | 267 |
215 // Called when the download is ready to complete. | 268 // Called when the download is ready to complete. |
216 // This may perform final rename if necessary and will eventually call | 269 // This may perform final rename if necessary and will eventually call |
(...skipping 15 matching lines...) Expand all Loading... | |
232 // Returns true if the download has been cancelled or was interrupted. | 285 // Returns true if the download has been cancelled or was interrupted. |
233 bool IsCancelled() const; | 286 bool IsCancelled() const; |
234 | 287 |
235 // Returns true if the download was interrupted. | 288 // Returns true if the download was interrupted. |
236 bool IsInterrupted() const; | 289 bool IsInterrupted() const; |
237 | 290 |
238 // Returns true if we have all the data and know the final file name. | 291 // Returns true if we have all the data and know the final file name. |
239 bool IsComplete() const; | 292 bool IsComplete() const; |
240 | 293 |
241 // Accessors | 294 // Accessors |
242 DownloadState state() const { return state_; } | 295 DownloadState state() const; |
243 FilePath full_path() const { return full_path_; } | 296 FilePath full_path() const { return history_info_.path; } |
244 void set_path_uniquifier(int uniquifier) { path_uniquifier_ = uniquifier; } | 297 void set_path_uniquifier(int uniquifier) { |
245 const GURL& url() const { return url_chain_.back(); } | 298 manager_state_.path_uniquifier = uniquifier; |
246 const std::vector<GURL>& url_chain() const { return url_chain_; } | 299 } |
247 const GURL& original_url() const { return url_chain_.front(); } | 300 const GURL& GetUrl() const; |
Paweł Hajdan Jr.
2011/05/20 09:04:42
nit: Wouldn't GetURL be more consistent (capitaliz
ahendrickson
2011/05/20 18:31:25
Done.
| |
248 const GURL& referrer_url() const { return referrer_url_; } | 301 const std::vector<GURL>& url_chain() const { return history_info_.url_chain; } |
302 const GURL& original_url() const { return history_info_.url_chain.front(); } | |
303 const GURL& referrer_url() const { return history_info_.referrer_url; } | |
304 std::string content_disposition() const { return content_disposition_; } | |
249 std::string mime_type() const { return mime_type_; } | 305 std::string mime_type() const { return mime_type_; } |
250 std::string original_mime_type() const { return original_mime_type_; } | 306 std::string original_mime_type() const { return original_mime_type_; } |
251 int64 total_bytes() const { return total_bytes_; } | 307 std::string referrer_charset() const { return referrer_charset_; } |
252 void set_total_bytes(int64 total_bytes) { total_bytes_ = total_bytes; } | 308 int64 total_bytes() const { return history_info_.total_bytes; } |
253 int64 received_bytes() const { return received_bytes_; } | 309 void set_total_bytes(int64 total_bytes) { |
254 int32 id() const { return id_; } | 310 history_info_.total_bytes = total_bytes; |
255 base::Time start_time() const { return start_time_; } | 311 } |
256 void set_db_handle(int64 handle) { db_handle_ = handle; } | 312 int64 received_bytes() const { return history_info_.received_bytes; } |
257 int64 db_handle() const { return db_handle_; } | 313 int32 id() const { return history_info_.download_id; } |
314 base::Time start_time() const { return history_info_.start_time; } | |
315 void set_db_handle(int64 handle) { history_info_.db_handle = handle; } | |
316 int64 db_handle() const { return history_info_.db_handle; } | |
258 bool is_paused() const { return is_paused_; } | 317 bool is_paused() const { return is_paused_; } |
259 bool open_when_complete() const { return open_when_complete_; } | 318 bool open_when_complete() const { return open_when_complete_; } |
260 void set_open_when_complete(bool open) { open_when_complete_ = open; } | 319 void set_open_when_complete(bool open) { open_when_complete_ = open; } |
261 SafetyState safety_state() const { return safety_state_; } | 320 SafetyState safety_state() const { return safety_state_; } |
262 void set_safety_state(SafetyState safety_state) { | 321 void set_safety_state(SafetyState safety_state) { |
263 safety_state_ = safety_state; | 322 safety_state_ = safety_state; |
264 } | 323 } |
265 DangerType danger_type() { return danger_type_;} | 324 // Why |safety_state_| is not SAFE. |
325 DangerType CurrentDangerType() const; | |
326 bool IsDangerous() const; | |
327 void MarkUrlDangerous(); | |
328 | |
266 bool auto_opened() { return auto_opened_; } | 329 bool auto_opened() { return auto_opened_; } |
267 FilePath target_name() const { return target_name_; } | 330 FilePath target_name() const { return manager_state_.target_name; } |
268 bool save_as() const { return save_as_; } | 331 bool save_as() const { return manager_state_.prompt_user_for_save_location; } |
269 bool is_otr() const { return is_otr_; } | 332 bool is_otr() const { return is_otr_; } |
270 bool is_extension_install() const { return is_extension_install_; } | 333 bool is_extension_install() const { |
334 return manager_state_.is_extension_install; | |
335 } | |
336 FilePath suggested_path() const { return manager_state_.suggested_path; } | |
271 bool is_temporary() const { return is_temporary_; } | 337 bool is_temporary() const { return is_temporary_; } |
272 void set_opened(bool opened) { opened_ = opened; } | 338 void set_opened(bool opened) { opened_ = opened; } |
273 bool opened() const { return opened_; } | 339 bool opened() const { return opened_; } |
274 | 340 |
341 DownloadHistoryInfo history() const { return history_info_; } | |
Paweł Hajdan Jr.
2011/05/20 09:04:42
nit: history_info() please, for consistency.
ahendrickson
2011/05/20 18:31:25
Done.
| |
342 DownloadStateInfo manager_state() const { return manager_state_; } | |
275 const DownloadProcessHandle& process_handle() const { | 343 const DownloadProcessHandle& process_handle() const { |
276 return process_handle_; | 344 return process_handle_; |
277 } | 345 } |
278 | 346 |
279 // Returns the final target file path for the download. | 347 // Returns the final target file path for the download. |
280 FilePath GetTargetFilePath() const; | 348 FilePath GetTargetFilePath() const; |
281 | 349 |
282 // Returns the file-name that should be reported to the user, which is | 350 // Returns the file-name that should be reported to the user, which is |
283 // target_name_ possibly with the uniquifier number. | 351 // target_name possibly with the uniquifier number. |
284 FilePath GetFileNameToReportUser() const; | 352 FilePath GetFileNameToReportUser() const; |
285 | 353 |
286 // Returns the user-verified target file path for the download. | 354 // Returns the user-verified target file path for the download. |
287 // This returns the same path as GetTargetFilePath() for safe downloads | 355 // This returns the same path as GetTargetFilePath() for safe downloads |
288 // but does not for dangerous downloads until the name is verified. | 356 // but does not for dangerous downloads until the name is verified. |
289 FilePath GetUserVerifiedFilePath() const; | 357 FilePath GetUserVerifiedFilePath() const; |
290 | 358 |
291 // Returns true if the current file name is not the final target name yet. | 359 // Returns true if the current file name is not the final target name yet. |
292 bool NeedsRename() const { | 360 bool NeedsRename() const { |
293 return target_name_ != full_path_.BaseName(); | 361 return manager_state_.target_name != history_info_.path.BaseName(); |
294 } | 362 } |
295 | 363 |
296 std::string DebugString(bool verbose) const; | 364 std::string DebugString(bool verbose) const; |
297 | 365 |
298 private: | 366 private: |
299 void Init(bool start_timer); | 367 void Init(bool start_timer); |
300 | 368 |
301 // Internal helper for maintaining consistent received and total sizes. | 369 // Internal helper for maintaining consistent received and total sizes. |
302 void UpdateSize(int64 size); | 370 void UpdateSize(int64 size); |
303 | 371 |
304 // Called when the entire download operation (including renaming etc) | 372 // Called when the entire download operation (including renaming etc) |
305 // is completed. | 373 // is completed. |
306 void Completed(); | 374 void Completed(); |
307 | 375 |
308 // Start/stop sending periodic updates to our observers | 376 // Start/stop sending periodic updates to our observers |
309 void StartProgressTimer(); | 377 void StartProgressTimer(); |
310 void StopProgressTimer(); | 378 void StopProgressTimer(); |
311 | 379 |
312 // Request ID assigned by the ResourceDispatcherHost. | 380 // Information that is saved to the history DB. |
313 int32 id_; | 381 DownloadHistoryInfo history_info_; |
314 | 382 |
315 // Full path to the downloaded or downloading file. | 383 // State information used by the download manager. |
316 FilePath full_path_; | 384 DownloadStateInfo manager_state_; |
317 | 385 |
318 // A number that should be appended to the path to make it unique, or 0 if the | 386 // The handle to the process information. Used for operations outside the |
319 // path should be used as is. | 387 // download system. |
320 int path_uniquifier_; | 388 DownloadProcessHandle process_handle_; |
321 | 389 |
322 // The chain of redirects that leading up to and including the final URL. | 390 // Information from the request. |
323 std::vector<GURL> url_chain_; | 391 // Content-disposition field from the header. |
392 std::string content_disposition_; | |
324 | 393 |
325 // The URL of the page that initiated the download. | 394 // Mime-type from the header. Subject to change. |
326 GURL referrer_url_; | |
327 | |
328 // The mimetype of the download | |
329 std::string mime_type_; | 395 std::string mime_type_; |
Paweł Hajdan Jr.
2011/05/20 09:04:42
Now mime_type is a part of the structs we have. Ca
ahendrickson
2011/05/20 18:31:25
It is? Other than DownloadCreateInfo, where is th
| |
330 | 396 |
331 // The value of the content type header received when downloading | 397 // The value of the content type header sent with the downloaded item. It |
332 // this item. |mime_type_| may be different because of type sniffing. | 398 // may be different from |mime_type_|, which may be set based on heuristics |
399 // which may look at the file extension and first few bytes of the file. | |
333 std::string original_mime_type_; | 400 std::string original_mime_type_; |
334 | 401 |
335 // Total bytes expected | 402 // The charset of the referring page where the download request comes from. |
336 int64 total_bytes_; | 403 // It's used to construct a suggested filename. |
337 | 404 std::string referrer_charset_; |
338 // Current received bytes | |
339 int64 received_bytes_; | |
340 | 405 |
341 // Last error. | 406 // Last error. |
342 int last_os_error_; | 407 int last_os_error_; |
343 | 408 |
344 // Start time for calculating remaining time | 409 // Start time for calculating remaining time |
345 base::TimeTicks start_tick_; | 410 base::TimeTicks start_tick_; |
346 | 411 |
347 // The current state of this download | |
348 DownloadState state_; | |
349 | |
350 // The views of this item in the download shelf and download tab | 412 // The views of this item in the download shelf and download tab |
351 ObserverList<Observer> observers_; | 413 ObserverList<Observer> observers_; |
352 | 414 |
353 // Time the download was started | |
354 base::Time start_time_; | |
355 | |
356 // Our persistent store handle | |
357 int64 db_handle_; | |
358 | |
359 // Timer for regularly updating our observers | 415 // Timer for regularly updating our observers |
360 base::RepeatingTimer<DownloadItem> update_timer_; | 416 base::RepeatingTimer<DownloadItem> update_timer_; |
361 | 417 |
362 // Our owning object | 418 // Our owning object |
363 DownloadManager* download_manager_; | 419 DownloadManager* download_manager_; |
364 | 420 |
365 // In progress downloads may be paused by the user, we note it here | 421 // In progress downloads may be paused by the user, we note it here |
366 bool is_paused_; | 422 bool is_paused_; |
367 | 423 |
368 // A flag for indicating if the download should be opened at completion. | 424 // A flag for indicating if the download should be opened at completion. |
369 bool open_when_complete_; | 425 bool open_when_complete_; |
370 | 426 |
371 // Whether the download is considered potentially safe or dangerous | 427 // Whether the download is considered potentially safe or dangerous |
372 // (executable files are typically considered dangerous). | 428 // (executable files are typically considered dangerous). |
373 SafetyState safety_state_; | 429 SafetyState safety_state_; |
374 | 430 |
375 // Why |safety_state_| is not SAFE. | |
376 DangerType danger_type_; | |
377 | |
378 // Whether the download was auto-opened. We set this rather than using | 431 // Whether the download was auto-opened. We set this rather than using |
379 // an observer as it's frequently possible for the download to be auto opened | 432 // an observer as it's frequently possible for the download to be auto opened |
380 // before the observer is added. | 433 // before the observer is added. |
381 bool auto_opened_; | 434 bool auto_opened_; |
382 | 435 |
383 // Dangerous downloads or ongoing downloads are given temporary names until | |
384 // the user approves them or the downloads finish. | |
385 // This stores their final target name. | |
386 FilePath target_name_; | |
387 | |
388 // The handle to the process information. Used for operations outside the | |
389 // download system. | |
390 DownloadProcessHandle process_handle_; | |
391 | |
392 // True if the item was downloaded as a result of 'save as...' | |
393 bool save_as_; | |
394 | |
395 // True if the download was initiated in an incognito window. | 436 // True if the download was initiated in an incognito window. |
396 bool is_otr_; | 437 bool is_otr_; |
397 | 438 |
398 // True if the item was downloaded for an extension installation. | |
399 bool is_extension_install_; | |
400 | |
401 // True if the item was downloaded temporarily. | 439 // True if the item was downloaded temporarily. |
402 bool is_temporary_; | 440 bool is_temporary_; |
403 | 441 |
404 // True if we've saved all the data for the download. | 442 // True if we've saved all the data for the download. |
405 bool all_data_saved_; | 443 bool all_data_saved_; |
406 | 444 |
407 // Did the user open the item either directly or indirectly (such as by | 445 // Did the user open the item either directly or indirectly (such as by |
408 // setting always open files of this type)? The shelf also sets this field | 446 // setting always open files of this type)? The shelf also sets this field |
409 // when the user closes the shelf before the item has been opened but should | 447 // when the user closes the shelf before the item has been opened but should |
410 // be treated as though the user opened it. | 448 // be treated as though the user opened it. |
411 bool opened_; | 449 bool opened_; |
412 | 450 |
413 DISALLOW_COPY_AND_ASSIGN(DownloadItem); | 451 DISALLOW_COPY_AND_ASSIGN(DownloadItem); |
414 }; | 452 }; |
415 | 453 |
416 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ | 454 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ |
OLD | NEW |