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 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 // The callbacks run on the UI thread, and give the subscribers an opportunity | 190 // The callbacks run on the UI thread, and give the subscribers an opportunity |
191 // to clean up any references they hold to SafeBrowsingService. | 191 // to clean up any references they hold to SafeBrowsingService. |
192 std::unique_ptr<ShutdownSubscription> RegisterShutdownCallback( | 192 std::unique_ptr<ShutdownSubscription> RegisterShutdownCallback( |
193 const base::Callback<void(void)>& callback); | 193 const base::Callback<void(void)>& callback); |
194 | 194 |
195 // Sends serialized download report to backend. | 195 // Sends serialized download report to backend. |
196 virtual void SendSerializedDownloadReport(const std::string& report); | 196 virtual void SendSerializedDownloadReport(const std::string& report); |
197 | 197 |
198 protected: | 198 protected: |
199 // Creates the safe browsing service. Need to initialize before using. | 199 // Creates the safe browsing service. Need to initialize before using. |
200 SafeBrowsingService(); | 200 explicit SafeBrowsingService(bool v4_enabled = false, |
201 bool use_v4_only = false); | |
Scott Hess - ex-Googler
2017/02/06 22:46:35
This feels like a case where some well-chosen enum
vakh (use Gerrit instead)
2017/02/06 23:30:12
Done.
| |
201 | 202 |
202 ~SafeBrowsingService() override; | 203 ~SafeBrowsingService() override; |
203 | 204 |
204 virtual SafeBrowsingDatabaseManager* CreateDatabaseManager(); | 205 virtual SafeBrowsingDatabaseManager* CreateDatabaseManager(); |
205 | 206 |
206 virtual SafeBrowsingUIManager* CreateUIManager(); | 207 virtual SafeBrowsingUIManager* CreateUIManager(); |
207 | 208 |
208 // Registers all the delayed analysis with the incident reporting service. | 209 // Registers all the delayed analysis with the incident reporting service. |
209 // This is where you register your process-wide, profile-independent analysis. | 210 // This is where you register your process-wide, profile-independent analysis. |
210 virtual void RegisterAllDelayedAnalysis(); | 211 virtual void RegisterAllDelayedAnalysis(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
291 // Whether the service is running. 'enabled_' is used by SafeBrowsingService | 292 // Whether the service is running. 'enabled_' is used by SafeBrowsingService |
292 // on the IO thread during normal operations. | 293 // on the IO thread during normal operations. |
293 bool enabled_; | 294 bool enabled_; |
294 | 295 |
295 // Whether SafeBrowsing is enabled by the current set of profiles. | 296 // Whether SafeBrowsing is enabled by the current set of profiles. |
296 // Accessed on UI thread. | 297 // Accessed on UI thread. |
297 bool enabled_by_prefs_; | 298 bool enabled_by_prefs_; |
298 | 299 |
299 // Whether SafeBrowsing needs to be enabled in V4Only mode. In this mode, all | 300 // Whether SafeBrowsing needs to be enabled in V4Only mode. In this mode, all |
300 // SafeBrowsing decisions are made using the PVer4 implementation. | 301 // SafeBrowsing decisions are made using the PVer4 implementation. |
301 bool enabled_v4_only_; | 302 bool use_v4_only_; |
303 | |
304 // Whether the PVer4 implementation needs to be instantiated. Note that even | |
305 // if the PVer4 implementation has been instantiated, it is used only if | |
306 // |use_v4_only_| is true. | |
307 bool v4_enabled_; | |
302 | 308 |
303 // Tracks existing PrefServices, and the safe browsing preference on each. | 309 // Tracks existing PrefServices, and the safe browsing preference on each. |
304 // This is used to determine if any profile is currently using the safe | 310 // This is used to determine if any profile is currently using the safe |
305 // browsing service, and to start it up or shut it down accordingly. | 311 // browsing service, and to start it up or shut it down accordingly. |
306 // Accessed on UI thread. | 312 // Accessed on UI thread. |
307 std::map<PrefService*, std::unique_ptr<PrefChangeRegistrar>> prefs_map_; | 313 std::map<PrefService*, std::unique_ptr<PrefChangeRegistrar>> prefs_map_; |
308 | 314 |
309 // Used to track creation and destruction of profiles on the UI thread. | 315 // Used to track creation and destruction of profiles on the UI thread. |
310 content::NotificationRegistrar prefs_registrar_; | 316 content::NotificationRegistrar prefs_registrar_; |
311 | 317 |
(...skipping 26 matching lines...) Expand all Loading... | |
338 SafeBrowsingServiceFactory() { } | 344 SafeBrowsingServiceFactory() { } |
339 virtual ~SafeBrowsingServiceFactory() { } | 345 virtual ~SafeBrowsingServiceFactory() { } |
340 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; | 346 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; |
341 private: | 347 private: |
342 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); | 348 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); |
343 }; | 349 }; |
344 | 350 |
345 } // namespace safe_browsing | 351 } // namespace safe_browsing |
346 | 352 |
347 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 353 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
OLD | NEW |