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 variations::GetVariationParamValue(kSuggestionsFieldTrialName, key); | 56 return chrome_variations::GetVariationParamValue(kSuggestionsFieldTrialName, |
| 57 key); |
57 } | 58 } |
58 | 59 |
59 GURL BuildBlacklistRequestURL(const std::string& blacklist_url_prefix, | 60 GURL BuildBlacklistRequestURL(const std::string& blacklist_url_prefix, |
60 const GURL& candidate_url) { | 61 const GURL& candidate_url) { |
61 return GURL(blacklist_url_prefix + | 62 return GURL(blacklist_url_prefix + |
62 net::EscapeQueryParamValue(candidate_url.spec(), true)); | 63 net::EscapeQueryParamValue(candidate_url.spec(), true)); |
63 } | 64 } |
64 | 65 |
65 // Runs each callback in |requestors| on |suggestions|, then deallocates | 66 // Runs each callback in |requestors| on |suggestions|, then deallocates |
66 // |requestors|. | 67 // |requestors|. |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 if (last_request_successful) { | 379 if (last_request_successful) { |
379 blacklist_delay_sec_ = kBlacklistDefaultDelaySec; | 380 blacklist_delay_sec_ = kBlacklistDefaultDelaySec; |
380 } else { | 381 } else { |
381 int candidate_delay = blacklist_delay_sec_ * kBlacklistBackoffMultiplier; | 382 int candidate_delay = blacklist_delay_sec_ * kBlacklistBackoffMultiplier; |
382 if (candidate_delay < kBlacklistMaxDelaySec) | 383 if (candidate_delay < kBlacklistMaxDelaySec) |
383 blacklist_delay_sec_ = candidate_delay; | 384 blacklist_delay_sec_ = candidate_delay; |
384 } | 385 } |
385 } | 386 } |
386 | 387 |
387 } // namespace suggestions | 388 } // namespace suggestions |
OLD | NEW |