| 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 browser context in Chrome. | 8 // active browser context in Chrome. |
| 9 // | 9 // |
| 10 // Download observers: | 10 // Download observers: |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 struct DownloadCreateInfo; | 62 struct DownloadCreateInfo; |
| 63 struct DownloadSaveInfo; | 63 struct DownloadSaveInfo; |
| 64 | 64 |
| 65 namespace content { | 65 namespace content { |
| 66 class BrowserContext; | 66 class BrowserContext; |
| 67 class DownloadManagerDelegate; | 67 class DownloadManagerDelegate; |
| 68 } | 68 } |
| 69 | 69 |
| 70 // Browser's download manager: manages all downloads and destination view. | 70 // Browser's download manager: manages all downloads and destination view. |
| 71 class CONTENT_EXPORT DownloadManager | 71 class CONTENT_EXPORT DownloadManager |
| 72 : public base::RefCountedThreadSafe<DownloadManager, | 72 : public base::RefCountedThreadSafe< |
| 73 BrowserThread::DeleteOnUIThread>, | 73 DownloadManager, content::BrowserThread::DeleteOnUIThread>, |
| 74 public DownloadStatusUpdaterDelegate { | 74 public DownloadStatusUpdaterDelegate { |
| 75 public: | 75 public: |
| 76 DownloadManager(content::DownloadManagerDelegate* delegate, | 76 DownloadManager(content::DownloadManagerDelegate* delegate, |
| 77 DownloadIdFactory* id_factory, | 77 DownloadIdFactory* id_factory, |
| 78 DownloadStatusUpdater* status_updater); | 78 DownloadStatusUpdater* status_updater); |
| 79 | 79 |
| 80 // Shutdown the download manager. Must be called before destruction. | 80 // Shutdown the download manager. Must be called before destruction. |
| 81 void Shutdown(); | 81 void Shutdown(); |
| 82 | 82 |
| 83 // Interface to implement for observers that wish to be informed of changes | 83 // Interface to implement for observers that wish to be informed of changes |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 288 |
| 289 private: | 289 private: |
| 290 typedef std::set<DownloadItem*> DownloadSet; | 290 typedef std::set<DownloadItem*> DownloadSet; |
| 291 typedef base::hash_map<int64, DownloadItem*> DownloadMap; | 291 typedef base::hash_map<int64, DownloadItem*> DownloadMap; |
| 292 | 292 |
| 293 // For testing. | 293 // For testing. |
| 294 friend class DownloadManagerTest; | 294 friend class DownloadManagerTest; |
| 295 friend class DownloadTest; | 295 friend class DownloadTest; |
| 296 friend class MockDownloadManager; | 296 friend class MockDownloadManager; |
| 297 | 297 |
| 298 friend class base::RefCountedThreadSafe<DownloadManager, | 298 friend class base::RefCountedThreadSafe< |
| 299 BrowserThread::DeleteOnUIThread>; | 299 DownloadManager, content::BrowserThread::DeleteOnUIThread>; |
| 300 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | 300 friend struct content::BrowserThread::DeleteOnThread< |
| 301 content::BrowserThread::UI>; |
| 301 friend class DeleteTask<DownloadManager>; | 302 friend class DeleteTask<DownloadManager>; |
| 302 | 303 |
| 303 virtual ~DownloadManager(); | 304 virtual ~DownloadManager(); |
| 304 | 305 |
| 305 // Called on the FILE thread to check the existence of a downloaded file. | 306 // Called on the FILE thread to check the existence of a downloaded file. |
| 306 void CheckForFileRemovalOnFileThread(int64 db_handle, const FilePath& path); | 307 void CheckForFileRemovalOnFileThread(int64 db_handle, const FilePath& path); |
| 307 | 308 |
| 308 // Called on the UI thread if the FILE thread detects the removal of | 309 // Called on the UI thread if the FILE thread detects the removal of |
| 309 // the downloaded file. The UI thread updates the state of the file | 310 // the downloaded file. The UI thread updates the state of the file |
| 310 // and then notifies this update to the file's observer. | 311 // and then notifies this update to the file's observer. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 DownloadIdFactory* id_factory_; | 417 DownloadIdFactory* id_factory_; |
| 417 | 418 |
| 418 // TODO(rdsmith): Remove when http://crbug.com/85408 is fixed. | 419 // TODO(rdsmith): Remove when http://crbug.com/85408 is fixed. |
| 419 // For debugging only. | 420 // For debugging only. |
| 420 int64 largest_db_handle_in_history_; | 421 int64 largest_db_handle_in_history_; |
| 421 | 422 |
| 422 DISALLOW_COPY_AND_ASSIGN(DownloadManager); | 423 DISALLOW_COPY_AND_ASSIGN(DownloadManager); |
| 423 }; | 424 }; |
| 424 | 425 |
| 425 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ | 426 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ |
| OLD | NEW |