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. | |
298 void SetDownloadManagerDelegate(DownloadManagerDelegate* delegate); | |
jam
2011/10/10 18:19:33
nit: please add a "ForTesting" suffix. we have pre
Miranda Callahan
2011/10/11 14:53:03
Whoa, I didn't know that we had a presubmit check
Randy Smith (Not in Mondays)
2011/10/11 18:24:43
Can I convince you to rescind this request? The p
jam
2011/10/11 19:31:13
sure, sounds reasonable. ideally, the presubmit ch
| |
299 | |
297 private: | 300 private: |
298 typedef std::set<DownloadItem*> DownloadSet; | 301 typedef std::set<DownloadItem*> DownloadSet; |
299 typedef base::hash_map<int64, DownloadItem*> DownloadMap; | 302 typedef base::hash_map<int64, DownloadItem*> DownloadMap; |
300 | 303 |
301 // For testing. | 304 // For testing. |
302 friend class DownloadManagerTest; | 305 friend class DownloadManagerTest; |
306 friend class DownloadTest; | |
303 friend class MockDownloadManager; | 307 friend class MockDownloadManager; |
304 friend class DownloadTest; | |
305 | 308 |
306 friend class base::RefCountedThreadSafe<DownloadManager, | 309 friend class base::RefCountedThreadSafe<DownloadManager, |
307 BrowserThread::DeleteOnUIThread>; | 310 BrowserThread::DeleteOnUIThread>; |
308 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | 311 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |
309 friend class DeleteTask<DownloadManager>; | 312 friend class DeleteTask<DownloadManager>; |
310 | 313 |
311 void set_delegate(DownloadManagerDelegate* delegate) { delegate_ = delegate; } | |
312 | |
313 virtual ~DownloadManager(); | 314 virtual ~DownloadManager(); |
314 | 315 |
315 // Called on the FILE thread to check the existence of a downloaded file. | 316 // Called on the FILE thread to check the existence of a downloaded file. |
316 void CheckForFileRemovalOnFileThread(int64 db_handle, const FilePath& path); | 317 void CheckForFileRemovalOnFileThread(int64 db_handle, const FilePath& path); |
317 | 318 |
318 // Called on the UI thread if the FILE thread detects the removal of | 319 // 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 | 320 // the downloaded file. The UI thread updates the state of the file |
320 // and then notifies this update to the file's observer. | 321 // and then notifies this update to the file's observer. |
321 void OnFileRemovalDetected(int64 db_handle); | 322 void OnFileRemovalDetected(int64 db_handle); |
322 | 323 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
427 DownloadManagerDelegate* delegate_; | 428 DownloadManagerDelegate* delegate_; |
428 | 429 |
429 // TODO(rdsmith): Remove when http://crbug.com/85408 is fixed. | 430 // TODO(rdsmith): Remove when http://crbug.com/85408 is fixed. |
430 // For debugging only. | 431 // For debugging only. |
431 int64 largest_db_handle_in_history_; | 432 int64 largest_db_handle_in_history_; |
432 | 433 |
433 DISALLOW_COPY_AND_ASSIGN(DownloadManager); | 434 DISALLOW_COPY_AND_ASSIGN(DownloadManager); |
434 }; | 435 }; |
435 | 436 |
436 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ | 437 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ |
OLD | NEW |