| 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 <sstream> | 7 #include <sstream> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 // Will log the supplied response |state|. | 47 // Will log the supplied response |state|. |
| 48 void LogResponseState(SuggestionsResponseState state) { | 48 void LogResponseState(SuggestionsResponseState state) { |
| 49 UMA_HISTOGRAM_ENUMERATION("Suggestions.ResponseState", state, | 49 UMA_HISTOGRAM_ENUMERATION("Suggestions.ResponseState", state, |
| 50 RESPONSE_STATE_SIZE); | 50 RESPONSE_STATE_SIZE); |
| 51 } | 51 } |
| 52 | 52 |
| 53 // Obtains the experiment parameter under the supplied |key|, or empty string | 53 // Obtains the experiment parameter under the supplied |key|, or empty string |
| 54 // if the parameter does not exist. | 54 // if the parameter does not exist. |
| 55 std::string GetExperimentParam(const std::string& key) { | 55 std::string GetExperimentParam(const std::string& key) { |
| 56 return chrome_variations::GetVariationParamValue(kSuggestionsFieldTrialName, | 56 return variations::GetVariationParamValue(kSuggestionsFieldTrialName, key); |
| 57 key); | |
| 58 } | 57 } |
| 59 | 58 |
| 60 GURL BuildBlacklistRequestURL(const std::string& blacklist_url_prefix, | 59 GURL BuildBlacklistRequestURL(const std::string& blacklist_url_prefix, |
| 61 const GURL& candidate_url) { | 60 const GURL& candidate_url) { |
| 62 return GURL(blacklist_url_prefix + | 61 return GURL(blacklist_url_prefix + |
| 63 net::EscapeQueryParamValue(candidate_url.spec(), true)); | 62 net::EscapeQueryParamValue(candidate_url.spec(), true)); |
| 64 } | 63 } |
| 65 | 64 |
| 66 // Runs each callback in |requestors| on |suggestions|, then deallocates | 65 // Runs each callback in |requestors| on |suggestions|, then deallocates |
| 67 // |requestors|. | 66 // |requestors|. |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 if (last_request_successful) { | 378 if (last_request_successful) { |
| 380 blacklist_delay_sec_ = kBlacklistDefaultDelaySec; | 379 blacklist_delay_sec_ = kBlacklistDefaultDelaySec; |
| 381 } else { | 380 } else { |
| 382 int candidate_delay = blacklist_delay_sec_ * kBlacklistBackoffMultiplier; | 381 int candidate_delay = blacklist_delay_sec_ * kBlacklistBackoffMultiplier; |
| 383 if (candidate_delay < kBlacklistMaxDelaySec) | 382 if (candidate_delay < kBlacklistMaxDelaySec) |
| 384 blacklist_delay_sec_ = candidate_delay; | 383 blacklist_delay_sec_ = candidate_delay; |
| 385 } | 384 } |
| 386 } | 385 } |
| 387 | 386 |
| 388 } // namespace suggestions | 387 } // namespace suggestions |
| OLD | NEW |