| 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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" | 
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" | 
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 112       thumbnail_manager_(thumbnail_manager.Pass()), | 112       thumbnail_manager_(thumbnail_manager.Pass()), | 
| 113       blacklist_store_(blacklist_store.Pass()), | 113       blacklist_store_(blacklist_store.Pass()), | 
| 114       scheduling_delay_(TimeDelta::FromSeconds(kDefaultSchedulingDelaySec)), | 114       scheduling_delay_(TimeDelta::FromSeconds(kDefaultSchedulingDelaySec)), | 
| 115       suggestions_url_(kSuggestionsURL), | 115       suggestions_url_(kSuggestionsURL), | 
| 116       blacklist_url_prefix_(kSuggestionsBlacklistURLPrefix), | 116       blacklist_url_prefix_(kSuggestionsBlacklistURLPrefix), | 
| 117       weak_ptr_factory_(this) {} | 117       weak_ptr_factory_(this) {} | 
| 118 | 118 | 
| 119 SuggestionsService::~SuggestionsService() {} | 119 SuggestionsService::~SuggestionsService() {} | 
| 120 | 120 | 
| 121 // static | 121 // static | 
| 122 bool SuggestionsService::IsEnabled() { |  | 
| 123   return GetExperimentParam(kSuggestionsFieldTrialStateParam) == |  | 
| 124       kSuggestionsFieldTrialStateEnabled; |  | 
| 125 } |  | 
| 126 |  | 
| 127 // static |  | 
| 128 bool SuggestionsService::IsControlGroup() { | 122 bool SuggestionsService::IsControlGroup() { | 
| 129   return GetExperimentParam(kSuggestionsFieldTrialControlParam) == | 123   return GetExperimentParam(kSuggestionsFieldTrialControlParam) == | 
| 130       kSuggestionsFieldTrialStateEnabled; | 124       kSuggestionsFieldTrialStateEnabled; | 
| 131 } | 125 } | 
| 132 | 126 | 
| 133 void SuggestionsService::FetchSuggestionsData( | 127 void SuggestionsService::FetchSuggestionsData( | 
| 134     SyncState sync_state, | 128     SyncState sync_state, | 
| 135     SuggestionsService::ResponseCallback callback) { | 129     SuggestionsService::ResponseCallback callback) { | 
| 136   DCHECK(thread_checker_.CalledOnValidThread()); | 130   DCHECK(thread_checker_.CalledOnValidThread()); | 
| 137   waiting_requestors_.push_back(callback); | 131   waiting_requestors_.push_back(callback); | 
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 382     scheduling_delay_ = TimeDelta::FromSeconds(kDefaultSchedulingDelaySec); | 376     scheduling_delay_ = TimeDelta::FromSeconds(kDefaultSchedulingDelaySec); | 
| 383   } else { | 377   } else { | 
| 384     TimeDelta candidate_delay = | 378     TimeDelta candidate_delay = | 
| 385         scheduling_delay_ * kSchedulingBackoffMultiplier; | 379         scheduling_delay_ * kSchedulingBackoffMultiplier; | 
| 386     if (candidate_delay < TimeDelta::FromSeconds(kSchedulingMaxDelaySec)) | 380     if (candidate_delay < TimeDelta::FromSeconds(kSchedulingMaxDelaySec)) | 
| 387       scheduling_delay_ = candidate_delay; | 381       scheduling_delay_ = candidate_delay; | 
| 388   } | 382   } | 
| 389 } | 383 } | 
| 390 | 384 | 
| 391 }  // namespace suggestions | 385 }  // namespace suggestions | 
| OLD | NEW | 
|---|