| 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 #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 29 matching lines...) Expand all Loading... |
| 40 class ChromeDownloadManagerDelegate | 40 class ChromeDownloadManagerDelegate |
| 41 : public base::RefCountedThreadSafe<ChromeDownloadManagerDelegate>, | 41 : public base::RefCountedThreadSafe<ChromeDownloadManagerDelegate>, |
| 42 public DownloadManagerDelegate, | 42 public DownloadManagerDelegate, |
| 43 public NotificationObserver { | 43 public NotificationObserver { |
| 44 public: | 44 public: |
| 45 explicit ChromeDownloadManagerDelegate(Profile* profile); | 45 explicit ChromeDownloadManagerDelegate(Profile* profile); |
| 46 | 46 |
| 47 // Returns true if the given item is for an extension download. | 47 // Returns true if the given item is for an extension download. |
| 48 static bool IsExtensionDownload(const DownloadItem* item); | 48 static bool IsExtensionDownload(const DownloadItem* item); |
| 49 | 49 |
| 50 void SetDownloadManager(DownloadManager* dm); | |
| 51 | |
| 52 virtual void Shutdown() OVERRIDE; | 50 virtual void Shutdown() OVERRIDE; |
| 53 virtual bool ShouldStartDownload(int32 download_id) OVERRIDE; | 51 virtual bool ShouldStartDownload(int32 download_id) OVERRIDE; |
| 54 virtual void ChooseDownloadPath(TabContents* tab_contents, | 52 virtual void ChooseDownloadPath(TabContents* tab_contents, |
| 55 const FilePath& suggested_path, | 53 const FilePath& suggested_path, |
| 56 void* data) OVERRIDE; | 54 void* data) OVERRIDE; |
| 57 virtual bool OverrideIntermediatePath(DownloadItem* item, | 55 virtual bool OverrideIntermediatePath(DownloadItem* item, |
| 58 FilePath* intermediate_path) OVERRIDE; | 56 FilePath* intermediate_path) OVERRIDE; |
| 59 virtual TabContents* GetAlternativeTabContentsToNotifyForDownload() OVERRIDE; | 57 virtual TabContents* GetAlternativeTabContentsToNotifyForDownload() OVERRIDE; |
| 60 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE; | 58 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE; |
| 61 virtual bool ShouldOpenDownload(DownloadItem* item) OVERRIDE; | 59 virtual bool ShouldOpenDownload(DownloadItem* item) OVERRIDE; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 72 virtual void RemoveItemsFromPersistentStoreBetween( | 70 virtual void RemoveItemsFromPersistentStoreBetween( |
| 73 const base::Time remove_begin, | 71 const base::Time remove_begin, |
| 74 const base::Time remove_end) OVERRIDE; | 72 const base::Time remove_end) OVERRIDE; |
| 75 virtual void GetSaveDir(TabContents* tab_contents, | 73 virtual void GetSaveDir(TabContents* tab_contents, |
| 76 FilePath* website_save_dir, | 74 FilePath* website_save_dir, |
| 77 FilePath* download_save_dir) OVERRIDE; | 75 FilePath* download_save_dir) OVERRIDE; |
| 78 virtual void ChooseSavePath(const base::WeakPtr<SavePackage>& save_package, | 76 virtual void ChooseSavePath(const base::WeakPtr<SavePackage>& save_package, |
| 79 const FilePath& suggested_path, | 77 const FilePath& suggested_path, |
| 80 bool can_save_as_complete) OVERRIDE; | 78 bool can_save_as_complete) OVERRIDE; |
| 81 virtual void DownloadProgressUpdated() OVERRIDE; | 79 virtual void DownloadProgressUpdated() OVERRIDE; |
| 80 virtual void SetDownloadManager(DownloadManager* dm) OVERRIDE; |
| 82 | 81 |
| 83 DownloadPrefs* download_prefs() { return download_prefs_.get(); } | 82 DownloadPrefs* download_prefs() { return download_prefs_.get(); } |
| 84 DownloadHistory* download_history() { return download_history_.get(); } | 83 DownloadHistory* download_history() { return download_history_.get(); } |
| 85 | 84 |
| 86 protected: | 85 protected: |
| 87 // So that test classes can inherit from this for override purposes. | 86 // So that test classes can inherit from this for override purposes. |
| 88 virtual ~ChromeDownloadManagerDelegate(); | 87 virtual ~ChromeDownloadManagerDelegate(); |
| 89 | 88 |
| 90 // So that test classes that inherit from this for override purposes | 89 // So that test classes that inherit from this for override purposes |
| 91 // can call back into the DownloadManager. | 90 // can call back into the DownloadManager. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // Maps from pending extension installations to DownloadItem IDs. | 140 // Maps from pending extension installations to DownloadItem IDs. |
| 142 typedef base::hash_map<CrxInstaller*, int> CrxInstallerMap; | 141 typedef base::hash_map<CrxInstaller*, int> CrxInstallerMap; |
| 143 CrxInstallerMap crx_installers_; | 142 CrxInstallerMap crx_installers_; |
| 144 | 143 |
| 145 NotificationRegistrar registrar_; | 144 NotificationRegistrar registrar_; |
| 146 | 145 |
| 147 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); | 146 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); |
| 148 }; | 147 }; |
| 149 | 148 |
| 150 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ | 149 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ |
| OLD | NEW |