Chromium Code Reviews| 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 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 virtual void DownloadUrl( | 69 virtual void DownloadUrl( |
| 70 scoped_ptr<content::DownloadUrlParameters> params) OVERRIDE; | 70 scoped_ptr<content::DownloadUrlParameters> params) OVERRIDE; |
| 71 virtual void AddObserver(Observer* observer) OVERRIDE; | 71 virtual void AddObserver(Observer* observer) OVERRIDE; |
| 72 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 72 virtual void RemoveObserver(Observer* observer) OVERRIDE; |
| 73 virtual void OnPersistentStoreQueryComplete( | 73 virtual void OnPersistentStoreQueryComplete( |
| 74 std::vector<content::DownloadPersistentStoreInfo>* entries) OVERRIDE; | 74 std::vector<content::DownloadPersistentStoreInfo>* entries) OVERRIDE; |
| 75 virtual void OnItemAddedToPersistentStore(int32 download_id, | 75 virtual void OnItemAddedToPersistentStore(int32 download_id, |
| 76 int64 db_handle) OVERRIDE; | 76 int64 db_handle) OVERRIDE; |
| 77 virtual int InProgressCount() const OVERRIDE; | 77 virtual int InProgressCount() const OVERRIDE; |
| 78 virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; | 78 virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; |
| 79 virtual FilePath LastDownloadPath() OVERRIDE; | |
| 80 virtual net::BoundNetLog CreateDownloadItem( | 79 virtual net::BoundNetLog CreateDownloadItem( |
| 81 DownloadCreateInfo* info) OVERRIDE; | 80 DownloadCreateInfo* info) OVERRIDE; |
| 82 virtual content::DownloadItem* CreateSavePackageDownloadItem( | 81 virtual content::DownloadItem* CreateSavePackageDownloadItem( |
| 83 const FilePath& main_file_path, | 82 const FilePath& main_file_path, |
| 84 const GURL& page_url, | 83 const GURL& page_url, |
| 85 bool is_otr, | 84 bool is_otr, |
| 86 const std::string& mime_type, | 85 const std::string& mime_type, |
| 87 content::DownloadItem::Observer* observer) OVERRIDE; | 86 content::DownloadItem::Observer* observer) OVERRIDE; |
| 88 virtual void ClearLastDownloadPath() OVERRIDE; | 87 virtual void ClearTransientState() OVERRIDE; |
| 89 virtual void FileSelected(const FilePath& path, int32 download_id) OVERRIDE; | |
| 90 virtual void FileSelectionCanceled(int32 download_id) OVERRIDE; | |
| 91 virtual void RestartDownload(int32 download_id) OVERRIDE; | |
| 92 virtual void CheckForHistoryFilesRemoval() OVERRIDE; | 88 virtual void CheckForHistoryFilesRemoval() OVERRIDE; |
| 93 virtual content::DownloadItem* GetDownloadItem(int id) OVERRIDE; | 89 virtual content::DownloadItem* GetDownloadItem(int id) OVERRIDE; |
| 94 virtual content::DownloadItem* GetDownload(int id) OVERRIDE; | 90 virtual content::DownloadItem* GetDownload(int id) OVERRIDE; |
| 95 virtual void SavePageDownloadFinished( | 91 virtual void SavePageDownloadFinished( |
| 96 content::DownloadItem* download) OVERRIDE; | 92 content::DownloadItem* download) OVERRIDE; |
| 97 virtual content::DownloadItem* GetActiveDownloadItem(int id) OVERRIDE; | 93 virtual content::DownloadItem* GetActiveDownloadItem(int id) OVERRIDE; |
| 98 virtual bool GenerateFileHash() OVERRIDE; | 94 virtual bool GenerateFileHash() OVERRIDE; |
| 99 | 95 |
| 100 // Overridden from DownloadItemImpl::Delegate | 96 // Overridden from DownloadItemImpl::Delegate |
| 101 // (Note that |GetBrowserContext| are present in both interfaces.) | 97 // (Note that |GetBrowserContext| are present in both interfaces.) |
| 98 virtual DownloadFileManager* GetDownloadFileManager() OVERRIDE; | |
| 102 virtual bool ShouldOpenDownload(content::DownloadItem* item) OVERRIDE; | 99 virtual bool ShouldOpenDownload(content::DownloadItem* item) OVERRIDE; |
| 103 virtual bool ShouldOpenFileBasedOnExtension( | 100 virtual bool ShouldOpenFileBasedOnExtension( |
| 104 const FilePath& path) OVERRIDE; | 101 const FilePath& path) OVERRIDE; |
| 105 virtual void CheckForFileRemoval( | 102 virtual void CheckForFileRemoval( |
| 106 content::DownloadItem* download_item) OVERRIDE; | 103 content::DownloadItem* download_item) OVERRIDE; |
| 107 virtual void MaybeCompleteDownload( | 104 virtual void MaybeCompleteDownload( |
| 108 content::DownloadItem* download) OVERRIDE; | 105 content::DownloadItem* download) OVERRIDE; |
| 109 virtual void DownloadStopped( | 106 virtual void DownloadStopped( |
| 110 content::DownloadItem* download) OVERRIDE; | 107 content::DownloadItem* download) OVERRIDE; |
| 111 virtual void DownloadCompleted( | 108 virtual void DownloadCompleted( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 content::DownloadId GetNextId(); | 144 content::DownloadId GetNextId(); |
| 148 | 145 |
| 149 // Called on the FILE thread to check the existence of a downloaded file. | 146 // Called on the FILE thread to check the existence of a downloaded file. |
| 150 void CheckForFileRemovalOnFileThread(int32 download_id, const FilePath& path); | 147 void CheckForFileRemovalOnFileThread(int32 download_id, const FilePath& path); |
| 151 | 148 |
| 152 // Called on the UI thread if the FILE thread detects the removal of | 149 // Called on the UI thread if the FILE thread detects the removal of |
| 153 // the downloaded file. The UI thread updates the state of the file | 150 // the downloaded file. The UI thread updates the state of the file |
| 154 // and then notifies this update to the file's observer. | 151 // and then notifies this update to the file's observer. |
| 155 void OnFileRemovalDetected(int32 download_id); | 152 void OnFileRemovalDetected(int32 download_id); |
| 156 | 153 |
| 157 // Called back after a target path for the file to be downloaded to has been | |
| 158 // determined, either automatically based on the suggested file name, or by | |
| 159 // the user in a Save As dialog box. | |
| 160 void OnTargetPathAvailable(content::DownloadItem* download); | |
|
Randy Smith (Not in Mondays)
2012/07/05 15:42:32
As noted in dmd.h this interface implies the DMD i
asanka
2012/07/09 21:13:46
Done.
| |
| 161 | |
| 162 // Retrieves the download from the |download_id|. | 154 // Retrieves the download from the |download_id|. |
| 163 // Returns NULL if the download is not active. | 155 // Returns NULL if the download is not active. |
| 164 content::DownloadItem* GetActiveDownload(int32 download_id); | 156 content::DownloadItem* GetActiveDownload(int32 download_id); |
| 165 | 157 |
| 166 // Removes |download| from the active and in progress maps. | 158 // Removes |download| from the active and in progress maps. |
| 167 // Called when the download is cancelled or has an error. | 159 // Called when the download is cancelled or has an error. |
| 168 // Does nothing if the download is not in the history DB. | 160 // Does nothing if the download is not in the history DB. |
| 169 void RemoveFromActiveList(content::DownloadItem* download); | 161 void RemoveFromActiveList(content::DownloadItem* download); |
| 170 | 162 |
| 171 // Inform observers that the model has changed. | 163 // Inform observers that the model has changed. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 | 226 |
| 235 // Observers that want to be notified of changes to the set of downloads. | 227 // Observers that want to be notified of changes to the set of downloads. |
| 236 ObserverList<Observer> observers_; | 228 ObserverList<Observer> observers_; |
| 237 | 229 |
| 238 // The current active browser context. | 230 // The current active browser context. |
| 239 content::BrowserContext* browser_context_; | 231 content::BrowserContext* browser_context_; |
| 240 | 232 |
| 241 // Non-owning pointer for handling file writing on the download_thread_. | 233 // Non-owning pointer for handling file writing on the download_thread_. |
| 242 DownloadFileManager* file_manager_; | 234 DownloadFileManager* file_manager_; |
| 243 | 235 |
| 244 // The user's last choice for download directory. This is only used when the | |
| 245 // user wants us to prompt for a save location for each download. | |
| 246 FilePath last_download_path_; | |
| 247 | |
| 248 // Allows an embedder to control behavior. Guaranteed to outlive this object. | 236 // Allows an embedder to control behavior. Guaranteed to outlive this object. |
| 249 content::DownloadManagerDelegate* delegate_; | 237 content::DownloadManagerDelegate* delegate_; |
| 250 | 238 |
| 251 net::NetLog* net_log_; | 239 net::NetLog* net_log_; |
| 252 | 240 |
| 253 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); | 241 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); |
| 254 }; | 242 }; |
| 255 | 243 |
| 256 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 244 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
| OLD | NEW |