Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_service.h

Issue 2647323009: Add extended reporting level in the update request (Closed)
Patch Set: rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 105 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
106 return enabled_; 106 return enabled_;
107 } 107 }
108 108
109 // Whether the service is enabled by the current set of profiles. 109 // Whether the service is enabled by the current set of profiles.
110 bool enabled_by_prefs() const { 110 bool enabled_by_prefs() const {
111 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 111 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
112 return enabled_by_prefs_; 112 return enabled_by_prefs_;
113 } 113 }
114 114
115 // NOTE(vakh): This is not the most reliable way to find out if extended
116 // reporting has been enabled. That's why it starts with maybe_. It returns
117 // true if any of the profiles have extended reporting enabled. Both
118 // |maybe_enabled_extended_reporting_by_prefs| and
119 // |maybe_enabled_scout_reporting_by_prefs| can be true at the same time. The
120 // caller is free to interpret that state as it sees fit. It may be called on
121 // any thread. That can lead to a race condition, but that's acceptable.
122 bool maybe_enabled_extended_reporting_by_prefs() const {
123 return maybe_enabled_extended_reporting_by_prefs_;
124 }
125
126 // NOTE(vakh): This is not the most reliable way to find out if Scout
127 // reporting has been enabled. For more details, see the comment above
128 // maybe_enabled_extended_reporting_by_prefs().
129 bool maybe_enabled_scout_reporting_by_prefs() const {
130 return maybe_enabled_scout_reporting_by_prefs_;
131 }
132
115 ClientSideDetectionService* safe_browsing_detection_service() const { 133 ClientSideDetectionService* safe_browsing_detection_service() const {
116 return services_delegate_->GetCsdService(); 134 return services_delegate_->GetCsdService();
117 } 135 }
118 136
119 // The DownloadProtectionService is not valid after the SafeBrowsingService 137 // The DownloadProtectionService is not valid after the SafeBrowsingService
120 // is destroyed. 138 // is destroyed.
121 DownloadProtectionService* download_protection_service() const { 139 DownloadProtectionService* download_protection_service() const {
122 return services_delegate_->GetDownloadService(); 140 return services_delegate_->GetDownloadService();
123 } 141 }
124 142
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 std::unique_ptr<SafeBrowsingPingManager> ping_manager_; 293 std::unique_ptr<SafeBrowsingPingManager> ping_manager_;
276 294
277 // Whether the service is running. 'enabled_' is used by SafeBrowsingService 295 // Whether the service is running. 'enabled_' is used by SafeBrowsingService
278 // on the IO thread during normal operations. 296 // on the IO thread during normal operations.
279 bool enabled_; 297 bool enabled_;
280 298
281 // Whether SafeBrowsing is enabled by the current set of profiles. 299 // Whether SafeBrowsing is enabled by the current set of profiles.
282 // Accessed on UI thread. 300 // Accessed on UI thread.
283 bool enabled_by_prefs_; 301 bool enabled_by_prefs_;
284 302
303 // Whether SafeBrowsing Extended Reporting is enabled by the current set of
304 // profiles. Updated on the UI thread.
305 bool maybe_enabled_extended_reporting_by_prefs_;
306
307 // Whether SafeBrowsing Scout Reporting is enabled by the current set of
308 // profiles. Updated on the UI thread.
309 bool maybe_enabled_scout_reporting_by_prefs_;
310
285 // Whether SafeBrowsing needs to be enabled in V4Only mode. In this mode, all 311 // Whether SafeBrowsing needs to be enabled in V4Only mode. In this mode, all
286 // SafeBrowsing decisions are made using the PVer4 implementation. 312 // SafeBrowsing decisions are made using the PVer4 implementation.
287 bool enabled_v4_only_; 313 bool enabled_v4_only_;
288 314
289 // Tracks existing PrefServices, and the safe browsing preference on each. 315 // Tracks existing PrefServices, and the safe browsing preference on each.
290 // This is used to determine if any profile is currently using the safe 316 // This is used to determine if any profile is currently using the safe
291 // browsing service, and to start it up or shut it down accordingly. 317 // browsing service, and to start it up or shut it down accordingly.
292 // Accessed on UI thread. 318 // Accessed on UI thread.
293 std::map<PrefService*, std::unique_ptr<PrefChangeRegistrar>> prefs_map_; 319 std::map<PrefService*, std::unique_ptr<PrefChangeRegistrar>> prefs_map_;
294 320
(...skipping 29 matching lines...) Expand all
324 SafeBrowsingServiceFactory() { } 350 SafeBrowsingServiceFactory() { }
325 virtual ~SafeBrowsingServiceFactory() { } 351 virtual ~SafeBrowsingServiceFactory() { }
326 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; 352 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0;
327 private: 353 private:
328 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); 354 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory);
329 }; 355 };
330 356
331 } // namespace safe_browsing 357 } // namespace safe_browsing
332 358
333 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ 359 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698