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

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

Issue 14999008: Add a killswitch for CSD malware IP match and report feature. Use a new killswitch whitelist URL wh… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
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 // Helper class which handles communication with the SafeBrowsing backends for 5 // Helper class which handles communication with the SafeBrowsing backends for
6 // client-side phishing detection. This class is used to fetch the client-side 6 // client-side phishing detection. This class is used to fetch the client-side
7 // model and send it to all renderers. This class is also used to send a ping 7 // model and send it to all renderers. This class is also used to send a ping
8 // back to Google to verify if a particular site is really phishing or not. 8 // back to Google to verify if a particular site is really phishing or not.
9 // 9 //
10 // This class is not thread-safe and expects all calls to be made on the UI 10 // This class is not thread-safe and expects all calls to be made on the UI
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // requests; existing ClientSideDetectionHosts will have their callbacks 78 // requests; existing ClientSideDetectionHosts will have their callbacks
79 // called with "false" verdicts. Enabling starts downloading the model after 79 // called with "false" verdicts. Enabling starts downloading the model after
80 // a delay. In all cases, each render process is updated to match the state 80 // a delay. In all cases, each render process is updated to match the state
81 // of the SafeBrowsing preference for that profile. 81 // of the SafeBrowsing preference for that profile.
82 void SetEnabledAndRefreshState(bool enabled); 82 void SetEnabledAndRefreshState(bool enabled);
83 83
84 bool enabled() const { 84 bool enabled() const {
85 return enabled_; 85 return enabled_;
86 } 86 }
87 87
88 void SetMalwareEnabled(bool malware_killswitch) {
89 malware_enabled_ = !malware_killswitch;
90 }
91
92 bool MalwareEnabled() const {
93 return malware_enabled_;
94 }
95
88 // From the net::URLFetcherDelegate interface. 96 // From the net::URLFetcherDelegate interface.
89 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; 97 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
90 98
91 // content::NotificationObserver overrides: 99 // content::NotificationObserver overrides:
92 virtual void Observe(int type, 100 virtual void Observe(int type,
93 const content::NotificationSource& source, 101 const content::NotificationSource& source,
94 const content::NotificationDetails& details) OVERRIDE; 102 const content::NotificationDetails& details) OVERRIDE;
95 103
96 // Sends a request to the SafeBrowsing servers with the ClientPhishingRequest. 104 // Sends a request to the SafeBrowsing servers with the ClientPhishingRequest.
97 // The URL scheme of the |url()| in the request should be HTTP. This method 105 // The URL scheme of the |url()| in the request should be HTTP. This method
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // valid hashes in the model. 280 // valid hashes in the model.
273 static bool ModelHasValidHashIds(const ClientSideModel& model); 281 static bool ModelHasValidHashIds(const ClientSideModel& model);
274 282
275 // Returns the URL that will be used for phishing requests. 283 // Returns the URL that will be used for phishing requests.
276 static std::string GetClientReportUrl(const std::string& report_url); 284 static std::string GetClientReportUrl(const std::string& report_url);
277 285
278 // Whether the service is running or not. When the service is not running, 286 // Whether the service is running or not. When the service is not running,
279 // it won't download the model nor report detected phishing URLs. 287 // it won't download the model nor report detected phishing URLs.
280 bool enabled_; 288 bool enabled_;
281 289
290 // Whether the malware IP matching feature is enabled.
291 bool malware_enabled_;
292
282 std::string model_str_; 293 std::string model_str_;
283 scoped_ptr<ClientSideModel> model_; 294 scoped_ptr<ClientSideModel> model_;
284 scoped_ptr<base::TimeDelta> model_max_age_; 295 scoped_ptr<base::TimeDelta> model_max_age_;
285 scoped_ptr<net::URLFetcher> model_fetcher_; 296 scoped_ptr<net::URLFetcher> model_fetcher_;
286 297
287 // Map of client report phishing request to the corresponding callback that 298 // Map of client report phishing request to the corresponding callback that
288 // has to be invoked when the request is done. 299 // has to be invoked when the request is done.
289 struct ClientReportInfo; 300 struct ClientReportInfo;
290 std::map<const net::URLFetcher*, ClientReportInfo*> 301 std::map<const net::URLFetcher*, ClientReportInfo*>
291 client_phishing_reports_; 302 client_phishing_reports_;
(...skipping 27 matching lines...) Expand all
319 // this map to speed up lookups. 330 // this map to speed up lookups.
320 BadSubnetMap bad_subnets_; 331 BadSubnetMap bad_subnets_;
321 332
322 content::NotificationRegistrar registrar_; 333 content::NotificationRegistrar registrar_;
323 334
324 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService); 335 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService);
325 }; 336 };
326 } // namepsace safe_browsing 337 } // namepsace safe_browsing
327 338
328 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_ 339 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698