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

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

Issue 2225113002: Reland: Move PVer4 related code from util.* to v4_protocol_manager_util.* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor: Address nparker@'s comments Created 4 years, 4 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
« no previous file with comments | « components/safe_browsing_db/BUILD.gn ('k') | components/safe_browsing_db/util.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) 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 SBFullHash StringToSBFullHash(const std::string& hash_in); 184 SBFullHash StringToSBFullHash(const std::string& hash_in);
185 std::string SBFullHashToString(const SBFullHash& hash_out); 185 std::string SBFullHashToString(const SBFullHash& hash_out);
186 186
187 187
188 // Maps a list name to ListType. 188 // Maps a list name to ListType.
189 ListType GetListId(const base::StringPiece& name); 189 ListType GetListId(const base::StringPiece& name);
190 190
191 // Maps a ListId to list name. Return false if fails. 191 // Maps a ListId to list name. Return false if fails.
192 bool GetListName(ListType list_id, std::string* list); 192 bool GetListName(ListType list_id, std::string* list);
193 193
194 // Canonicalizes url as per Google Safe Browsing Specification.
195 // See section 6.1 in
196 // http://code.google.com/p/google-safe-browsing/wiki/Protocolv2Spec.
197 void CanonicalizeUrl(const GURL& url, std::string* canonicalized_hostname,
198 std::string* canonicalized_path,
199 std::string* canonicalized_query);
200
201
202 // Generate the set of full hashes to check for |url|. If 194 // Generate the set of full hashes to check for |url|. If
203 // |include_whitelist_hashes| is true we will generate additional path-prefixes 195 // |include_whitelist_hashes| is true we will generate additional path-prefixes
204 // to match against the csd whitelist. E.g., if the path-prefix /foo is on the 196 // to match against the csd whitelist. E.g., if the path-prefix /foo is on the
205 // whitelist it should also match /foo/bar which is not the case for all the 197 // whitelist it should also match /foo/bar which is not the case for all the
206 // other lists. We'll also always add a pattern for the empty path. 198 // other lists. We'll also always add a pattern for the empty path.
207 void UrlToFullHashes(const GURL& url, bool include_whitelist_hashes, 199 void UrlToFullHashes(const GURL& url, bool include_whitelist_hashes,
208 std::vector<SBFullHash>* full_hashes); 200 std::vector<SBFullHash>* full_hashes);
209
210 // Given a URL, returns all the hosts we need to check. They are returned
211 // in order of size (i.e. b.c is first, then a.b.c).
212 void GenerateHostsToCheck(const GURL& url, std::vector<std::string>* hosts);
213
214 // Given a URL, returns all the paths we need to check.
215 void GeneratePathsToCheck(const GURL& url, std::vector<std::string>* paths);
216
217 // Given a URL, returns all the patterns we need to check.
218 void GeneratePatternsToCheck(const GURL& url, std::vector<std::string>* urls);
219
220 } // namespace safe_browsing 201 } // namespace safe_browsing
221 202
222 #endif // COMPONENTS_SAFE_BROWSING_DB_UTIL_H_ 203 #endif // COMPONENTS_SAFE_BROWSING_DB_UTIL_H_
OLDNEW
« no previous file with comments | « components/safe_browsing_db/BUILD.gn ('k') | components/safe_browsing_db/util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698