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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // The DownloadProtectionService is not valid after the SafeBrowsingService | 118 // The DownloadProtectionService is not valid after the SafeBrowsingService |
119 // is destroyed. | 119 // is destroyed. |
120 DownloadProtectionService* download_protection_service() const { | 120 DownloadProtectionService* download_protection_service() const { |
121 return services_delegate_->GetDownloadService(); | 121 return services_delegate_->GetDownloadService(); |
122 } | 122 } |
123 | 123 |
124 net::URLRequestContextGetter* url_request_context(); | 124 net::URLRequestContextGetter* url_request_context(); |
125 | 125 |
126 const scoped_refptr<SafeBrowsingUIManager>& ui_manager() const; | 126 const scoped_refptr<SafeBrowsingUIManager>& ui_manager() const; |
127 | 127 |
| 128 // This returns either the v3 or the v4 database manager, depending on |
| 129 // the experiment settings. |
128 const scoped_refptr<SafeBrowsingDatabaseManager>& database_manager() const; | 130 const scoped_refptr<SafeBrowsingDatabaseManager>& database_manager() const; |
129 | 131 |
130 SafeBrowsingProtocolManager* protocol_manager() const; | 132 SafeBrowsingProtocolManager* protocol_manager() const; |
131 | 133 |
132 SafeBrowsingPingManager* ping_manager() const; | 134 SafeBrowsingPingManager* ping_manager() const; |
133 | 135 |
134 const scoped_refptr<V4LocalDatabaseManager>& v4_local_database_manager() | 136 // This may be NULL if v4 is not enabled by experiment. |
| 137 const scoped_refptr<SafeBrowsingDatabaseManager>& v4_local_database_manager() |
135 const; | 138 const; |
136 | 139 |
137 // Returns a preference validation delegate that adds incidents to the | 140 // Returns a preference validation delegate that adds incidents to the |
138 // incident reporting service for validation failures. Returns NULL if the | 141 // incident reporting service for validation failures. Returns NULL if the |
139 // service is not applicable for the given profile. | 142 // service is not applicable for the given profile. |
140 std::unique_ptr<TrackedPreferenceValidationDelegate> | 143 std::unique_ptr<TrackedPreferenceValidationDelegate> |
141 CreatePreferenceValidationDelegate(Profile* profile) const; | 144 CreatePreferenceValidationDelegate(Profile* profile) const; |
142 | 145 |
143 // Registers |callback| to be run after some delay following process launch. | 146 // Registers |callback| to be run after some delay following process launch. |
144 // |callback| will be dropped if the service is not applicable for the | 147 // |callback| will be dropped if the service is not applicable for the |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 std::unique_ptr<SafeBrowsingPingManager> ping_manager_; | 259 std::unique_ptr<SafeBrowsingPingManager> ping_manager_; |
257 | 260 |
258 // Whether the service is running. 'enabled_' is used by SafeBrowsingService | 261 // Whether the service is running. 'enabled_' is used by SafeBrowsingService |
259 // on the IO thread during normal operations. | 262 // on the IO thread during normal operations. |
260 bool enabled_; | 263 bool enabled_; |
261 | 264 |
262 // Whether SafeBrowsing is enabled by the current set of profiles. | 265 // Whether SafeBrowsing is enabled by the current set of profiles. |
263 // Accessed on UI thread. | 266 // Accessed on UI thread. |
264 bool enabled_by_prefs_; | 267 bool enabled_by_prefs_; |
265 | 268 |
| 269 // Whether SafeBrowsing needs to be enabled in V4Only mode. In this mode, all |
| 270 // SafeBrowsing decisions are made using the PVer4 implementation. |
| 271 bool enabled_v4_only_; |
| 272 |
266 // Tracks existing PrefServices, and the safe browsing preference on each. | 273 // Tracks existing PrefServices, and the safe browsing preference on each. |
267 // This is used to determine if any profile is currently using the safe | 274 // 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. | 275 // browsing service, and to start it up or shut it down accordingly. |
269 // Accessed on UI thread. | 276 // Accessed on UI thread. |
270 std::map<PrefService*, std::unique_ptr<PrefChangeRegistrar>> prefs_map_; | 277 std::map<PrefService*, std::unique_ptr<PrefChangeRegistrar>> prefs_map_; |
271 | 278 |
272 // Used to track creation and destruction of profiles on the UI thread. | 279 // Used to track creation and destruction of profiles on the UI thread. |
273 content::NotificationRegistrar prefs_registrar_; | 280 content::NotificationRegistrar prefs_registrar_; |
274 | 281 |
275 // Callbacks when SafeBrowsing state might have changed. | 282 // Callbacks when SafeBrowsing state might have changed. |
(...skipping 17 matching lines...) Expand all Loading... |
293 SafeBrowsingServiceFactory() { } | 300 SafeBrowsingServiceFactory() { } |
294 virtual ~SafeBrowsingServiceFactory() { } | 301 virtual ~SafeBrowsingServiceFactory() { } |
295 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; | 302 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; |
296 private: | 303 private: |
297 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); | 304 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); |
298 }; | 305 }; |
299 | 306 |
300 } // namespace safe_browsing | 307 } // namespace safe_browsing |
301 | 308 |
302 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 309 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
OLD | NEW |