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

Side by Side Diff: components/safe_browsing_db/v4_protocol_manager_util.cc

Issue 2345573002: Each DatabaseManager gets to decide which stores to track (Closed)
Patch Set: Incorporated nparker@ feedback Created 4 years, 3 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/v4_protocol_manager_util.h" 5 #include "components/safe_browsing_db/v4_protocol_manager_util.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/metrics/sparse_histogram.h" 8 #include "base/metrics/sparse_histogram.h"
9 #include "base/rand_util.h" 9 #include "base/rand_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 void V4ProtocolManagerUtil::UpdateHeaders(net::HttpRequestHeaders* headers) { 230 void V4ProtocolManagerUtil::UpdateHeaders(net::HttpRequestHeaders* headers) {
231 // NOTE(vakh): The following header informs the envelope server (which sits in 231 // NOTE(vakh): The following header informs the envelope server (which sits in
232 // front of Google's stubby server) that the received GET request should be 232 // front of Google's stubby server) that the received GET request should be
233 // interpreted as a POST. 233 // interpreted as a POST.
234 headers->SetHeaderIfMissing("X-HTTP-Method-Override", "POST"); 234 headers->SetHeaderIfMissing("X-HTTP-Method-Override", "POST");
235 } 235 }
236 236
237 // static 237 // static
238 void V4ProtocolManagerUtil::UrlToFullHashes( 238 void V4ProtocolManagerUtil::UrlToFullHashes(
239 const GURL& url, 239 const GURL& url,
240 base::hash_set<FullHash>* full_hashes) { 240 std::unordered_set<FullHash>* full_hashes) {
241 std::string canon_host, canon_path, canon_query; 241 std::string canon_host, canon_path, canon_query;
242 CanonicalizeUrl(url, &canon_host, &canon_path, &canon_query); 242 CanonicalizeUrl(url, &canon_host, &canon_path, &canon_query);
243 243
244 std::vector<std::string> hosts; 244 std::vector<std::string> hosts;
245 if (url.HostIsIPAddress()) { 245 if (url.HostIsIPAddress()) {
246 hosts.push_back(url.host()); 246 hosts.push_back(url.host());
247 } else { 247 } else {
248 GenerateHostVariantsToCheck(canon_host, &hosts); 248 GenerateHostVariantsToCheck(canon_host, &hosts);
249 } 249 }
250 250
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 } 490 }
491 491
492 if (!paths->empty() && paths->back() != path) 492 if (!paths->empty() && paths->back() != path)
493 paths->push_back(path); 493 paths->push_back(path);
494 494
495 if (!query.empty()) 495 if (!query.empty())
496 paths->push_back(path + "?" + query); 496 paths->push_back(path + "?" + query);
497 } 497 }
498 498
499 } // namespace safe_browsing 499 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698