OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 IOS_CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 8 #ifndef IOS_CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
9 #define IOS_CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 9 #define IOS_CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
10 | 10 |
11 #include <map> | 11 #include <map> |
| 12 #include <memory> |
12 #include <string> | 13 #include <string> |
13 | 14 |
14 #include "base/callback.h" | 15 #include "base/callback.h" |
15 #include "base/callback_list.h" | 16 #include "base/callback_list.h" |
16 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
17 #include "base/macros.h" | 18 #include "base/macros.h" |
18 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
19 #include "base/memory/scoped_ptr.h" | |
20 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
21 #include "base/sequenced_task_runner_helpers.h" | 21 #include "base/sequenced_task_runner_helpers.h" |
22 #include "ios/chrome/browser/safe_browsing/util.h" | 22 #include "ios/chrome/browser/safe_browsing/util.h" |
23 #include "ios/web/public/web_thread.h" | 23 #include "ios/web/public/web_thread.h" |
24 | 24 |
25 class PrefChangeRegistrar; | 25 class PrefChangeRegistrar; |
26 class PrefService; | 26 class PrefService; |
27 class TrackedPreferenceValidationDelegate; | 27 class TrackedPreferenceValidationDelegate; |
28 | 28 |
29 namespace base { | 29 namespace base { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // headers (or SB_THREAT_TYPE_SAFE if no threat is indicated). | 101 // headers (or SB_THREAT_TYPE_SAFE if no threat is indicated). |
102 SBThreatType CheckResponseFromProxyRequestHeaders( | 102 SBThreatType CheckResponseFromProxyRequestHeaders( |
103 scoped_refptr<net::HttpResponseHeaders> headers); | 103 scoped_refptr<net::HttpResponseHeaders> headers); |
104 | 104 |
105 // Type for subscriptions to SafeBrowsing service state. | 105 // Type for subscriptions to SafeBrowsing service state. |
106 typedef base::CallbackList<void(void)>::Subscription StateSubscription; | 106 typedef base::CallbackList<void(void)>::Subscription StateSubscription; |
107 | 107 |
108 // Adds a listener for when SafeBrowsing preferences might have changed. | 108 // Adds a listener for when SafeBrowsing preferences might have changed. |
109 // To get the current state, the callback should call enabled_by_prefs(). | 109 // To get the current state, the callback should call enabled_by_prefs(). |
110 // Should only be called on the UI thread. | 110 // Should only be called on the UI thread. |
111 scoped_ptr<StateSubscription> RegisterStateCallback( | 111 std::unique_ptr<StateSubscription> RegisterStateCallback( |
112 const base::Callback<void(void)>& callback); | 112 const base::Callback<void(void)>& callback); |
113 | 113 |
114 // Sends serialized download recovery report to backend. | 114 // Sends serialized download recovery report to backend. |
115 void SendDownloadRecoveryReport(const std::string& report); | 115 void SendDownloadRecoveryReport(const std::string& report); |
116 | 116 |
117 protected: | 117 protected: |
118 // Creates the safe browsing service. Need to initialize before using. | 118 // Creates the safe browsing service. Need to initialize before using. |
119 SafeBrowsingService(); | 119 SafeBrowsingService(); |
120 | 120 |
121 virtual ~SafeBrowsingService(); | 121 virtual ~SafeBrowsingService(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 virtual ~SafeBrowsingServiceFactory() {} | 206 virtual ~SafeBrowsingServiceFactory() {} |
207 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; | 207 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; |
208 | 208 |
209 private: | 209 private: |
210 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); | 210 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); |
211 }; | 211 }; |
212 | 212 |
213 } // namespace safe_browsing | 213 } // namespace safe_browsing |
214 | 214 |
215 #endif // IOS_CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 215 #endif // IOS_CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
OLD | NEW |