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

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

Issue 11615011: Small modifications to safebrowsing code to make it simpler to add the extension (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: seriously there is a macro called check() in AssertMacros.h wow Created 7 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 | 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 // 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 9
10 #include <cstring> 10 #include <cstring>
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 BINURL = 2, 295 BINURL = 2,
296 BINHASH = 3, 296 BINHASH = 3,
297 CSDWHITELIST = 4, 297 CSDWHITELIST = 4,
298 // SafeBrowsing lists are stored in pairs. Keep ListType 5 298 // SafeBrowsing lists are stored in pairs. Keep ListType 5
299 // available for a potential second list that we would store in the 299 // available for a potential second list that we would store in the
300 // csd-whitelist store file. 300 // csd-whitelist store file.
301 DOWNLOADWHITELIST = 6, 301 DOWNLOADWHITELIST = 6,
302 }; 302 };
303 303
304 // Maps a list name to ListType. 304 // Maps a list name to ListType.
305 int GetListId(const std::string& name); 305 ListType GetListId(const std::string& name);
306
306 // Maps a ListId to list name. Return false if fails. 307 // Maps a ListId to list name. Return false if fails.
307 bool GetListName(int list_id, std::string* list); 308 bool GetListName(ListType list_id, std::string* list);
308
309 309
310 // Canonicalizes url as per Google Safe Browsing Specification. 310 // Canonicalizes url as per Google Safe Browsing Specification.
311 // See section 6.1 in 311 // See section 6.1 in
312 // http://code.google.com/p/google-safe-browsing/wiki/Protocolv2Spec. 312 // http://code.google.com/p/google-safe-browsing/wiki/Protocolv2Spec.
313 void CanonicalizeUrl(const GURL& url, std::string* canonicalized_hostname, 313 void CanonicalizeUrl(const GURL& url, std::string* canonicalized_hostname,
314 std::string* canonicalized_path, 314 std::string* canonicalized_path,
315 std::string* canonicalized_query); 315 std::string* canonicalized_query);
316 316
317 // Given a URL, returns all the hosts we need to check. They are returned 317 // Given a URL, returns all the hosts we need to check. They are returned
318 // in order of size (i.e. b.c is first, then a.b.c). 318 // in order of size (i.e. b.c is first, then a.b.c).
(...skipping 16 matching lines...) Expand all
335 335
336 bool IsPhishingList(const std::string& list_name); 336 bool IsPhishingList(const std::string& list_name);
337 bool IsMalwareList(const std::string& list_name); 337 bool IsMalwareList(const std::string& list_name);
338 bool IsBadbinurlList(const std::string& list_name); 338 bool IsBadbinurlList(const std::string& list_name);
339 bool IsBadbinhashList(const std::string& list_name); 339 bool IsBadbinhashList(const std::string& list_name);
340 340
341 GURL GeneratePhishingReportUrl(const std::string& report_page, 341 GURL GeneratePhishingReportUrl(const std::string& report_page,
342 const std::string& url_to_report, 342 const std::string& url_to_report,
343 bool is_client_side_detection); 343 bool is_client_side_detection);
344 344
345 void StringToSBFullHash(const std::string& hash_in, SBFullHash* hash_out); 345 SBFullHash StringToSBFullHash(const std::string& hash_in);
346 std::string SBFullHashToString(const SBFullHash& hash_out); 346 std::string SBFullHashToString(const SBFullHash& hash_out);
347
347 } // namespace safe_browsing_util 348 } // namespace safe_browsing_util
348 349
349 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ 350 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc ('k') | chrome/browser/safe_browsing/safe_browsing_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698