| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 FilePath* website_save_dir, | 74 FilePath* website_save_dir, |
| 75 FilePath* download_save_dir) OVERRIDE; | 75 FilePath* download_save_dir) OVERRIDE; |
| 76 virtual void ChooseSavePath(const base::WeakPtr<SavePackage>& save_package, | 76 virtual void ChooseSavePath(const base::WeakPtr<SavePackage>& save_package, |
| 77 const FilePath& suggested_path, | 77 const FilePath& suggested_path, |
| 78 bool can_save_as_complete) OVERRIDE; | 78 bool can_save_as_complete) OVERRIDE; |
| 79 virtual void DownloadProgressUpdated() OVERRIDE; | 79 virtual void DownloadProgressUpdated() OVERRIDE; |
| 80 | 80 |
| 81 DownloadPrefs* download_prefs() { return download_prefs_.get(); } | 81 DownloadPrefs* download_prefs() { return download_prefs_.get(); } |
| 82 DownloadHistory* download_history() { return download_history_.get(); } | 82 DownloadHistory* download_history() { return download_history_.get(); } |
| 83 | 83 |
| 84 protected: |
| 85 // So that test classes can inherit from this for override purposes. |
| 86 virtual ~ChromeDownloadManagerDelegate(); |
| 87 |
| 88 // So that test classes that inherit from this for override purposes |
| 89 // can call back into the DownloadManager. |
| 90 scoped_refptr<DownloadManager> download_manager_; |
| 91 |
| 84 private: | 92 private: |
| 85 friend class base::RefCountedThreadSafe<ChromeDownloadManagerDelegate>; | 93 friend class base::RefCountedThreadSafe<ChromeDownloadManagerDelegate>; |
| 86 virtual ~ChromeDownloadManagerDelegate(); | |
| 87 | 94 |
| 88 // NotificationObserver implementation. | 95 // NotificationObserver implementation. |
| 89 virtual void Observe(int type, | 96 virtual void Observe(int type, |
| 90 const NotificationSource& source, | 97 const NotificationSource& source, |
| 91 const NotificationDetails& details) OVERRIDE; | 98 const NotificationDetails& details) OVERRIDE; |
| 92 | 99 |
| 93 // Callback function after url is checked with safebrowsing service. | 100 // Callback function after url is checked with safebrowsing service. |
| 94 void CheckDownloadUrlDone(int32 download_id, bool is_dangerous_url); | 101 void CheckDownloadUrlDone(int32 download_id, bool is_dangerous_url); |
| 95 | 102 |
| 96 // Callback function after we check whether the referrer URL has been visited | 103 // Callback function after we check whether the referrer URL has been visited |
| (...skipping 18 matching lines...) Expand all Loading... |
| 115 // user action initiated the download, and whether the user has explicitly | 122 // user action initiated the download, and whether the user has explicitly |
| 116 // marked the file type as "auto open". | 123 // marked the file type as "auto open". |
| 117 bool IsDangerousFile(const DownloadItem& download, | 124 bool IsDangerousFile(const DownloadItem& download, |
| 118 const DownloadStateInfo& state, | 125 const DownloadStateInfo& state, |
| 119 bool visited_referrer_before); | 126 bool visited_referrer_before); |
| 120 | 127 |
| 121 // Callback from history system. | 128 // Callback from history system. |
| 122 void OnItemAddedToPersistentStore(int32 download_id, int64 db_handle); | 129 void OnItemAddedToPersistentStore(int32 download_id, int64 db_handle); |
| 123 | 130 |
| 124 Profile* profile_; | 131 Profile* profile_; |
| 125 scoped_refptr<DownloadManager> download_manager_; | |
| 126 scoped_ptr<DownloadPrefs> download_prefs_; | 132 scoped_ptr<DownloadPrefs> download_prefs_; |
| 127 scoped_ptr<DownloadHistory> download_history_; | 133 scoped_ptr<DownloadHistory> download_history_; |
| 128 | 134 |
| 129 // Maps from pending extension installations to DownloadItem IDs. | 135 // Maps from pending extension installations to DownloadItem IDs. |
| 130 typedef base::hash_map<CrxInstaller*, int> CrxInstallerMap; | 136 typedef base::hash_map<CrxInstaller*, int> CrxInstallerMap; |
| 131 CrxInstallerMap crx_installers_; | 137 CrxInstallerMap crx_installers_; |
| 132 | 138 |
| 133 NotificationRegistrar registrar_; | 139 NotificationRegistrar registrar_; |
| 134 | 140 |
| 135 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); | 141 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); |
| 136 }; | 142 }; |
| 137 | 143 |
| 138 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ | 144 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ |
| OLD | NEW |