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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 230 |
231 // Checks if any profile is currently using the safe browsing service, and | 231 // Checks if any profile is currently using the safe browsing service, and |
232 // starts or stops the service accordingly. | 232 // starts or stops the service accordingly. |
233 void RefreshState(); | 233 void RefreshState(); |
234 | 234 |
235 void OnSendSerializedDownloadReport(const std::string& report); | 235 void OnSendSerializedDownloadReport(const std::string& report); |
236 | 236 |
237 // Process the observed resource requests on the UI thread. | 237 // Process the observed resource requests on the UI thread. |
238 void ProcessResourceRequest(const ResourceRequestInfo& request); | 238 void ProcessResourceRequest(const ResourceRequestInfo& request); |
239 | 239 |
240 // The factory used to instanciate a SafeBrowsingService object. | 240 // The factory used to instantiate a SafeBrowsingService object. |
241 // Useful for tests, so they can provide their own implementation of | 241 // Useful for tests, so they can provide their own implementation of |
242 // SafeBrowsingService. | 242 // SafeBrowsingService. |
243 static SafeBrowsingServiceFactory* factory_; | 243 static SafeBrowsingServiceFactory* factory_; |
244 | 244 |
245 // The SafeBrowsingURLRequestContextGetter used to access | 245 // The SafeBrowsingURLRequestContextGetter used to access |
246 // |url_request_context_|. Accessed on UI thread. | 246 // |url_request_context_|. Accessed on UI thread. |
247 scoped_refptr<SafeBrowsingURLRequestContextGetter> | 247 scoped_refptr<SafeBrowsingURLRequestContextGetter> |
248 url_request_context_getter_; | 248 url_request_context_getter_; |
249 | 249 |
250 #if defined(SAFE_BROWSING_DB_LOCAL) | 250 #if defined(SAFE_BROWSING_DB_LOCAL) |
251 // Handles interaction with SafeBrowsing servers. Accessed on IO thread. | 251 // Handles interaction with SafeBrowsing servers. Accessed on IO thread. |
252 std::unique_ptr<SafeBrowsingProtocolManager> protocol_manager_; | 252 std::unique_ptr<SafeBrowsingProtocolManager> protocol_manager_; |
253 #endif | 253 #endif |
254 | 254 |
255 // Provides phishing and malware statistics. Accessed on IO thread. | 255 // Provides phishing and malware statistics. Accessed on IO thread. |
256 std::unique_ptr<SafeBrowsingPingManager> ping_manager_; | 256 std::unique_ptr<SafeBrowsingPingManager> ping_manager_; |
257 | 257 |
258 // Whether the service is running. 'enabled_' is used by SafeBrowsingService | 258 // Whether the service is running. 'enabled_' is used by SafeBrowsingService |
259 // on the IO thread during normal operations. | 259 // on the IO thread during normal operations. |
260 bool enabled_; | 260 bool enabled_; |
261 | 261 |
262 // Whether SafeBrowsing is enabled by the current set of profiles. | 262 // Whether SafeBrowsing is enabled by the current set of profiles. |
263 // Accessed on UI thread. | 263 // Accessed on UI thread. |
264 bool enabled_by_prefs_; | 264 bool enabled_by_prefs_; |
265 | 265 |
266 // Tracks existing PrefServices, and the safe browsing preference on each. | 266 // Tracks existing PrefServices, and the safe browsing preference on each. |
267 // This is used to determine if any profile is currently using the safe | 267 // This is used to determine if any profile is currently using the safe |
268 // browsing service, and to start it up or shut it down accordingly. | 268 // browsing service, and to start it up or shut it down accordingly. |
269 // Accessed on UI thread. | 269 // Accessed on UI thread. |
270 std::map<PrefService*, PrefChangeRegistrar*> prefs_map_; | 270 std::map<PrefService*, std::unique_ptr<PrefChangeRegistrar>> prefs_map_; |
271 | 271 |
272 // Used to track creation and destruction of profiles on the UI thread. | 272 // Used to track creation and destruction of profiles on the UI thread. |
273 content::NotificationRegistrar prefs_registrar_; | 273 content::NotificationRegistrar prefs_registrar_; |
274 | 274 |
275 // Callbacks when SafeBrowsing state might have changed. | 275 // Callbacks when SafeBrowsing state might have changed. |
276 // Should only be accessed on the UI thread. | 276 // Should only be accessed on the UI thread. |
277 base::CallbackList<void(void)> state_callback_list_; | 277 base::CallbackList<void(void)> state_callback_list_; |
278 | 278 |
279 // The UI manager handles showing interstitials. Accessed on both UI and IO | 279 // The UI manager handles showing interstitials. Accessed on both UI and IO |
280 // thread. | 280 // thread. |
(...skipping 12 matching lines...) Expand all Loading... |
293 SafeBrowsingServiceFactory() { } | 293 SafeBrowsingServiceFactory() { } |
294 virtual ~SafeBrowsingServiceFactory() { } | 294 virtual ~SafeBrowsingServiceFactory() { } |
295 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; | 295 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; |
296 private: | 296 private: |
297 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); | 297 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); |
298 }; | 298 }; |
299 | 299 |
300 } // namespace safe_browsing | 300 } // namespace safe_browsing |
301 | 301 |
302 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 302 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
OLD | NEW |