| 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 // Cancels the off-thread aspects of the download. | 331 // Cancels the off-thread aspects of the download. |
| 332 // TODO(rdsmith): This should be private and only called from | 332 // TODO(rdsmith): This should be private and only called from |
| 333 // DownloadItem::Cancel/Interrupt; it isn't now because we can't | 333 // DownloadItem::Cancel/Interrupt; it isn't now because we can't |
| 334 // call those functions from | 334 // call those functions from |
| 335 // DownloadManager::FileSelectionCancelled() without doing some | 335 // DownloadManager::FileSelectionCancelled() without doing some |
| 336 // rewrites of the DownloadManager queues. | 336 // rewrites of the DownloadManager queues. |
| 337 void OffThreadCancel(DownloadFileManager* file_manager); | 337 void OffThreadCancel(DownloadFileManager* file_manager); |
| 338 | 338 |
| 339 std::string DebugString(bool verbose) const; | 339 std::string DebugString(bool verbose) const; |
| 340 | 340 |
| 341 #ifdef UNIT_TEST | 341 void MockDownloadOpenForTesting() { open_enabled_ = false; } |
| 342 // Mock opening downloads (for testing only). | |
| 343 void TestMockDownloadOpen() { open_enabled_ = false; } | |
| 344 #endif | |
| 345 | 342 |
| 346 private: | 343 private: |
| 347 // Construction common to all constructors. |active| should be true for new | 344 // Construction common to all constructors. |active| should be true for new |
| 348 // downloads and false for downloads from the history. | 345 // downloads and false for downloads from the history. |
| 349 void Init(bool active); | 346 void Init(bool active); |
| 350 | 347 |
| 351 // Internal helper for maintaining consistent received and total sizes. | 348 // Internal helper for maintaining consistent received and total sizes. |
| 352 void UpdateSize(int64 size); | 349 void UpdateSize(int64 size); |
| 353 | 350 |
| 354 // Called when the entire download operation (including renaming etc) | 351 // Called when the entire download operation (including renaming etc) |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 // only. | 478 // only. |
| 482 bool open_enabled_; | 479 bool open_enabled_; |
| 483 | 480 |
| 484 // Did the delegate delay calling Complete on this download? | 481 // Did the delegate delay calling Complete on this download? |
| 485 bool delegate_delayed_complete_; | 482 bool delegate_delayed_complete_; |
| 486 | 483 |
| 487 DISALLOW_COPY_AND_ASSIGN(DownloadItem); | 484 DISALLOW_COPY_AND_ASSIGN(DownloadItem); |
| 488 }; | 485 }; |
| 489 | 486 |
| 490 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ | 487 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ |
| OLD | NEW |