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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 // Display a new download in the appropriate browser UI. | 197 // Display a new download in the appropriate browser UI. |
198 void ShowDownloadInBrowser(DownloadItem* download); | 198 void ShowDownloadInBrowser(DownloadItem* download); |
199 | 199 |
200 // The number of in progress (including paused) downloads. | 200 // The number of in progress (including paused) downloads. |
201 int in_progress_count() const { | 201 int in_progress_count() const { |
202 return static_cast<int>(in_progress_.size()); | 202 return static_cast<int>(in_progress_.size()); |
203 } | 203 } |
204 | 204 |
205 Profile* profile() { return profile_; } | 205 Profile* profile() { return profile_; } |
206 | 206 |
207 DownloadHistory* download_history() { return download_history_.get(); } | |
208 | |
209 DownloadPrefs* download_prefs() { return download_prefs_.get(); } | 207 DownloadPrefs* download_prefs() { return download_prefs_.get(); } |
210 | 208 |
211 // Creates the download item. Must be called on the UI thread. | 209 // Creates the download item. Must be called on the UI thread. |
212 void CreateDownloadItem(DownloadCreateInfo* info); | 210 void CreateDownloadItem(DownloadCreateInfo* info); |
213 | 211 |
214 // Clears the last download path, used to initialize "save as" dialogs. | 212 // Clears the last download path, used to initialize "save as" dialogs. |
215 void ClearLastDownloadPath(); | 213 void ClearLastDownloadPath(); |
216 | 214 |
217 // Tests if a file type should be opened automatically. | 215 // Tests if a file type should be opened automatically. |
218 bool ShouldOpenFileBasedOnExtension(const FilePath& path) const; | 216 bool ShouldOpenFileBasedOnExtension(const FilePath& path) const; |
(...skipping 11 matching lines...) Expand all Loading... | |
230 // Returns true if this download should show the "dangerous file" warning. | 228 // Returns true if this download should show the "dangerous file" warning. |
231 // Various factors are considered, such as the type of the file, whether a | 229 // Various factors are considered, such as the type of the file, whether a |
232 // user action initiated the download, and whether the user has explicitly | 230 // user action initiated the download, and whether the user has explicitly |
233 // marked the file type as "auto open". | 231 // marked the file type as "auto open". |
234 bool IsDangerous(const DownloadItem& download, | 232 bool IsDangerous(const DownloadItem& download, |
235 const DownloadStateInfo& state); | 233 const DownloadStateInfo& state); |
236 | 234 |
237 // 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. |
238 void DangerousDownloadValidated(DownloadItem* download); | 236 void DangerousDownloadValidated(DownloadItem* download); |
239 | 237 |
238 // Callback function after we check whether the referrer URL has been visited | |
239 // before today. | |
240 void CheckVisitedBeforeDone(int32 download_id, bool visited_before); | |
Randy Smith (Not in Mondays)
2011/05/24 18:28:25
I don't understand the meaning of |visited_before|
Peter Kasting
2011/05/24 20:55:00
I added the word "referrer" to the function and ar
| |
241 | |
240 // Callback function after url is checked with safebrowsing service. | 242 // Callback function after url is checked with safebrowsing service. |
241 void CheckDownloadUrlDone(int32 download_id, bool is_dangerous_url); | 243 void CheckDownloadUrlDone(int32 download_id, bool is_dangerous_url); |
242 | 244 |
245 // Called by both the above CheckXXX() functions, proceeds once both checks | |
246 // have completed. | |
247 void HistoryAndSBChecksMaybeDone(DownloadItem* download); | |
248 | |
243 // Callback function after download file hash is checked with safebrowsing | 249 // Callback function after download file hash is checked with safebrowsing |
244 // service. | 250 // service. |
245 void CheckDownloadHashDone(int32 download_id, bool is_dangerous_hash); | 251 void CheckDownloadHashDone(int32 download_id, bool is_dangerous_hash); |
246 | 252 |
247 private: | 253 private: |
248 // For testing. | 254 // For testing. |
249 friend class DownloadManagerTest; | 255 friend class DownloadManagerTest; |
250 friend class MockDownloadManager; | 256 friend class MockDownloadManager; |
251 | 257 |
252 // This class is used to let an incognito DownloadManager observe changes to | 258 // This class is used to let an incognito DownloadManager observe changes to |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
407 // The "Save As" dialog box used to ask the user where a file should be | 413 // The "Save As" dialog box used to ask the user where a file should be |
408 // saved. | 414 // saved. |
409 scoped_refptr<SelectFileDialog> select_file_dialog_; | 415 scoped_refptr<SelectFileDialog> select_file_dialog_; |
410 | 416 |
411 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; | 417 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; |
412 | 418 |
413 DISALLOW_COPY_AND_ASSIGN(DownloadManager); | 419 DISALLOW_COPY_AND_ASSIGN(DownloadManager); |
414 }; | 420 }; |
415 | 421 |
416 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ | 422 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ |
OLD | NEW |