| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // deleted is returned back to the caller. | 146 // deleted is returned back to the caller. |
| 147 int RemoveDownloads(const base::Time remove_begin); | 147 int RemoveDownloads(const base::Time remove_begin); |
| 148 | 148 |
| 149 // Remove all downloads will delete all downloads. The number of downloads | 149 // Remove all downloads will delete all downloads. The number of downloads |
| 150 // deleted is returned back to the caller. | 150 // deleted is returned back to the caller. |
| 151 int RemoveAllDownloads(); | 151 int RemoveAllDownloads(); |
| 152 | 152 |
| 153 // Remove the download with id |download_id| from |active_downloads_|. | 153 // Remove the download with id |download_id| from |active_downloads_|. |
| 154 void RemoveFromActiveList(int32 download_id); | 154 void RemoveFromActiveList(int32 download_id); |
| 155 | 155 |
| 156 // Add DownloadItem to history, validate |db_handle| and store |
| 157 // it in the DownloadItem. |
| 158 void AddDownloadItemToHistory(DownloadItem* item, int64 db_handle); |
| 159 |
| 156 // Called when a Save Page As download is started. Transfers ownership | 160 // Called when a Save Page As download is started. Transfers ownership |
| 157 // of |download_item| to the DownloadManager. | 161 // of |download_item| to the DownloadManager. |
| 158 void SavePageAsDownloadStarted(DownloadItem* download_item); | 162 void SavePageAsDownloadStarted(DownloadItem* download_item); |
| 159 | 163 |
| 160 // Download the object at the URL. Used in cases such as "Save Link As..." | 164 // Download the object at the URL. Used in cases such as "Save Link As..." |
| 161 void DownloadUrl(const GURL& url, | 165 void DownloadUrl(const GURL& url, |
| 162 const GURL& referrer, | 166 const GURL& referrer, |
| 163 const std::string& referrer_encoding, | 167 const std::string& referrer_encoding, |
| 164 TabContents* tab_contents); | 168 TabContents* tab_contents); |
| 165 | 169 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 virtual void FileSelected(const FilePath& path, int index, void* params); | 222 virtual void FileSelected(const FilePath& path, int index, void* params); |
| 219 virtual void FileSelectionCanceled(void* params); | 223 virtual void FileSelectionCanceled(void* params); |
| 220 | 224 |
| 221 // Called when the user has validated the download of a dangerous file. | 225 // Called when the user has validated the download of a dangerous file. |
| 222 void DangerousDownloadValidated(DownloadItem* download); | 226 void DangerousDownloadValidated(DownloadItem* download); |
| 223 | 227 |
| 224 private: | 228 private: |
| 225 // For testing. | 229 // For testing. |
| 226 friend class DownloadManagerTest; | 230 friend class DownloadManagerTest; |
| 227 friend class MockDownloadManager; | 231 friend class MockDownloadManager; |
| 232 friend class SavePageBrowserTest; |
| 228 | 233 |
| 229 // This class is used to let an incognito DownloadManager observe changes to | 234 // This class is used to let an incognito DownloadManager observe changes to |
| 230 // a normal DownloadManager, to propagate ModelChanged() calls from the parent | 235 // a normal DownloadManager, to propagate ModelChanged() calls from the parent |
| 231 // DownloadManager to the observers of the incognito DownloadManager. | 236 // DownloadManager to the observers of the incognito DownloadManager. |
| 232 class OtherDownloadManagerObserver : public Observer { | 237 class OtherDownloadManagerObserver : public Observer { |
| 233 public: | 238 public: |
| 234 explicit OtherDownloadManagerObserver( | 239 explicit OtherDownloadManagerObserver( |
| 235 DownloadManager* observing_download_manager); | 240 DownloadManager* observing_download_manager); |
| 236 virtual ~OtherDownloadManagerObserver(); | 241 virtual ~OtherDownloadManagerObserver(); |
| 237 | 242 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 // The "Save As" dialog box used to ask the user where a file should be | 388 // The "Save As" dialog box used to ask the user where a file should be |
| 384 // saved. | 389 // saved. |
| 385 scoped_refptr<SelectFileDialog> select_file_dialog_; | 390 scoped_refptr<SelectFileDialog> select_file_dialog_; |
| 386 | 391 |
| 387 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; | 392 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; |
| 388 | 393 |
| 389 DISALLOW_COPY_AND_ASSIGN(DownloadManager); | 394 DISALLOW_COPY_AND_ASSIGN(DownloadManager); |
| 390 }; | 395 }; |
| 391 | 396 |
| 392 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ | 397 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ |
| OLD | NEW |