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

Side by Side Diff: components/suggestions/suggestions_service.cc

Issue 1242023005: Remove legacy StartsWithASCII function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: y Created 5 years, 5 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 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/suggestions/suggestions_service.h" 5 #include "components/suggestions/suggestions_service.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 waiting_requestors_.push_back(callback); 171 waiting_requestors_.push_back(callback);
172 ServeFromCache(); 172 ServeFromCache();
173 return; 173 return;
174 } 174 }
175 fail_callback.Run(); 175 fail_callback.Run();
176 } 176 }
177 177
178 // static 178 // static
179 bool SuggestionsService::GetBlacklistedUrl(const net::URLFetcher& request, 179 bool SuggestionsService::GetBlacklistedUrl(const net::URLFetcher& request,
180 GURL* url) { 180 GURL* url) {
181 bool is_blacklist_request = base::StartsWithASCII( 181 bool is_blacklist_request = base::StartsWith(
182 request.GetOriginalURL().spec(), kSuggestionsBlacklistURLPrefix, true); 182 request.GetOriginalURL().spec(), kSuggestionsBlacklistURLPrefix,
183 base::CompareCase::SENSITIVE);
183 if (!is_blacklist_request) return false; 184 if (!is_blacklist_request) return false;
184 185
185 // Extract the blacklisted URL from the blacklist request. 186 // Extract the blacklisted URL from the blacklist request.
186 std::string blacklisted; 187 std::string blacklisted;
187 if (!net::GetValueForKeyInQuery( 188 if (!net::GetValueForKeyInQuery(
188 request.GetOriginalURL(), 189 request.GetOriginalURL(),
189 kSuggestionsBlacklistURLParam, 190 kSuggestionsBlacklistURLParam,
190 &blacklisted)) { 191 &blacklisted)) {
191 return false; 192 return false;
192 } 193 }
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 scheduling_delay_ = TimeDelta::FromSeconds(kDefaultSchedulingDelaySec); 361 scheduling_delay_ = TimeDelta::FromSeconds(kDefaultSchedulingDelaySec);
361 } else { 362 } else {
362 TimeDelta candidate_delay = 363 TimeDelta candidate_delay =
363 scheduling_delay_ * kSchedulingBackoffMultiplier; 364 scheduling_delay_ * kSchedulingBackoffMultiplier;
364 if (candidate_delay < TimeDelta::FromSeconds(kSchedulingMaxDelaySec)) 365 if (candidate_delay < TimeDelta::FromSeconds(kSchedulingMaxDelaySec))
365 scheduling_delay_ = candidate_delay; 366 scheduling_delay_ = candidate_delay;
366 } 367 }
367 } 368 }
368 369
369 } // namespace suggestions 370 } // namespace suggestions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698