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

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, 10 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
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/safe_browsing_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #include <map> 11 #include <map>
12 #include <memory> 12 #include <memory>
13 #include <string> 13 #include <string>
14 14
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/callback_list.h" 16 #include "base/callback_list.h"
17 #include "base/files/file_path.h" 17 #include "base/files/file_path.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.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 "chrome/browser/safe_browsing/services_delegate.h" 22 #include "chrome/browser/safe_browsing/services_delegate.h"
23 #include "components/safe_browsing_db/safe_browsing_prefs.h"
23 #include "components/safe_browsing_db/util.h" 24 #include "components/safe_browsing_db/util.h"
24 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
25 #include "content/public/browser/notification_observer.h" 26 #include "content/public/browser/notification_observer.h"
26 #include "content/public/browser/notification_registrar.h" 27 #include "content/public/browser/notification_registrar.h"
27 28
28 #if defined(FULL_SAFE_BROWSING) 29 #if defined(FULL_SAFE_BROWSING)
29 #include "chrome/browser/safe_browsing/incident_reporting/delayed_analysis_callb ack.h" 30 #include "chrome/browser/safe_browsing/incident_reporting/delayed_analysis_callb ack.h"
30 #endif 31 #endif
31 32
32 class PrefChangeRegistrar; 33 class PrefChangeRegistrar;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 94
94 // Create a protocol config struct. 95 // Create a protocol config struct.
95 virtual SafeBrowsingProtocolConfig GetProtocolConfig() const; 96 virtual SafeBrowsingProtocolConfig GetProtocolConfig() const;
96 97
97 // Create a v4 protocol config struct. 98 // Create a v4 protocol config struct.
98 virtual V4ProtocolConfig GetV4ProtocolConfig() const; 99 virtual V4ProtocolConfig GetV4ProtocolConfig() const;
99 100
100 // Returns the client_name field for both V3 and V4 protocol manager configs. 101 // Returns the client_name field for both V3 and V4 protocol manager configs.
101 std::string GetProtocolConfigClientName() const; 102 std::string GetProtocolConfigClientName() const;
102 103
104 // NOTE(vakh): This is not the most reliable way to find out if extended
105 // reporting has been enabled. That's why it starts with estimated_. It
106 // returns true if any of the profiles have extended reporting enabled. It may
107 // be called on any thread. That can lead to a race condition, but that's
108 // acceptable.
109 ExtendedReportingLevel estimated_extended_reporting_by_prefs() const {
110 return estimated_extended_reporting_by_prefs_;
111 }
112
103 // Get current enabled status. Must be called on IO thread. 113 // Get current enabled status. Must be called on IO thread.
104 bool enabled() const { 114 bool enabled() const {
105 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 115 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
106 return enabled_; 116 return enabled_;
107 } 117 }
108 118
109 // Whether the service is enabled by the current set of profiles. 119 // Whether the service is enabled by the current set of profiles.
110 bool enabled_by_prefs() const { 120 bool enabled_by_prefs() const {
111 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 121 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
112 return enabled_by_prefs_; 122 return enabled_by_prefs_;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 url_request_context_getter_; 277 url_request_context_getter_;
268 278
269 #if defined(SAFE_BROWSING_DB_LOCAL) 279 #if defined(SAFE_BROWSING_DB_LOCAL)
270 // Handles interaction with SafeBrowsing servers. Accessed on IO thread. 280 // Handles interaction with SafeBrowsing servers. Accessed on IO thread.
271 std::unique_ptr<SafeBrowsingProtocolManager> protocol_manager_; 281 std::unique_ptr<SafeBrowsingProtocolManager> protocol_manager_;
272 #endif 282 #endif
273 283
274 // Provides phishing and malware statistics. Accessed on IO thread. 284 // Provides phishing and malware statistics. Accessed on IO thread.
275 std::unique_ptr<SafeBrowsingPingManager> ping_manager_; 285 std::unique_ptr<SafeBrowsingPingManager> ping_manager_;
276 286
287 // Whether SafeBrowsing Extended Reporting is enabled by the current set of
288 // profiles. Updated on the UI thread.
289 ExtendedReportingLevel estimated_extended_reporting_by_prefs_;
290
277 // Whether the service is running. 'enabled_' is used by SafeBrowsingService 291 // Whether the service is running. 'enabled_' is used by SafeBrowsingService
278 // on the IO thread during normal operations. 292 // on the IO thread during normal operations.
279 bool enabled_; 293 bool enabled_;
280 294
281 // Whether SafeBrowsing is enabled by the current set of profiles. 295 // Whether SafeBrowsing is enabled by the current set of profiles.
282 // Accessed on UI thread. 296 // Accessed on UI thread.
283 bool enabled_by_prefs_; 297 bool enabled_by_prefs_;
284 298
285 // Whether SafeBrowsing needs to be enabled in V4Only mode. In this mode, all 299 // Whether SafeBrowsing needs to be enabled in V4Only mode. In this mode, all
286 // SafeBrowsing decisions are made using the PVer4 implementation. 300 // SafeBrowsing decisions are made using the PVer4 implementation.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 SafeBrowsingServiceFactory() { } 338 SafeBrowsingServiceFactory() { }
325 virtual ~SafeBrowsingServiceFactory() { } 339 virtual ~SafeBrowsingServiceFactory() { }
326 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; 340 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0;
327 private: 341 private:
328 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); 342 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory);
329 }; 343 };
330 344
331 } // namespace safe_browsing 345 } // namespace safe_browsing
332 346
333 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ 347 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/safe_browsing_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698