OLD | NEW |
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 Loading... |
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 = StartsWithASCII(request.GetOriginalURL().spec(), | 181 bool is_blacklist_request = base::StartsWithASCII( |
182 kSuggestionsBlacklistURLPrefix, | 182 request.GetOriginalURL().spec(), kSuggestionsBlacklistURLPrefix, true); |
183 true); | |
184 if (!is_blacklist_request) return false; | 183 if (!is_blacklist_request) return false; |
185 | 184 |
186 // Extract the blacklisted URL from the blacklist request. | 185 // Extract the blacklisted URL from the blacklist request. |
187 std::string blacklisted; | 186 std::string blacklisted; |
188 if (!net::GetValueForKeyInQuery( | 187 if (!net::GetValueForKeyInQuery( |
189 request.GetOriginalURL(), | 188 request.GetOriginalURL(), |
190 kSuggestionsBlacklistURLParam, | 189 kSuggestionsBlacklistURLParam, |
191 &blacklisted)) { | 190 &blacklisted)) { |
192 return false; | 191 return false; |
193 } | 192 } |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 scheduling_delay_ = TimeDelta::FromSeconds(kDefaultSchedulingDelaySec); | 360 scheduling_delay_ = TimeDelta::FromSeconds(kDefaultSchedulingDelaySec); |
362 } else { | 361 } else { |
363 TimeDelta candidate_delay = | 362 TimeDelta candidate_delay = |
364 scheduling_delay_ * kSchedulingBackoffMultiplier; | 363 scheduling_delay_ * kSchedulingBackoffMultiplier; |
365 if (candidate_delay < TimeDelta::FromSeconds(kSchedulingMaxDelaySec)) | 364 if (candidate_delay < TimeDelta::FromSeconds(kSchedulingMaxDelaySec)) |
366 scheduling_delay_ = candidate_delay; | 365 scheduling_delay_ = candidate_delay; |
367 } | 366 } |
368 } | 367 } |
369 | 368 |
370 } // namespace suggestions | 369 } // namespace suggestions |
OLD | NEW |