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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 SuggestionsService::SuggestionsService( | 120 SuggestionsService::SuggestionsService( |
121 net::URLRequestContextGetter* url_request_context, | 121 net::URLRequestContextGetter* url_request_context, |
122 scoped_ptr<SuggestionsStore> suggestions_store, | 122 scoped_ptr<SuggestionsStore> suggestions_store, |
123 scoped_ptr<ImageManager> thumbnail_manager, | 123 scoped_ptr<ImageManager> thumbnail_manager, |
124 scoped_ptr<BlacklistStore> blacklist_store) | 124 scoped_ptr<BlacklistStore> blacklist_store) |
125 : suggestions_store_(suggestions_store.Pass()), | 125 : suggestions_store_(suggestions_store.Pass()), |
126 blacklist_store_(blacklist_store.Pass()), | 126 blacklist_store_(blacklist_store.Pass()), |
127 thumbnail_manager_(thumbnail_manager.Pass()), | 127 thumbnail_manager_(thumbnail_manager.Pass()), |
128 url_request_context_(url_request_context), | 128 url_request_context_(url_request_context), |
129 blacklist_delay_sec_(kBlacklistDefaultDelaySec), | 129 blacklist_delay_sec_(kBlacklistDefaultDelaySec), |
130 weak_ptr_factory_(this), | 130 request_timeout_ms_(kDefaultRequestTimeoutMs), |
131 request_timeout_ms_(kDefaultRequestTimeoutMs) { | 131 weak_ptr_factory_(this) { |
132 // Obtain various parameters from Variations. | 132 // Obtain various parameters from Variations. |
133 suggestions_url_ = | 133 suggestions_url_ = |
134 GURL(GetExperimentParam(kSuggestionsFieldTrialURLParam) + "?" + | 134 GURL(GetExperimentParam(kSuggestionsFieldTrialURLParam) + "?" + |
135 GetExperimentParam(kSuggestionsFieldTrialCommonParamsParam)); | 135 GetExperimentParam(kSuggestionsFieldTrialCommonParamsParam)); |
136 blacklist_url_prefix_ = GetBlacklistUrlPrefix(); | 136 blacklist_url_prefix_ = GetBlacklistUrlPrefix(); |
137 std::string timeout = GetExperimentParam(kSuggestionsFieldTrialTimeoutMs); | 137 std::string timeout = GetExperimentParam(kSuggestionsFieldTrialTimeoutMs); |
138 int temp_timeout; | 138 int temp_timeout; |
139 if (!timeout.empty() && base::StringToInt(timeout, &temp_timeout)) { | 139 if (!timeout.empty() && base::StringToInt(timeout, &temp_timeout)) { |
140 request_timeout_ms_ = temp_timeout; | 140 request_timeout_ms_ = temp_timeout; |
141 } | 141 } |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 if (last_request_successful) { | 416 if (last_request_successful) { |
417 blacklist_delay_sec_ = kBlacklistDefaultDelaySec; | 417 blacklist_delay_sec_ = kBlacklistDefaultDelaySec; |
418 } else { | 418 } else { |
419 int candidate_delay = blacklist_delay_sec_ * kBlacklistBackoffMultiplier; | 419 int candidate_delay = blacklist_delay_sec_ * kBlacklistBackoffMultiplier; |
420 if (candidate_delay < kBlacklistMaxDelaySec) | 420 if (candidate_delay < kBlacklistMaxDelaySec) |
421 blacklist_delay_sec_ = candidate_delay; | 421 blacklist_delay_sec_ = candidate_delay; |
422 } | 422 } |
423 } | 423 } |
424 | 424 |
425 } // namespace suggestions | 425 } // namespace suggestions |
OLD | NEW |