Chromium Code Reviews| 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 // The DownloadManager object manages the process of downloading, including | 5 // The DownloadManager object manages the process of downloading, including |
| 6 // updates to the history system and providing the information for displaying | 6 // updates to the history system and providing the information for displaying |
| 7 // the downloads view in the Destinations tab. There is one DownloadManager per | 7 // the downloads view in the Destinations tab. There is one DownloadManager per |
| 8 // active profile in Chrome. | 8 // active profile in Chrome. |
| 9 // | 9 // |
| 10 // Download observers: | 10 // Download observers: |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 void CheckDownloadHashDone(int32 download_id, bool is_dangerous_hash); | 259 void CheckDownloadHashDone(int32 download_id, bool is_dangerous_hash); |
| 260 | 260 |
| 261 // Assert the named download item is on the correct queues | 261 // Assert the named download item is on the correct queues |
| 262 // in the DownloadManager. For debugging. | 262 // in the DownloadManager. For debugging. |
| 263 void AssertQueueStateConsistent(DownloadItem* download); | 263 void AssertQueueStateConsistent(DownloadItem* download); |
| 264 | 264 |
| 265 // Get the download item from the history map. Useful after the item has | 265 // Get the download item from the history map. Useful after the item has |
| 266 // been removed from the active map, or was retrieved from the history DB. | 266 // been removed from the active map, or was retrieved from the history DB. |
| 267 DownloadItem* GetDownloadItem(int id); | 267 DownloadItem* GetDownloadItem(int id); |
| 268 | 268 |
| 269 DownloadHistory* download_history() { return download_history_.get(); } | |
|
Randy Smith (Not in Mondays)
2011/07/10 19:37:40
I'm inclined to think that this should be const (t
achuithb
2011/07/13 21:48:16
I made it const (along with some other accessors),
| |
| 270 | |
| 271 // Add a DownloadItem to history_downloads_. | |
| 272 void AddDownloadItemToHistory(DownloadItem* item, int64 db_handle); | |
| 273 | |
| 269 private: | 274 private: |
| 270 // For testing. | 275 // For testing. |
| 271 friend class DownloadManagerTest; | 276 friend class DownloadManagerTest; |
| 272 friend class MockDownloadManager; | 277 friend class MockDownloadManager; |
| 273 | 278 |
| 274 // This class is used to let an incognito DownloadManager observe changes to | 279 // This class is used to let an incognito DownloadManager observe changes to |
| 275 // a normal DownloadManager, to propagate ModelChanged() calls from the parent | 280 // a normal DownloadManager, to propagate ModelChanged() calls from the parent |
| 276 // DownloadManager to the observers of the incognito DownloadManager. | 281 // DownloadManager to the observers of the incognito DownloadManager. |
| 277 class OtherDownloadManagerObserver : public Observer { | 282 class OtherDownloadManagerObserver : public Observer { |
| 278 public: | 283 public: |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 345 void NotifyModelChanged(); | 350 void NotifyModelChanged(); |
| 346 | 351 |
| 347 // Get the download item from the active map. Useful when the item is not | 352 // Get the download item from the active map. Useful when the item is not |
| 348 // yet in the history map. | 353 // yet in the history map. |
| 349 DownloadItem* GetActiveDownloadItem(int id); | 354 DownloadItem* GetActiveDownloadItem(int id); |
| 350 | 355 |
| 351 // Debugging routine to confirm relationship between below | 356 // Debugging routine to confirm relationship between below |
| 352 // containers; no-op if NDEBUG. | 357 // containers; no-op if NDEBUG. |
| 353 void AssertContainersConsistent() const; | 358 void AssertContainersConsistent() const; |
| 354 | 359 |
| 355 // Add a DownloadItem to history_downloads_. | |
| 356 void AddDownloadItemToHistory(DownloadItem* item, int64 db_handle); | |
| 357 | |
| 358 // |downloads_| is the owning set for all downloads known to the | 360 // |downloads_| is the owning set for all downloads known to the |
| 359 // DownloadManager. This includes downloads started by the user in | 361 // DownloadManager. This includes downloads started by the user in |
| 360 // this session, downloads initialized from the history system, and | 362 // this session, downloads initialized from the history system, and |
| 361 // "save page as" downloads. All other DownloadItem containers in | 363 // "save page as" downloads. All other DownloadItem containers in |
| 362 // the DownloadManager are maps; they do not own the DownloadItems. | 364 // the DownloadManager are maps; they do not own the DownloadItems. |
| 363 // Note that this is the only place (with any functional implications; | 365 // Note that this is the only place (with any functional implications; |
| 364 // see save_page_as_downloads_ below) that "save page as" downloads are | 366 // see save_page_as_downloads_ below) that "save page as" downloads are |
| 365 // kept, as the DownloadManager's only job is to hold onto those | 367 // kept, as the DownloadManager's only job is to hold onto those |
| 366 // until destruction. | 368 // until destruction. |
| 367 // | 369 // |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 // The "Save As" dialog box used to ask the user where a file should be | 430 // The "Save As" dialog box used to ask the user where a file should be |
| 429 // saved. | 431 // saved. |
| 430 scoped_refptr<SelectFileDialog> select_file_dialog_; | 432 scoped_refptr<SelectFileDialog> select_file_dialog_; |
| 431 | 433 |
| 432 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; | 434 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; |
| 433 | 435 |
| 434 DISALLOW_COPY_AND_ASSIGN(DownloadManager); | 436 DISALLOW_COPY_AND_ASSIGN(DownloadManager); |
| 435 }; | 437 }; |
| 436 | 438 |
| 437 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ | 439 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ |
| OLD | NEW |