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 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 void ReturnNextId(const content::DownloadIdCallback& callback); | 157 void ReturnNextId(const content::DownloadIdCallback& callback); |
158 | 158 |
159 void OnDownloadTargetDetermined( | 159 void OnDownloadTargetDetermined( |
160 int32_t download_id, | 160 int32_t download_id, |
161 const content::DownloadTargetCallback& callback, | 161 const content::DownloadTargetCallback& callback, |
162 std::unique_ptr<DownloadTargetInfo> target_info); | 162 std::unique_ptr<DownloadTargetInfo> target_info); |
163 | 163 |
164 // Returns true if |path| should open in the browser. | 164 // Returns true if |path| should open in the browser. |
165 bool IsOpenInBrowserPreferreredForFile(const base::FilePath& path); | 165 bool IsOpenInBrowserPreferreredForFile(const base::FilePath& path); |
166 | 166 |
| 167 // Return true if the downloaded file should be blocked based on the current |
| 168 // download restriction pref and |danger_type|. |
| 169 bool ShouldBlockFile(content::DownloadDangerType danger_type) const; |
| 170 |
167 Profile* profile_; | 171 Profile* profile_; |
168 uint32_t next_download_id_; | 172 uint32_t next_download_id_; |
169 IdCallbackVector id_callbacks_; | 173 IdCallbackVector id_callbacks_; |
170 std::unique_ptr<DownloadPrefs> download_prefs_; | 174 std::unique_ptr<DownloadPrefs> download_prefs_; |
171 | 175 |
172 // SequencedTaskRunner to check for file existence. A sequence is used so that | 176 // SequencedTaskRunner to check for file existence. A sequence is used so that |
173 // a large download history doesn't cause a large number of concurrent disk | 177 // a large download history doesn't cause a large number of concurrent disk |
174 // operations. | 178 // operations. |
175 const scoped_refptr<base::SequencedTaskRunner> | 179 const scoped_refptr<base::SequencedTaskRunner> |
176 check_for_file_existence_task_runner_; | 180 check_for_file_existence_task_runner_; |
177 | 181 |
178 #if BUILDFLAG(ENABLE_EXTENSIONS) | 182 #if BUILDFLAG(ENABLE_EXTENSIONS) |
179 // Maps from pending extension installations to DownloadItem IDs. | 183 // Maps from pending extension installations to DownloadItem IDs. |
180 typedef base::hash_map<extensions::CrxInstaller*, | 184 typedef base::hash_map<extensions::CrxInstaller*, |
181 content::DownloadOpenDelayedCallback> CrxInstallerMap; | 185 content::DownloadOpenDelayedCallback> CrxInstallerMap; |
182 CrxInstallerMap crx_installers_; | 186 CrxInstallerMap crx_installers_; |
183 #endif | 187 #endif |
184 | 188 |
185 content::NotificationRegistrar registrar_; | 189 content::NotificationRegistrar registrar_; |
186 | 190 |
187 base::WeakPtrFactory<ChromeDownloadManagerDelegate> weak_ptr_factory_; | 191 base::WeakPtrFactory<ChromeDownloadManagerDelegate> weak_ptr_factory_; |
188 | 192 |
189 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); | 193 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); |
190 }; | 194 }; |
191 | 195 |
192 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ | 196 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ |
OLD | NEW |