| 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 CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 public content::DownloadManagerDelegate, | 44 public content::DownloadManagerDelegate, |
| 45 public content::NotificationObserver { | 45 public content::NotificationObserver { |
| 46 public: | 46 public: |
| 47 explicit ChromeDownloadManagerDelegate(Profile* profile); | 47 explicit ChromeDownloadManagerDelegate(Profile* profile); |
| 48 | 48 |
| 49 void SetDownloadManager(content::DownloadManager* dm); | 49 void SetDownloadManager(content::DownloadManager* dm); |
| 50 | 50 |
| 51 // Returns true if the given item is for an extension download. | 51 // Returns true if the given item is for an extension download. |
| 52 static bool IsExtensionDownload(const content::DownloadItem* item); | 52 static bool IsExtensionDownload(const content::DownloadItem* item); |
| 53 | 53 |
| 54 // Should be called before the first call to ShouldCompleteDownload() to |
| 55 // disable SafeBrowsing checks for |item|. |
| 56 static void DisableSafeBrowsing(content::DownloadItem* item); |
| 57 |
| 54 virtual void Shutdown() OVERRIDE; | 58 virtual void Shutdown() OVERRIDE; |
| 55 virtual content::DownloadId GetNextId() OVERRIDE; | 59 virtual content::DownloadId GetNextId() OVERRIDE; |
| 56 virtual bool ShouldStartDownload(int32 download_id) OVERRIDE; | 60 virtual bool ShouldStartDownload(int32 download_id) OVERRIDE; |
| 57 virtual void ChooseDownloadPath(content::WebContents* web_contents, | 61 virtual void ChooseDownloadPath(content::WebContents* web_contents, |
| 58 const FilePath& suggested_path, | 62 const FilePath& suggested_path, |
| 59 int32 download_id) OVERRIDE; | 63 int32 download_id) OVERRIDE; |
| 60 virtual FilePath GetIntermediatePath(const FilePath& suggested_path) OVERRIDE; | 64 virtual FilePath GetIntermediatePath(const FilePath& suggested_path) OVERRIDE; |
| 61 virtual content::WebContents* | 65 virtual content::WebContents* |
| 62 GetAlternativeWebContentsToNotifyForDownload() OVERRIDE; | 66 GetAlternativeWebContentsToNotifyForDownload() OVERRIDE; |
| 63 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE; | 67 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 76 base::Time remove_begin, | 80 base::Time remove_begin, |
| 77 base::Time remove_end) OVERRIDE; | 81 base::Time remove_end) OVERRIDE; |
| 78 virtual void GetSaveDir(content::WebContents* web_contents, | 82 virtual void GetSaveDir(content::WebContents* web_contents, |
| 79 FilePath* website_save_dir, | 83 FilePath* website_save_dir, |
| 80 FilePath* download_save_dir) OVERRIDE; | 84 FilePath* download_save_dir) OVERRIDE; |
| 81 virtual void ChooseSavePath( | 85 virtual void ChooseSavePath( |
| 82 content::WebContents* web_contents, | 86 content::WebContents* web_contents, |
| 83 const FilePath& suggested_path, | 87 const FilePath& suggested_path, |
| 84 const FilePath::StringType& default_extension, | 88 const FilePath::StringType& default_extension, |
| 85 bool can_save_as_complete, | 89 bool can_save_as_complete, |
| 86 content::SaveFilePathPickedCallback callback) OVERRIDE; | 90 const content::SavePackagePathPickedCallback& callback) OVERRIDE; |
| 87 | 91 |
| 88 DownloadPrefs* download_prefs() { return download_prefs_.get(); } | 92 DownloadPrefs* download_prefs() { return download_prefs_.get(); } |
| 89 DownloadHistory* download_history() { return download_history_.get(); } | 93 DownloadHistory* download_history() { return download_history_.get(); } |
| 90 | 94 |
| 91 protected: | 95 protected: |
| 92 // So that test classes can inherit from this for override purposes. | 96 // So that test classes can inherit from this for override purposes. |
| 93 virtual ~ChromeDownloadManagerDelegate(); | 97 virtual ~ChromeDownloadManagerDelegate(); |
| 94 | 98 |
| 95 // So that test classes that inherit from this for override purposes | 99 // So that test classes that inherit from this for override purposes |
| 96 // can call back into the DownloadManager. | 100 // can call back into the DownloadManager. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // Maps from pending extension installations to DownloadItem IDs. | 165 // Maps from pending extension installations to DownloadItem IDs. |
| 162 typedef base::hash_map<CrxInstaller*, int> CrxInstallerMap; | 166 typedef base::hash_map<CrxInstaller*, int> CrxInstallerMap; |
| 163 CrxInstallerMap crx_installers_; | 167 CrxInstallerMap crx_installers_; |
| 164 | 168 |
| 165 content::NotificationRegistrar registrar_; | 169 content::NotificationRegistrar registrar_; |
| 166 | 170 |
| 167 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); | 171 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); |
| 168 }; | 172 }; |
| 169 | 173 |
| 170 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ | 174 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ |
| OLD | NEW |