OLD | NEW |
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 #include "components/safe_browsing_db/util.h" | 5 #include "components/safe_browsing_db/util.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 *canonicalized_query = escaped_canon_url_str.substr( | 298 *canonicalized_query = escaped_canon_url_str.substr( |
299 final_parsed.query.begin, final_parsed.query.len); | 299 final_parsed.query.begin, final_parsed.query.len); |
300 } | 300 } |
301 } | 301 } |
302 | 302 |
303 void UrlToFullHashes(const GURL& url, | 303 void UrlToFullHashes(const GURL& url, |
304 bool include_whitelist_hashes, | 304 bool include_whitelist_hashes, |
305 std::vector<SBFullHash>* full_hashes) { | 305 std::vector<SBFullHash>* full_hashes) { |
306 // Include this function in traces because it's not cheap so it should be | 306 // Include this function in traces because it's not cheap so it should be |
307 // called sparingly. | 307 // called sparingly. |
308 TRACE_EVENT2("SafeBrowsing", "UrlToFullHashes", "url", url.spec(), | 308 TRACE_EVENT2("loader", "safe_browsing::UrlToFullHashes", "url", url.spec(), |
309 "include_whitelist_hashes", include_whitelist_hashes); | 309 "include_whitelist_hashes", include_whitelist_hashes); |
310 std::vector<std::string> hosts; | 310 std::vector<std::string> hosts; |
311 if (url.HostIsIPAddress()) { | 311 if (url.HostIsIPAddress()) { |
312 hosts.push_back(url.host()); | 312 hosts.push_back(url.host()); |
313 } else { | 313 } else { |
314 GenerateHostsToCheck(url, &hosts); | 314 GenerateHostsToCheck(url, &hosts); |
315 } | 315 } |
316 | 316 |
317 std::vector<std::string> paths; | 317 std::vector<std::string> paths; |
318 GeneratePathsToCheck(url, &paths); | 318 GeneratePathsToCheck(url, &paths); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 GenerateHostsToCheck(url, &hosts); | 407 GenerateHostsToCheck(url, &hosts); |
408 GeneratePathsToCheck(url, &paths); | 408 GeneratePathsToCheck(url, &paths); |
409 for (size_t h = 0; h < hosts.size(); ++h) { | 409 for (size_t h = 0; h < hosts.size(); ++h) { |
410 for (size_t p = 0; p < paths.size(); ++p) { | 410 for (size_t p = 0; p < paths.size(); ++p) { |
411 urls->push_back(hosts[h] + paths[p]); | 411 urls->push_back(hosts[h] + paths[p]); |
412 } | 412 } |
413 } | 413 } |
414 } | 414 } |
415 | 415 |
416 } // namespace safe_browsing | 416 } // namespace safe_browsing |
OLD | NEW |