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> |
| 9 |
8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
9 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
| 12 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
12 #include "chrome/browser/download/download_path_reservation_tracker.h" | 15 #include "chrome/browser/download/download_path_reservation_tracker.h" |
13 #include "chrome/browser/download/download_target_determiner_delegate.h" | 16 #include "chrome/browser/download/download_target_determiner_delegate.h" |
14 #include "chrome/browser/download/download_target_info.h" | 17 #include "chrome/browser/download/download_target_info.h" |
15 #include "chrome/browser/safe_browsing/download_protection_service.h" | 18 #include "chrome/browser/safe_browsing/download_protection_service.h" |
16 #include "content/public/browser/download_danger_type.h" | 19 #include "content/public/browser/download_danger_type.h" |
17 #include "content/public/browser/download_item.h" | 20 #include "content/public/browser/download_item.h" |
18 #include "content/public/browser/download_manager_delegate.h" | 21 #include "content/public/browser/download_manager_delegate.h" |
19 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 128 |
126 typedef std::vector<content::DownloadIdCallback> IdCallbackVector; | 129 typedef std::vector<content::DownloadIdCallback> IdCallbackVector; |
127 | 130 |
128 // content::NotificationObserver implementation. | 131 // content::NotificationObserver implementation. |
129 void Observe(int type, | 132 void Observe(int type, |
130 const content::NotificationSource& source, | 133 const content::NotificationSource& source, |
131 const content::NotificationDetails& details) override; | 134 const content::NotificationDetails& details) override; |
132 | 135 |
133 // Callback function after the DownloadProtectionService completes. | 136 // Callback function after the DownloadProtectionService completes. |
134 void CheckClientDownloadDone( | 137 void CheckClientDownloadDone( |
135 uint32 download_id, | 138 uint32_t download_id, |
136 safe_browsing::DownloadProtectionService::DownloadCheckResult result); | 139 safe_browsing::DownloadProtectionService::DownloadCheckResult result); |
137 | 140 |
138 // Internal gateways for ShouldCompleteDownload(). | 141 // Internal gateways for ShouldCompleteDownload(). |
139 bool IsDownloadReadyForCompletion( | 142 bool IsDownloadReadyForCompletion( |
140 content::DownloadItem* item, | 143 content::DownloadItem* item, |
141 const base::Closure& internal_complete_callback); | 144 const base::Closure& internal_complete_callback); |
142 void ShouldCompleteDownloadInternal( | 145 void ShouldCompleteDownloadInternal( |
143 uint32 download_id, | 146 uint32_t download_id, |
144 const base::Closure& user_complete_callback); | 147 const base::Closure& user_complete_callback); |
145 | 148 |
146 void SetNextId(uint32 id); | 149 void SetNextId(uint32_t id); |
147 | 150 |
148 void ReturnNextId(const content::DownloadIdCallback& callback); | 151 void ReturnNextId(const content::DownloadIdCallback& callback); |
149 | 152 |
150 void OnDownloadTargetDetermined( | 153 void OnDownloadTargetDetermined( |
151 int32 download_id, | 154 int32_t download_id, |
152 const content::DownloadTargetCallback& callback, | 155 const content::DownloadTargetCallback& callback, |
153 scoped_ptr<DownloadTargetInfo> target_info); | 156 scoped_ptr<DownloadTargetInfo> target_info); |
154 | 157 |
155 // Returns true if |path| should open in the browser. | 158 // Returns true if |path| should open in the browser. |
156 bool IsOpenInBrowserPreferreredForFile(const base::FilePath& path); | 159 bool IsOpenInBrowserPreferreredForFile(const base::FilePath& path); |
157 | 160 |
158 Profile* profile_; | 161 Profile* profile_; |
159 uint32 next_download_id_; | 162 uint32_t next_download_id_; |
160 IdCallbackVector id_callbacks_; | 163 IdCallbackVector id_callbacks_; |
161 scoped_ptr<DownloadPrefs> download_prefs_; | 164 scoped_ptr<DownloadPrefs> download_prefs_; |
162 | 165 |
163 #if defined(ENABLE_EXTENSIONS) | 166 #if defined(ENABLE_EXTENSIONS) |
164 // Maps from pending extension installations to DownloadItem IDs. | 167 // Maps from pending extension installations to DownloadItem IDs. |
165 typedef base::hash_map<extensions::CrxInstaller*, | 168 typedef base::hash_map<extensions::CrxInstaller*, |
166 content::DownloadOpenDelayedCallback> CrxInstallerMap; | 169 content::DownloadOpenDelayedCallback> CrxInstallerMap; |
167 CrxInstallerMap crx_installers_; | 170 CrxInstallerMap crx_installers_; |
168 #endif | 171 #endif |
169 | 172 |
170 content::NotificationRegistrar registrar_; | 173 content::NotificationRegistrar registrar_; |
171 | 174 |
172 base::WeakPtrFactory<ChromeDownloadManagerDelegate> weak_ptr_factory_; | 175 base::WeakPtrFactory<ChromeDownloadManagerDelegate> weak_ptr_factory_; |
173 | 176 |
174 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); | 177 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); |
175 }; | 178 }; |
176 | 179 |
177 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ | 180 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ |
OLD | NEW |