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

Side by Side Diff: components/domain_reliability/util.cc

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan Created 4 years, 1 month 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/domain_reliability/util.h" 5 #include "components/domain_reliability/util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 // N.B. This uses a ScopedVector because that's what JSONValueConverter uses 167 // N.B. This uses a ScopedVector because that's what JSONValueConverter uses
168 // for repeated fields of any type, and Config uses JSONValueConverter to parse 168 // for repeated fields of any type, and Config uses JSONValueConverter to parse
169 // JSON configs. 169 // JSON configs.
170 GURL SanitizeURLForReport(const GURL& beacon_url, 170 GURL SanitizeURLForReport(const GURL& beacon_url,
171 const GURL& collector_url, 171 const GURL& collector_url,
172 const ScopedVector<std::string>& path_prefixes) { 172 const ScopedVector<std::string>& path_prefixes) {
173 if (CanReportFullBeaconURLToCollector(beacon_url, collector_url)) 173 if (CanReportFullBeaconURLToCollector(beacon_url, collector_url))
174 return beacon_url.GetAsReferrer(); 174 return beacon_url.GetAsReferrer();
175 175
176 std::string path = beacon_url.path(); 176 std::string path = beacon_url.path().as_string();
177 const std::string empty_path; 177 const std::string empty_path;
178 const std::string* longest_path_prefix = &empty_path; 178 const std::string* longest_path_prefix = &empty_path;
179 for (const std::string* path_prefix : path_prefixes) { 179 for (const std::string* path_prefix : path_prefixes) {
180 if (path.substr(0, path_prefix->length()) == *path_prefix && 180 if (path.substr(0, path_prefix->length()) == *path_prefix &&
181 path_prefix->length() > longest_path_prefix->length()) { 181 path_prefix->length() > longest_path_prefix->length()) {
182 longest_path_prefix = path_prefix; 182 longest_path_prefix = path_prefix;
183 } 183 }
184 } 184 }
185 185
186 GURL::Replacements replacements; 186 GURL::Replacements replacements;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 ActualTime::~ActualTime() {} 228 ActualTime::~ActualTime() {}
229 229
230 base::Time ActualTime::Now() { return base::Time::Now(); } 230 base::Time ActualTime::Now() { return base::Time::Now(); }
231 base::TimeTicks ActualTime::NowTicks() { return base::TimeTicks::Now(); } 231 base::TimeTicks ActualTime::NowTicks() { return base::TimeTicks::Now(); }
232 232
233 std::unique_ptr<MockableTime::Timer> ActualTime::CreateTimer() { 233 std::unique_ptr<MockableTime::Timer> ActualTime::CreateTimer() {
234 return std::unique_ptr<MockableTime::Timer>(new ActualTimer()); 234 return std::unique_ptr<MockableTime::Timer>(new ActualTimer());
235 } 235 }
236 236
237 } // namespace domain_reliability 237 } // namespace domain_reliability
OLDNEW
« no previous file with comments | « components/dom_distiller/core/page_features.cc ('k') | components/history/core/browser/top_sites_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698