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

Side by Side Diff: components/safe_browsing_db/safe_browsing_db_util.h

Issue 1399843003: Move prefix_set and parts of s_b_util into a new component safe_browsing_db. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
(Empty)
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 // Utilities for the SafeBrowsing DB code.
6
7 #ifndef COMPONENTS_SAFE_BROWSING_DB_SAFE_BROWSING_DB_UTIL_H_
8 #define COMPONENTS_SAFE_BROWSING_DB_SAFE_BROWSING_DB_UTIL_H_
9
10 #include "base/basictypes.h"
11 #include "base/strings/string_piece.h"
12
13 // A truncated hash's type.
14 typedef uint32 SBPrefix;
Nathan Parker 2015/10/14 17:37:10 Note: Long term I think we should put this all in
vakh (old account. dont use) 2015/10/15 21:07:08 Acknowledged.
15
16 // A full hash.
17 union SBFullHash {
18 char full_hash[32];
19 SBPrefix prefix;
20 };
21
22 inline bool SBFullHashEqual(const SBFullHash& a, const SBFullHash& b) {
23 return !memcmp(a.full_hash, b.full_hash, sizeof(a.full_hash));
24 }
25
26 inline bool SBFullHashLess(const SBFullHash& a, const SBFullHash& b) {
27 return memcmp(a.full_hash, b.full_hash, sizeof(a.full_hash)) < 0;
28 }
29
30 // Generate full hash for the given string.
31 SBFullHash SBFullHashForString(const base::StringPiece& str);
32
33 // Different types of threats that SafeBrowsing protects against.
34 enum SBThreatType {
35 // No threat at all.
36 SB_THREAT_TYPE_SAFE,
37
38 // The URL is being used for phishing.
39 SB_THREAT_TYPE_URL_PHISHING,
40
41 // The URL hosts malware.
42 SB_THREAT_TYPE_URL_MALWARE,
43
44 // The URL hosts unwanted programs.
45 SB_THREAT_TYPE_URL_UNWANTED,
46
47 // The download URL is malware.
48 SB_THREAT_TYPE_BINARY_MALWARE_URL,
49
50 // Url detected by the client-side phishing model. Note that unlike the
51 // above values, this does not correspond to a downloaded list.
52 SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL,
53
54 // The Chrome extension or app (given by its ID) is malware.
55 SB_THREAT_TYPE_EXTENSION,
56
57 // Url detected by the client-side malware IP list. This IP list is part
58 // of the client side detection model.
59 SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL,
60 };
61
62 #endif // COMPONENTS_SAFE_BROWSING_DB_SAFE_BROWSING_DB_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698