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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 287 |
288 // Called when Save Page download is done. | 288 // Called when Save Page download is done. |
289 void SavePageDownloadFinished(DownloadItem* download); | 289 void SavePageDownloadFinished(DownloadItem* download); |
290 | 290 |
291 // Get the download item from the active map. Useful when the item is not | 291 // Get the download item from the active map. Useful when the item is not |
292 // yet in the history map. | 292 // yet in the history map. |
293 DownloadItem* GetActiveDownloadItem(int id); | 293 DownloadItem* GetActiveDownloadItem(int id); |
294 | 294 |
295 DownloadManagerDelegate* delegate() const { return delegate_; } | 295 DownloadManagerDelegate* delegate() const { return delegate_; } |
296 | 296 |
| 297 // For testing only. May be called from tests indirectly (through |
| 298 // other for testing only methods). |
| 299 void SetDownloadManagerDelegate(DownloadManagerDelegate* delegate); |
| 300 |
297 private: | 301 private: |
298 typedef std::set<DownloadItem*> DownloadSet; | 302 typedef std::set<DownloadItem*> DownloadSet; |
299 typedef base::hash_map<int64, DownloadItem*> DownloadMap; | 303 typedef base::hash_map<int64, DownloadItem*> DownloadMap; |
300 | 304 |
301 // For testing. | 305 // For testing. |
302 friend class DownloadManagerTest; | 306 friend class DownloadManagerTest; |
| 307 friend class DownloadTest; |
303 friend class MockDownloadManager; | 308 friend class MockDownloadManager; |
304 friend class DownloadTest; | |
305 | 309 |
306 friend class base::RefCountedThreadSafe<DownloadManager, | 310 friend class base::RefCountedThreadSafe<DownloadManager, |
307 BrowserThread::DeleteOnUIThread>; | 311 BrowserThread::DeleteOnUIThread>; |
308 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | 312 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |
309 friend class DeleteTask<DownloadManager>; | 313 friend class DeleteTask<DownloadManager>; |
310 | 314 |
311 void set_delegate(DownloadManagerDelegate* delegate) { delegate_ = delegate; } | |
312 | |
313 virtual ~DownloadManager(); | 315 virtual ~DownloadManager(); |
314 | 316 |
315 // Called on the FILE thread to check the existence of a downloaded file. | 317 // Called on the FILE thread to check the existence of a downloaded file. |
316 void CheckForFileRemovalOnFileThread(int64 db_handle, const FilePath& path); | 318 void CheckForFileRemovalOnFileThread(int64 db_handle, const FilePath& path); |
317 | 319 |
318 // Called on the UI thread if the FILE thread detects the removal of | 320 // Called on the UI thread if the FILE thread detects the removal of |
319 // the downloaded file. The UI thread updates the state of the file | 321 // the downloaded file. The UI thread updates the state of the file |
320 // and then notifies this update to the file's observer. | 322 // and then notifies this update to the file's observer. |
321 void OnFileRemovalDetected(int64 db_handle); | 323 void OnFileRemovalDetected(int64 db_handle); |
322 | 324 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 DownloadManagerDelegate* delegate_; | 429 DownloadManagerDelegate* delegate_; |
428 | 430 |
429 // TODO(rdsmith): Remove when http://crbug.com/85408 is fixed. | 431 // TODO(rdsmith): Remove when http://crbug.com/85408 is fixed. |
430 // For debugging only. | 432 // For debugging only. |
431 int64 largest_db_handle_in_history_; | 433 int64 largest_db_handle_in_history_; |
432 | 434 |
433 DISALLOW_COPY_AND_ASSIGN(DownloadManager); | 435 DISALLOW_COPY_AND_ASSIGN(DownloadManager); |
434 }; | 436 }; |
435 | 437 |
436 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ | 438 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ |
OLD | NEW |