| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 class DownloadFileManager; | 45 class DownloadFileManager; |
| 46 class DownloadManagerTest; | 46 class DownloadManagerTest; |
| 47 class DownloadRequestHandle; | 47 class DownloadRequestHandle; |
| 48 class DownloadStatusUpdater; | 48 class DownloadStatusUpdater; |
| 49 class GURL; | 49 class GURL; |
| 50 class TabContents; | 50 class TabContents; |
| 51 struct DownloadCreateInfo; | 51 struct DownloadCreateInfo; |
| 52 struct DownloadRetrieveInfo; | 52 struct DownloadRetrieveInfo; |
| 53 struct DownloadSaveInfo; | 53 struct DownloadSaveInfo; |
| 54 | 54 |
| 55 namespace net { |
| 56 class NetLog; |
| 57 } // namespace net |
| 58 |
| 55 namespace content { | 59 namespace content { |
| 56 class BrowserContext; | 60 class BrowserContext; |
| 57 class DownloadManagerDelegate; | 61 class DownloadManagerDelegate; |
| 58 class DownloadQuery; | 62 class DownloadQuery; |
| 59 class WebContents; | 63 class WebContents; |
| 60 | 64 |
| 61 // Browser's download manager: manages all downloads and destination view. | 65 // Browser's download manager: manages all downloads and destination view. |
| 62 class CONTENT_EXPORT DownloadManager | 66 class CONTENT_EXPORT DownloadManager |
| 63 : public base::RefCountedThreadSafe<DownloadManager> { | 67 : public base::RefCountedThreadSafe<DownloadManager> { |
| 64 public: | 68 public: |
| 65 virtual ~DownloadManager() {} | 69 virtual ~DownloadManager() {} |
| 66 | 70 |
| 67 static DownloadManager* Create( | 71 static DownloadManager* Create( |
| 68 DownloadManagerDelegate* delegate, | 72 DownloadManagerDelegate* delegate, |
| 69 DownloadStatusUpdater* status_updater); | 73 DownloadStatusUpdater* status_updater, |
| 74 net::NetLog* net_log); |
| 70 | 75 |
| 71 // Shutdown the download manager. Must be called before destruction. | 76 // Shutdown the download manager. Must be called before destruction. |
| 72 virtual void Shutdown() = 0; | 77 virtual void Shutdown() = 0; |
| 73 | 78 |
| 74 // Interface to implement for observers that wish to be informed of changes | 79 // Interface to implement for observers that wish to be informed of changes |
| 75 // to the DownloadManager's collection of downloads. | 80 // to the DownloadManager's collection of downloads. |
| 76 class CONTENT_EXPORT Observer { | 81 class CONTENT_EXPORT Observer { |
| 77 public: | 82 public: |
| 78 // New or deleted download, observers should query us for the current set | 83 // New or deleted download, observers should query us for the current set |
| 79 // of downloads. | 84 // of downloads. |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 | 250 |
| 246 virtual bool GenerateFileHash() = 0; | 251 virtual bool GenerateFileHash() = 0; |
| 247 | 252 |
| 248 virtual content::DownloadManagerDelegate* delegate() const = 0; | 253 virtual content::DownloadManagerDelegate* delegate() const = 0; |
| 249 | 254 |
| 250 // For testing only. May be called from tests indirectly (through | 255 // For testing only. May be called from tests indirectly (through |
| 251 // other for testing only methods). | 256 // other for testing only methods). |
| 252 virtual void SetDownloadManagerDelegate( | 257 virtual void SetDownloadManagerDelegate( |
| 253 content::DownloadManagerDelegate* delegate) = 0; | 258 content::DownloadManagerDelegate* delegate) = 0; |
| 254 | 259 |
| 260 // Get the system net log object. |
| 261 virtual net::NetLog* GetNetLog() = 0; |
| 262 |
| 255 protected: | 263 protected: |
| 256 // These functions are here for unit tests. | 264 // These functions are here for unit tests. |
| 257 | 265 |
| 258 // Called back after a target path for the file to be downloaded to has been | 266 // Called back after a target path for the file to be downloaded to has been |
| 259 // determined, either automatically based on the suggested file name, or by | 267 // determined, either automatically based on the suggested file name, or by |
| 260 // the user in a Save As dialog box. | 268 // the user in a Save As dialog box. |
| 261 virtual void ContinueDownloadWithPath(DownloadItem* download, | 269 virtual void ContinueDownloadWithPath(DownloadItem* download, |
| 262 const FilePath& chosen_file) = 0; | 270 const FilePath& chosen_file) = 0; |
| 263 | 271 |
| 264 // Retrieves the download from the |download_id|. | 272 // Retrieves the download from the |download_id|. |
| 265 // Returns NULL if the download is not active. | 273 // Returns NULL if the download is not active. |
| 266 virtual DownloadItem* GetActiveDownload(int32 download_id) = 0; | 274 virtual DownloadItem* GetActiveDownload(int32 download_id) = 0; |
| 267 | 275 |
| 268 virtual void SetFileManager(DownloadFileManager* file_manager) = 0; | 276 virtual void SetFileManager(DownloadFileManager* file_manager) = 0; |
| 269 | 277 |
| 270 private: | 278 private: |
| 271 // For testing. | 279 // For testing. |
| 272 friend class ::DownloadManagerTest; | 280 friend class ::DownloadManagerTest; |
| 273 | 281 |
| 274 friend class base::RefCountedThreadSafe< | 282 friend class base::RefCountedThreadSafe< |
| 275 DownloadManager, content::BrowserThread::DeleteOnUIThread>; | 283 DownloadManager, content::BrowserThread::DeleteOnUIThread>; |
| 276 friend struct content::BrowserThread::DeleteOnThread< | 284 friend struct content::BrowserThread::DeleteOnThread< |
| 277 content::BrowserThread::UI>; | 285 content::BrowserThread::UI>; |
| 278 friend class base::DeleteHelper<DownloadManager>; | 286 friend class base::DeleteHelper<DownloadManager>; |
| 279 }; | 287 }; |
| 280 | 288 |
| 281 } // namespace content | 289 } // namespace content |
| 282 | 290 |
| 283 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ | 291 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ |
| OLD | NEW |