Chromium Code Reviews| 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 profile in Chrome. | 8 // active profile in Chrome. |
| 9 // | 9 // |
| 10 // Download observers: | 10 // Download observers: |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 | 63 |
| 64 // Browser's download manager: manages all downloads and destination view. | 64 // Browser's download manager: manages all downloads and destination view. |
| 65 class DownloadManager | 65 class DownloadManager |
| 66 : public base::RefCountedThreadSafe<DownloadManager, | 66 : public base::RefCountedThreadSafe<DownloadManager, |
| 67 BrowserThread::DeleteOnUIThread>, | 67 BrowserThread::DeleteOnUIThread>, |
| 68 public DownloadStatusUpdaterDelegate, | 68 public DownloadStatusUpdaterDelegate, |
| 69 public SelectFileDialog::Listener { | 69 public SelectFileDialog::Listener { |
| 70 public: | 70 public: |
| 71 explicit DownloadManager(DownloadStatusUpdater* status_updater); | 71 explicit DownloadManager(DownloadStatusUpdater* status_updater); |
| 72 | 72 |
| 73 typedef std::vector<std::pair<int64, FilePath> > PathVector; | |
| 74 | |
| 73 // Shutdown the download manager. Must be called before destruction. | 75 // Shutdown the download manager. Must be called before destruction. |
| 74 void Shutdown(); | 76 void Shutdown(); |
| 75 | 77 |
| 76 // Interface to implement for observers that wish to be informed of changes | 78 // Interface to implement for observers that wish to be informed of changes |
| 77 // to the DownloadManager's collection of downloads. | 79 // to the DownloadManager's collection of downloads. |
| 78 class Observer { | 80 class Observer { |
| 79 public: | 81 public: |
| 80 // New or deleted download, observers should query us for the current set | 82 // New or deleted download, observers should query us for the current set |
| 81 // of downloads. | 83 // of downloads. |
| 82 virtual void ModelChanged() = 0; | 84 virtual void ModelChanged() = 0; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 virtual int64 GetReceivedDownloadBytes(); | 228 virtual int64 GetReceivedDownloadBytes(); |
| 227 virtual int64 GetTotalDownloadBytes(); | 229 virtual int64 GetTotalDownloadBytes(); |
| 228 | 230 |
| 229 // Overridden from SelectFileDialog::Listener: | 231 // Overridden from SelectFileDialog::Listener: |
| 230 virtual void FileSelected(const FilePath& path, int index, void* params); | 232 virtual void FileSelected(const FilePath& path, int index, void* params); |
| 231 virtual void FileSelectionCanceled(void* params); | 233 virtual void FileSelectionCanceled(void* params); |
| 232 | 234 |
| 233 // Called when the user has validated the download of a dangerous file. | 235 // Called when the user has validated the download of a dangerous file. |
| 234 void DangerousDownloadValidated(DownloadItem* download); | 236 void DangerousDownloadValidated(DownloadItem* download); |
| 235 | 237 |
| 238 // Check if the path of each downloaded file still exists or not. | |
| 239 void CheckExistingPaths(); | |
|
Paweł Hajdan Jr.
2011/05/10 07:59:46
nit: Would CheckForFilesRemoval (or similar) be a
| |
| 240 void CheckExistingPathsOnFileThread(PathVector existing_paths); | |
|
Paweł Hajdan Jr.
2011/05/10 07:59:46
nit: Why not const PathVector&, here and below?
A
| |
| 241 void OnExistingPathsAvailable(PathVector removed_paths); | |
| 242 | |
| 236 // Callback function after url is checked with safebrowsing service. | 243 // Callback function after url is checked with safebrowsing service. |
| 237 void CheckDownloadUrlDone(DownloadCreateInfo* info, bool is_dangerous_url); | 244 void CheckDownloadUrlDone(DownloadCreateInfo* info, bool is_dangerous_url); |
| 238 | 245 |
| 239 // Callback function after download file hash is checked with safebrowsing | 246 // Callback function after download file hash is checked with safebrowsing |
| 240 // service. | 247 // service. |
| 241 void CheckDownloadHashDone(int32 download_id, bool is_dangerous_hash); | 248 void CheckDownloadHashDone(int32 download_id, bool is_dangerous_hash); |
| 242 | 249 |
| 243 private: | 250 private: |
| 244 // For testing. | 251 // For testing. |
| 245 friend class DownloadManagerTest; | 252 friend class DownloadManagerTest; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 // The "Save As" dialog box used to ask the user where a file should be | 400 // The "Save As" dialog box used to ask the user where a file should be |
| 394 // saved. | 401 // saved. |
| 395 scoped_refptr<SelectFileDialog> select_file_dialog_; | 402 scoped_refptr<SelectFileDialog> select_file_dialog_; |
| 396 | 403 |
| 397 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; | 404 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; |
| 398 | 405 |
| 399 DISALLOW_COPY_AND_ASSIGN(DownloadManager); | 406 DISALLOW_COPY_AND_ASSIGN(DownloadManager); |
| 400 }; | 407 }; |
| 401 | 408 |
| 402 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ | 409 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ |
| OLD | NEW |