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

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

Issue 8854004: Remove the check of the whitelist entries in ClientPhishingResponse. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/client_side_detection_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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 virtual void EndFetchModel(ClientModelStatus status); // Virtual for testing. 162 virtual void EndFetchModel(ClientModelStatus status); // Virtual for testing.
163 163
164 private: 164 private:
165 friend class ClientSideDetectionServiceTest; 165 friend class ClientSideDetectionServiceTest;
166 FRIEND_TEST_ALL_PREFIXES(ClientSideDetectionServiceTest, FetchModelTest); 166 FRIEND_TEST_ALL_PREFIXES(ClientSideDetectionServiceTest, FetchModelTest);
167 FRIEND_TEST_ALL_PREFIXES(ClientSideDetectionServiceTest, SetBadSubnets); 167 FRIEND_TEST_ALL_PREFIXES(ClientSideDetectionServiceTest, SetBadSubnets);
168 FRIEND_TEST_ALL_PREFIXES(ClientSideDetectionServiceTest, 168 FRIEND_TEST_ALL_PREFIXES(ClientSideDetectionServiceTest,
169 SetEnabledAndRefreshState); 169 SetEnabledAndRefreshState);
170 FRIEND_TEST_ALL_PREFIXES(ClientSideDetectionServiceTest, IsBadIpAddress); 170 FRIEND_TEST_ALL_PREFIXES(ClientSideDetectionServiceTest, IsBadIpAddress);
171 FRIEND_TEST_ALL_PREFIXES(ClientSideDetectionServiceTest, 171 FRIEND_TEST_ALL_PREFIXES(ClientSideDetectionServiceTest,
172 IsFalsePositiveResponse);
173 FRIEND_TEST_ALL_PREFIXES(ClientSideDetectionServiceTest,
174 ModelHasValidHashIds); 172 ModelHasValidHashIds);
175 173
176 // CacheState holds all information necessary to respond to a caller without 174 // CacheState holds all information necessary to respond to a caller without
177 // actually making a HTTP request. 175 // actually making a HTTP request.
178 struct CacheState { 176 struct CacheState {
179 bool is_phishing; 177 bool is_phishing;
180 base::Time timestamp; 178 base::Time timestamp;
181 179
182 CacheState(bool phish, base::Time time); 180 CacheState(bool phish, base::Time time);
183 }; 181 };
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 // |bad_subnets| for faster lookups. This method is static to simplify 244 // |bad_subnets| for faster lookups. This method is static to simplify
247 // testing. 245 // testing.
248 static void SetBadSubnets(const ClientSideModel& model, 246 static void SetBadSubnets(const ClientSideModel& model,
249 BadSubnetMap* bad_subnets); 247 BadSubnetMap* bad_subnets);
250 248
251 249
252 // Returns true iff all the hash id's in the client-side model point to 250 // Returns true iff all the hash id's in the client-side model point to
253 // valid hashes in the model. 251 // valid hashes in the model.
254 static bool ModelHasValidHashIds(const ClientSideModel& model); 252 static bool ModelHasValidHashIds(const ClientSideModel& model);
255 253
256 // Returns true iff the response is phishing (phishy() is true) and if the
257 // given URL matches one of the whitelisted expressions in the given
258 // ClientPhishingResponse.
259 static bool IsFalsePositiveResponse(const GURL& url,
260 const ClientPhishingResponse& response);
261
262 // Whether the service is running or not. When the service is not running, 254 // Whether the service is running or not. When the service is not running,
263 // it won't download the model nor report detected phishing URLs. 255 // it won't download the model nor report detected phishing URLs.
264 bool enabled_; 256 bool enabled_;
265 257
266 std::string model_str_; 258 std::string model_str_;
267 scoped_ptr<ClientSideModel> model_; 259 scoped_ptr<ClientSideModel> model_;
268 scoped_ptr<base::TimeDelta> model_max_age_; 260 scoped_ptr<base::TimeDelta> model_max_age_;
269 scoped_ptr<content::URLFetcher> model_fetcher_; 261 scoped_ptr<content::URLFetcher> model_fetcher_;
270 262
271 // Map of client report phishing request to the corresponding callback that 263 // Map of client report phishing request to the corresponding callback that
(...skipping 29 matching lines...) Expand all
301 // this map to speed up lookups. 293 // this map to speed up lookups.
302 BadSubnetMap bad_subnets_; 294 BadSubnetMap bad_subnets_;
303 295
304 content::NotificationRegistrar registrar_; 296 content::NotificationRegistrar registrar_;
305 297
306 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService); 298 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService);
307 }; 299 };
308 } // namepsace safe_browsing 300 } // namepsace safe_browsing
309 301
310 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_ 302 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/client_side_detection_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698