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 "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "chrome/browser/download/download_path_reservation_tracker.h" | 12 #include "chrome/browser/download/download_path_reservation_tracker.h" |
13 #include "chrome/browser/download/download_target_determiner_delegate.h" | 13 #include "chrome/browser/download/download_target_determiner_delegate.h" |
14 #include "chrome/browser/safe_browsing/download_protection_service.h" | 14 #include "chrome/browser/safe_browsing/download_protection_service.h" |
15 #include "content/public/browser/download_danger_type.h" | 15 #include "content/public/browser/download_danger_type.h" |
16 #include "content/public/browser/download_item.h" | 16 #include "content/public/browser/download_item.h" |
17 #include "content/public/browser/download_manager_delegate.h" | 17 #include "content/public/browser/download_manager_delegate.h" |
18 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
19 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
20 | 20 |
21 class DownloadPrefs; | 21 class DownloadPrefs; |
22 class PrefRegistrySyncable; | |
23 class Profile; | 22 class Profile; |
24 | 23 |
25 namespace content { | 24 namespace content { |
26 class DownloadManager; | 25 class DownloadManager; |
27 } | 26 } |
28 | 27 |
29 namespace extensions { | 28 namespace extensions { |
30 class CrxInstaller; | 29 class CrxInstaller; |
31 } | 30 } |
32 | 31 |
| 32 namespace user_prefs { |
| 33 class PrefRegistrySyncable; |
| 34 } |
| 35 |
33 #if defined(COMPILER_GCC) | 36 #if defined(COMPILER_GCC) |
34 namespace BASE_HASH_NAMESPACE { | 37 namespace BASE_HASH_NAMESPACE { |
35 template<> | 38 template<> |
36 struct hash<extensions::CrxInstaller*> { | 39 struct hash<extensions::CrxInstaller*> { |
37 std::size_t operator()(extensions::CrxInstaller* const& p) const { | 40 std::size_t operator()(extensions::CrxInstaller* const& p) const { |
38 return reinterpret_cast<std::size_t>(p); | 41 return reinterpret_cast<std::size_t>(p); |
39 } | 42 } |
40 }; | 43 }; |
41 } // namespace BASE_HASH_NAMESPACE | 44 } // namespace BASE_HASH_NAMESPACE |
42 #endif | 45 #endif |
43 | 46 |
44 // This is the Chrome side helper for the download system. | 47 // This is the Chrome side helper for the download system. |
45 class ChromeDownloadManagerDelegate | 48 class ChromeDownloadManagerDelegate |
46 : public base::RefCountedThreadSafe<ChromeDownloadManagerDelegate>, | 49 : public base::RefCountedThreadSafe<ChromeDownloadManagerDelegate>, |
47 public content::DownloadManagerDelegate, | 50 public content::DownloadManagerDelegate, |
48 public content::NotificationObserver, | 51 public content::NotificationObserver, |
49 public DownloadTargetDeterminerDelegate { | 52 public DownloadTargetDeterminerDelegate { |
50 public: | 53 public: |
51 explicit ChromeDownloadManagerDelegate(Profile* profile); | 54 explicit ChromeDownloadManagerDelegate(Profile* profile); |
52 | 55 |
53 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 56 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); |
54 | 57 |
55 // Should be called before the first call to ShouldCompleteDownload() to | 58 // Should be called before the first call to ShouldCompleteDownload() to |
56 // disable SafeBrowsing checks for |item|. | 59 // disable SafeBrowsing checks for |item|. |
57 static void DisableSafeBrowsing(content::DownloadItem* item); | 60 static void DisableSafeBrowsing(content::DownloadItem* item); |
58 | 61 |
59 void SetDownloadManager(content::DownloadManager* dm); | 62 void SetDownloadManager(content::DownloadManager* dm); |
60 | 63 |
61 // content::DownloadManagerDelegate | 64 // content::DownloadManagerDelegate |
62 virtual void Shutdown() OVERRIDE; | 65 virtual void Shutdown() OVERRIDE; |
63 virtual content::DownloadId GetNextId() OVERRIDE; | 66 virtual content::DownloadId GetNextId() OVERRIDE; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 content::NotificationRegistrar registrar_; | 170 content::NotificationRegistrar registrar_; |
168 | 171 |
169 // The directory most recently chosen by the user in response to a Save As | 172 // The directory most recently chosen by the user in response to a Save As |
170 // dialog for a regular download. | 173 // dialog for a regular download. |
171 base::FilePath last_download_path_; | 174 base::FilePath last_download_path_; |
172 | 175 |
173 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); | 176 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); |
174 }; | 177 }; |
175 | 178 |
176 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ | 179 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ |
OLD | NEW |