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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 269 |
270 DownloadManagerDelegate* delegate() const { return delegate_; } | 270 DownloadManagerDelegate* delegate() const { return delegate_; } |
271 | 271 |
272 private: | 272 private: |
273 typedef std::set<DownloadItem*> DownloadSet; | 273 typedef std::set<DownloadItem*> DownloadSet; |
274 typedef base::hash_map<int64, DownloadItem*> DownloadMap; | 274 typedef base::hash_map<int64, DownloadItem*> DownloadMap; |
275 | 275 |
276 // For testing. | 276 // For testing. |
277 friend class DownloadManagerTest; | 277 friend class DownloadManagerTest; |
278 friend class MockDownloadManager; | 278 friend class MockDownloadManager; |
| 279 friend class DownloadTest; |
279 | 280 |
280 friend class base::RefCountedThreadSafe<DownloadManager, | 281 friend class base::RefCountedThreadSafe<DownloadManager, |
281 BrowserThread::DeleteOnUIThread>; | 282 BrowserThread::DeleteOnUIThread>; |
282 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | 283 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |
283 friend class DeleteTask<DownloadManager>; | 284 friend class DeleteTask<DownloadManager>; |
284 | 285 |
| 286 void set_delegate(DownloadManagerDelegate* delegate) { delegate_ = delegate; } |
| 287 |
285 virtual ~DownloadManager(); | 288 virtual ~DownloadManager(); |
286 | 289 |
287 // Called on the FILE thread to check the existence of a downloaded file. | 290 // Called on the FILE thread to check the existence of a downloaded file. |
288 void CheckForFileRemovalOnFileThread(int64 db_handle, const FilePath& path); | 291 void CheckForFileRemovalOnFileThread(int64 db_handle, const FilePath& path); |
289 | 292 |
290 // Called on the UI thread if the FILE thread detects the removal of | 293 // Called on the UI thread if the FILE thread detects the removal of |
291 // the downloaded file. The UI thread updates the state of the file | 294 // the downloaded file. The UI thread updates the state of the file |
292 // and then notifies this update to the file's observer. | 295 // and then notifies this update to the file's observer. |
293 void OnFileRemovalDetected(int64 db_handle); | 296 void OnFileRemovalDetected(int64 db_handle); |
294 | 297 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 DownloadManagerDelegate* delegate_; | 399 DownloadManagerDelegate* delegate_; |
397 | 400 |
398 // TODO(rdsmith): Remove when http://crbug.com/84508 is fixed. | 401 // TODO(rdsmith): Remove when http://crbug.com/84508 is fixed. |
399 // For debugging only. | 402 // For debugging only. |
400 int64 largest_db_handle_in_history_; | 403 int64 largest_db_handle_in_history_; |
401 | 404 |
402 DISALLOW_COPY_AND_ASSIGN(DownloadManager); | 405 DISALLOW_COPY_AND_ASSIGN(DownloadManager); |
403 }; | 406 }; |
404 | 407 |
405 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ | 408 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ |
OLD | NEW |