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

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

Issue 7792004: Parse the whitelist expressions from the phishing verdict response if (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Brian's comments Created 9 years, 3 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) 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 // Utilities for the SafeBrowsing code. 5 // Utilities for the SafeBrowsing code.
6 6
7 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ 7 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_
8 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ 8 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_
9 #pragma once 9 #pragma once
10 10
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 std::string* canonicalized_path, 289 std::string* canonicalized_path,
290 std::string* canonicalized_query); 290 std::string* canonicalized_query);
291 291
292 // Given a URL, returns all the hosts we need to check. They are returned 292 // Given a URL, returns all the hosts we need to check. They are returned
293 // in order of size (i.e. b.c is first, then a.b.c). 293 // in order of size (i.e. b.c is first, then a.b.c).
294 void GenerateHostsToCheck(const GURL& url, std::vector<std::string>* hosts); 294 void GenerateHostsToCheck(const GURL& url, std::vector<std::string>* hosts);
295 295
296 // Given a URL, returns all the paths we need to check. 296 // Given a URL, returns all the paths we need to check.
297 void GeneratePathsToCheck(const GURL& url, std::vector<std::string>* paths); 297 void GeneratePathsToCheck(const GURL& url, std::vector<std::string>* paths);
298 298
299 // Given a URL, returns all the patterns we need to check.
300 void GeneratePatternsToCheck(const GURL& url, std::vector<std::string>* urls);
301
299 int GetHashIndex(const SBFullHash& hash, 302 int GetHashIndex(const SBFullHash& hash,
300 const std::vector<SBFullHashResult>& full_hashes); 303 const std::vector<SBFullHashResult>& full_hashes);
301 304
302 // Given a URL, compare all the possible host + path full hashes to the set of 305 // Given a URL, compare all the possible host + path full hashes to the set of
303 // provided full hashes. Returns the index of the match if one is found, or -1 306 // provided full hashes. Returns the index of the match if one is found, or -1
304 // otherwise. 307 // otherwise.
305 int GetUrlHashIndex(const GURL& url, 308 int GetUrlHashIndex(const GURL& url,
306 const std::vector<SBFullHashResult>& full_hashes); 309 const std::vector<SBFullHashResult>& full_hashes);
307 310
308 bool IsPhishingList(const std::string& list_name); 311 bool IsPhishingList(const std::string& list_name);
309 bool IsMalwareList(const std::string& list_name); 312 bool IsMalwareList(const std::string& list_name);
310 bool IsBadbinurlList(const std::string& list_name); 313 bool IsBadbinurlList(const std::string& list_name);
311 bool IsBadbinhashList(const std::string& list_name); 314 bool IsBadbinhashList(const std::string& list_name);
312 315
313 // Returns 'true' if 'mac' can be verified using 'key' and 'data'. 316 // Returns 'true' if 'mac' can be verified using 'key' and 'data'.
314 bool VerifyMAC(const std::string& key, 317 bool VerifyMAC(const std::string& key,
315 const std::string& mac, 318 const std::string& mac,
316 const char* data, 319 const char* data,
317 int data_length); 320 int data_length);
318 321
319 GURL GeneratePhishingReportUrl(const std::string& report_page, 322 GURL GeneratePhishingReportUrl(const std::string& report_page,
320 const std::string& url_to_report, 323 const std::string& url_to_report,
321 bool is_client_side_detection); 324 bool is_client_side_detection);
322 325
323 void StringToSBFullHash(const std::string& hash_in, SBFullHash* hash_out); 326 void StringToSBFullHash(const std::string& hash_in, SBFullHash* hash_out);
324 std::string SBFullHashToString(const SBFullHash& hash_out); 327 std::string SBFullHashToString(const SBFullHash& hash_out);
325 } // namespace safe_browsing_util 328 } // namespace safe_browsing_util
326 329
327 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ 330 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698