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: |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 std::string mime_type() const { return mime_type_; } | 273 std::string mime_type() const { return mime_type_; } |
274 std::string original_mime_type() const { return original_mime_type_; } | 274 std::string original_mime_type() const { return original_mime_type_; } |
275 std::string referrer_charset() const { return referrer_charset_; } | 275 std::string referrer_charset() const { return referrer_charset_; } |
276 int64 total_bytes() const { return total_bytes_; } | 276 int64 total_bytes() const { return total_bytes_; } |
277 void set_total_bytes(int64 total_bytes) { | 277 void set_total_bytes(int64 total_bytes) { |
278 total_bytes_ = total_bytes; | 278 total_bytes_ = total_bytes; |
279 } | 279 } |
280 int64 received_bytes() const { return received_bytes_; } | 280 int64 received_bytes() const { return received_bytes_; } |
281 int32 id() const { return download_id_; } | 281 int32 id() const { return download_id_; } |
282 base::Time start_time() const { return start_time_; } | 282 base::Time start_time() const { return start_time_; } |
283 void set_db_handle(int64 handle) { db_handle_ = handle; } | |
284 int64 db_handle() const { return db_handle_; } | |
285 bool is_paused() const { return is_paused_; } | 283 bool is_paused() const { return is_paused_; } |
286 bool open_when_complete() const { return open_when_complete_; } | 284 bool open_when_complete() const { return open_when_complete_; } |
287 void set_open_when_complete(bool open) { open_when_complete_ = open; } | 285 void set_open_when_complete(bool open) { open_when_complete_ = open; } |
288 bool file_externally_removed() const { return file_externally_removed_; } | 286 bool file_externally_removed() const { return file_externally_removed_; } |
289 SafetyState safety_state() const { return safety_state_; } | 287 SafetyState safety_state() const { return safety_state_; } |
290 void set_safety_state(SafetyState safety_state) { | 288 void set_safety_state(SafetyState safety_state) { |
291 safety_state_ = safety_state; | 289 safety_state_ = safety_state; |
292 } | 290 } |
293 // Why |safety_state_| is not SAFE. | 291 // Why |safety_state_| is not SAFE. |
294 DangerType GetDangerType() const; | 292 DangerType GetDangerType() const; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 | 416 |
419 // The current state of this download | 417 // The current state of this download |
420 DownloadState state_; | 418 DownloadState state_; |
421 | 419 |
422 // The views of this item in the download shelf and download tab | 420 // The views of this item in the download shelf and download tab |
423 ObserverList<Observer> observers_; | 421 ObserverList<Observer> observers_; |
424 | 422 |
425 // Time the download was started | 423 // Time the download was started |
426 base::Time start_time_; | 424 base::Time start_time_; |
427 | 425 |
428 // Our persistent store handle | |
429 int64 db_handle_; | |
430 | |
431 // Timer for regularly updating our observers | 426 // Timer for regularly updating our observers |
432 base::RepeatingTimer<DownloadItem> update_timer_; | 427 base::RepeatingTimer<DownloadItem> update_timer_; |
433 | 428 |
434 // Our owning object | 429 // Our owning object |
435 DownloadManager* download_manager_; | 430 DownloadManager* download_manager_; |
436 | 431 |
437 // In progress downloads may be paused by the user, we note it here | 432 // In progress downloads may be paused by the user, we note it here |
438 bool is_paused_; | 433 bool is_paused_; |
439 | 434 |
440 // A flag for indicating if the download should be opened at completion. | 435 // A flag for indicating if the download should be opened at completion. |
(...skipping 30 matching lines...) Expand all Loading... |
471 // only. | 466 // only. |
472 bool open_enabled_; | 467 bool open_enabled_; |
473 | 468 |
474 // DownloadItem observes CRX installs it initiates. | 469 // DownloadItem observes CRX installs it initiates. |
475 NotificationRegistrar registrar_; | 470 NotificationRegistrar registrar_; |
476 | 471 |
477 DISALLOW_COPY_AND_ASSIGN(DownloadItem); | 472 DISALLOW_COPY_AND_ASSIGN(DownloadItem); |
478 }; | 473 }; |
479 | 474 |
480 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ | 475 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ |
OLD | NEW |