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 // The Safe Browsing service is responsible for downloading anti-phishing and | 5 // The Safe Browsing service is responsible for downloading anti-phishing and |
6 // anti-malware tables and checking urls against them. | 6 // anti-malware tables and checking urls against them. |
7 | 7 |
8 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
9 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 9 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
10 | 10 |
11 #include <map> | 11 #include <map> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
19 #include "base/sequenced_task_runner_helpers.h" | 19 #include "base/sequenced_task_runner_helpers.h" |
20 #include "chrome/browser/safe_browsing/safe_browsing_util.h" | 20 #include "chrome/browser/safe_browsing/safe_browsing_util.h" |
21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
22 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
23 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.h" |
24 | 24 |
25 class PrefChangeRegistrar; | 25 class PrefChangeRegistrar; |
26 class PrefService; | 26 class PrefService; |
| 27 struct SafeBrowsingProtocolConfig; |
27 class SafeBrowsingDatabaseManager; | 28 class SafeBrowsingDatabaseManager; |
28 class SafeBrowsingPingManager; | 29 class SafeBrowsingPingManager; |
29 class SafeBrowsingProtocolManager; | 30 class SafeBrowsingProtocolManager; |
30 class SafeBrowsingServiceFactory; | 31 class SafeBrowsingServiceFactory; |
31 class SafeBrowsingUIManager; | 32 class SafeBrowsingUIManager; |
32 class SafeBrowsingURLRequestContextGetter; | 33 class SafeBrowsingURLRequestContextGetter; |
33 | 34 |
34 namespace base { | 35 namespace base { |
35 class Thread; | 36 class Thread; |
36 } | 37 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // Called on the UI thread to initialize the service. | 73 // Called on the UI thread to initialize the service. |
73 void Initialize(); | 74 void Initialize(); |
74 | 75 |
75 // Called on the main thread to let us know that the io_thread is going away. | 76 // Called on the main thread to let us know that the io_thread is going away. |
76 void ShutDown(); | 77 void ShutDown(); |
77 | 78 |
78 // Called on UI thread to decide if the download file's sha256 hash | 79 // Called on UI thread to decide if the download file's sha256 hash |
79 // should be calculated for safebrowsing. | 80 // should be calculated for safebrowsing. |
80 bool DownloadBinHashNeeded() const; | 81 bool DownloadBinHashNeeded() const; |
81 | 82 |
| 83 // Create a protocol config struct. |
| 84 SafeBrowsingProtocolConfig GetProtocolConfig() const; |
| 85 |
82 bool enabled() const { return enabled_; } | 86 bool enabled() const { return enabled_; } |
83 | 87 |
84 safe_browsing::ClientSideDetectionService* | 88 safe_browsing::ClientSideDetectionService* |
85 safe_browsing_detection_service() const { | 89 safe_browsing_detection_service() const { |
86 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 90 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
87 return csd_service_.get(); | 91 return csd_service_.get(); |
88 } | 92 } |
89 | 93 |
90 // The DownloadProtectionService is not valid after the SafeBrowsingService | 94 // The DownloadProtectionService is not valid after the SafeBrowsingService |
91 // is destroyed. | 95 // is destroyed. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 class SafeBrowsingServiceFactory { | 226 class SafeBrowsingServiceFactory { |
223 public: | 227 public: |
224 SafeBrowsingServiceFactory() { } | 228 SafeBrowsingServiceFactory() { } |
225 virtual ~SafeBrowsingServiceFactory() { } | 229 virtual ~SafeBrowsingServiceFactory() { } |
226 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; | 230 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; |
227 private: | 231 private: |
228 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); | 232 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); |
229 }; | 233 }; |
230 | 234 |
231 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 235 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
OLD | NEW |