| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 : public base::RefCountedThreadSafe<DownloadManager, | 59 : public base::RefCountedThreadSafe<DownloadManager, |
| 60 ChromeThread::DeleteOnUIThread>, | 60 ChromeThread::DeleteOnUIThread>, |
| 61 public SelectFileDialog::Listener { | 61 public SelectFileDialog::Listener { |
| 62 // For testing. | 62 // For testing. |
| 63 friend class DownloadManagerTest; | 63 friend class DownloadManagerTest; |
| 64 friend class MockDownloadManager; | 64 friend class MockDownloadManager; |
| 65 | 65 |
| 66 public: | 66 public: |
| 67 DownloadManager(); | 67 DownloadManager(); |
| 68 | 68 |
| 69 // Shutdown the download manager. Must be called before destruction. |
| 70 void Shutdown(); |
| 71 |
| 69 // Interface to implement for observers that wish to be informed of changes | 72 // Interface to implement for observers that wish to be informed of changes |
| 70 // to the DownloadManager's collection of downloads. | 73 // to the DownloadManager's collection of downloads. |
| 71 class Observer { | 74 class Observer { |
| 72 public: | 75 public: |
| 73 // New or deleted download, observers should query us for the current set | 76 // New or deleted download, observers should query us for the current set |
| 74 // of downloads. | 77 // of downloads. |
| 75 virtual void ModelChanged() = 0; | 78 virtual void ModelChanged() = 0; |
| 76 | 79 |
| 77 // Called when the DownloadManager is being destroyed to prevent Observers | 80 // Called when the DownloadManager is being destroyed to prevent Observers |
| 78 // from calling back to a stale pointer. | 81 // from calling back to a stale pointer. |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 friend class ChromeThread; | 222 friend class ChromeThread; |
| 220 friend class DeleteTask<DownloadManager>; | 223 friend class DeleteTask<DownloadManager>; |
| 221 friend class OtherDownloadManagerObserver; | 224 friend class OtherDownloadManagerObserver; |
| 222 | 225 |
| 223 ~DownloadManager(); | 226 ~DownloadManager(); |
| 224 | 227 |
| 225 // Opens a download via the Windows shell. | 228 // Opens a download via the Windows shell. |
| 226 void OpenDownloadInShell(DownloadItem* download, | 229 void OpenDownloadInShell(DownloadItem* download, |
| 227 gfx::NativeView parent_window); | 230 gfx::NativeView parent_window); |
| 228 | 231 |
| 229 // Shutdown the download manager. This call is needed only after Init. | |
| 230 void Shutdown(); | |
| 231 | |
| 232 // Called on the download thread to check whether the suggested file path | 232 // Called on the download thread to check whether the suggested file path |
| 233 // exists. We don't check if the file exists on the UI thread to avoid UI | 233 // exists. We don't check if the file exists on the UI thread to avoid UI |
| 234 // stalls from interacting with the file system. | 234 // stalls from interacting with the file system. |
| 235 void CheckIfSuggestedPathExists(DownloadCreateInfo* info); | 235 void CheckIfSuggestedPathExists(DownloadCreateInfo* info); |
| 236 | 236 |
| 237 // Called on the UI thread once the DownloadManager has determined whether the | 237 // Called on the UI thread once the DownloadManager has determined whether the |
| 238 // suggested file path exists. | 238 // suggested file path exists. |
| 239 void OnPathExistenceAvailable(DownloadCreateInfo* info); | 239 void OnPathExistenceAvailable(DownloadCreateInfo* info); |
| 240 | 240 |
| 241 // Called back after a target path for the file to be downloaded to has been | 241 // Called back after a target path for the file to be downloaded to has been |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 // The "Save As" dialog box used to ask the user where a file should be | 351 // The "Save As" dialog box used to ask the user where a file should be |
| 352 // saved. | 352 // saved. |
| 353 scoped_refptr<SelectFileDialog> select_file_dialog_; | 353 scoped_refptr<SelectFileDialog> select_file_dialog_; |
| 354 | 354 |
| 355 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; | 355 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; |
| 356 | 356 |
| 357 DISALLOW_COPY_AND_ASSIGN(DownloadManager); | 357 DISALLOW_COPY_AND_ASSIGN(DownloadManager); |
| 358 }; | 358 }; |
| 359 | 359 |
| 360 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ | 360 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ |
| OLD | NEW |