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

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

Issue 1638223003: Add support for a module whitelist (goog-whitemodule-digest256) to the safe browsing db (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix browser test Created 4 years, 10 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
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 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 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 DB code. 5 // Utilities for the SafeBrowsing DB code.
6 6
7 #ifndef COMPONENTS_SAFE_BROWSING_DB_UTIL_H_ 7 #ifndef COMPONENTS_SAFE_BROWSING_DB_UTIL_H_
8 #define COMPONENTS_SAFE_BROWSING_DB_UTIL_H_ 8 #define COMPONENTS_SAFE_BROWSING_DB_UTIL_H_
9 9
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // SafeBrowsing download whitelist list name. 93 // SafeBrowsing download whitelist list name.
94 extern const char kDownloadWhiteList[]; 94 extern const char kDownloadWhiteList[];
95 // SafeBrowsing extension list name. 95 // SafeBrowsing extension list name.
96 extern const char kExtensionBlacklist[]; 96 extern const char kExtensionBlacklist[];
97 // SafeBrowsing csd malware IP blacklist name. 97 // SafeBrowsing csd malware IP blacklist name.
98 extern const char kIPBlacklist[]; 98 extern const char kIPBlacklist[];
99 // SafeBrowsing unwanted URL list. 99 // SafeBrowsing unwanted URL list.
100 extern const char kUnwantedUrlList[]; 100 extern const char kUnwantedUrlList[];
101 // SafeBrowsing off-domain inclusion whitelist list name. 101 // SafeBrowsing off-domain inclusion whitelist list name.
102 extern const char kInclusionWhitelist[]; 102 extern const char kInclusionWhitelist[];
103 // SafeBrowsing module whitelist list name.
104 extern const char kModuleWhitelist[];
103 // This array must contain all Safe Browsing lists. 105 // This array must contain all Safe Browsing lists.
104 extern const char* kAllLists[9]; 106 extern const char* kAllLists[10];
105
106 107
107 enum ListType { 108 enum ListType {
108 INVALID = -1, 109 INVALID = -1,
109 MALWARE = 0, 110 MALWARE = 0,
110 PHISH = 1, 111 PHISH = 1,
111 BINURL = 2, 112 BINURL = 2,
112 // Obsolete BINHASH = 3, 113 // Obsolete BINHASH = 3,
113 CSDWHITELIST = 4, 114 CSDWHITELIST = 4,
114 // SafeBrowsing lists are stored in pairs. Keep ListType 5 115 // SafeBrowsing lists are stored in pairs. Keep ListType 5
115 // available for a potential second list that we would store in the 116 // available for a potential second list that we would store in the
116 // csd-whitelist store file. 117 // csd-whitelist store file.
117 DOWNLOADWHITELIST = 6, 118 DOWNLOADWHITELIST = 6,
118 // See above comment. Leave 7 available. 119 // See above comment. Leave 7 available.
119 EXTENSIONBLACKLIST = 8, 120 EXTENSIONBLACKLIST = 8,
120 // See above comment. Leave 9 available. 121 // See above comment. Leave 9 available.
121 // Obsolete SIDEEFFECTFREEWHITELIST = 10, 122 // Obsolete SIDEEFFECTFREEWHITELIST = 10,
122 // See above comment. Leave 11 available. 123 // See above comment. Leave 11 available.
123 IPBLACKLIST = 12, 124 IPBLACKLIST = 12,
124 // See above comment. Leave 13 available. 125 // See above comment. Leave 13 available.
125 UNWANTEDURL = 14, 126 UNWANTEDURL = 14,
126 // See above comment. Leave 15 available. 127 // See above comment. Leave 15 available.
127 INCLUSIONWHITELIST = 16, 128 INCLUSIONWHITELIST = 16,
128 // See above comment. Leave 17 available. 129 // See above comment. Leave 17 available.
130 MODULEWHITELIST = 18,
131 // See above comment. Leave 19 available.
129 }; 132 };
130 133
131
132 inline bool SBFullHashEqual(const SBFullHash& a, const SBFullHash& b) { 134 inline bool SBFullHashEqual(const SBFullHash& a, const SBFullHash& b) {
133 return !memcmp(a.full_hash, b.full_hash, sizeof(a.full_hash)); 135 return !memcmp(a.full_hash, b.full_hash, sizeof(a.full_hash));
134 } 136 }
135 137
136 inline bool SBFullHashLess(const SBFullHash& a, const SBFullHash& b) { 138 inline bool SBFullHashLess(const SBFullHash& a, const SBFullHash& b) {
137 return memcmp(a.full_hash, b.full_hash, sizeof(a.full_hash)) < 0; 139 return memcmp(a.full_hash, b.full_hash, sizeof(a.full_hash)) < 0;
138 } 140 }
139 141
140 // Generate full hash for the given string. 142 // Generate full hash for the given string.
141 SBFullHash SBFullHashForString(const base::StringPiece& str); 143 SBFullHash SBFullHashForString(const base::StringPiece& str);
(...skipping 29 matching lines...) Expand all
171 173
172 // Given a URL, returns all the paths we need to check. 174 // Given a URL, returns all the paths we need to check.
173 void GeneratePathsToCheck(const GURL& url, std::vector<std::string>* paths); 175 void GeneratePathsToCheck(const GURL& url, std::vector<std::string>* paths);
174 176
175 // Given a URL, returns all the patterns we need to check. 177 // Given a URL, returns all the patterns we need to check.
176 void GeneratePatternsToCheck(const GURL& url, std::vector<std::string>* urls); 178 void GeneratePatternsToCheck(const GURL& url, std::vector<std::string>* urls);
177 179
178 } // namespace safe_browsing 180 } // namespace safe_browsing
179 181
180 #endif // COMPONENTS_SAFE_BROWSING_DB_UTIL_H_ 182 #endif // COMPONENTS_SAFE_BROWSING_DB_UTIL_H_
OLDNEW
« no previous file with comments | « components/safe_browsing_db/test_database_manager.cc ('k') | components/safe_browsing_db/util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698