| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/metrics/variations/variations_service.h" | 5 #include "chrome/browser/metrics/variations/variations_service.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/build_time.h" | 10 #include "base/build_time.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 // Perform the first fetch. | 154 // Perform the first fetch. |
| 155 FetchVariationsSeed(); | 155 FetchVariationsSeed(); |
| 156 | 156 |
| 157 // Repeat this periodically. | 157 // Repeat this periodically. |
| 158 timer_.Start(FROM_HERE, base::TimeDelta::FromHours(kSeedFetchPeriodHours), | 158 timer_.Start(FROM_HERE, base::TimeDelta::FromHours(kSeedFetchPeriodHours), |
| 159 this, &VariationsService::FetchVariationsSeed); | 159 this, &VariationsService::FetchVariationsSeed); |
| 160 } | 160 } |
| 161 | 161 |
| 162 // static | 162 // static |
| 163 void VariationsService::RegisterPrefs(PrefService* prefs) { | 163 void VariationsService::RegisterPrefs(PrefServiceSimple* prefs) { |
| 164 prefs->RegisterStringPref(prefs::kVariationsSeed, std::string()); | 164 prefs->RegisterStringPref(prefs::kVariationsSeed, std::string()); |
| 165 prefs->RegisterInt64Pref(prefs::kVariationsSeedDate, | 165 prefs->RegisterInt64Pref(prefs::kVariationsSeedDate, |
| 166 base::Time().ToInternalValue()); | 166 base::Time().ToInternalValue()); |
| 167 } | 167 } |
| 168 | 168 |
| 169 void VariationsService::SetCreateTrialsFromSeedCalledForTesting(bool called) { | 169 void VariationsService::SetCreateTrialsFromSeedCalledForTesting(bool called) { |
| 170 create_trials_from_seed_called_ = called; | 170 create_trials_from_seed_called_ = called; |
| 171 } | 171 } |
| 172 | 172 |
| 173 void VariationsService::DoActualFetch() { | 173 void VariationsService::DoActualFetch() { |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 variation_id); | 511 variation_id); |
| 512 } | 512 } |
| 513 } | 513 } |
| 514 | 514 |
| 515 trial->SetForced(); | 515 trial->SetForced(); |
| 516 if (IsStudyExpired(study, reference_date)) | 516 if (IsStudyExpired(study, reference_date)) |
| 517 trial->Disable(); | 517 trial->Disable(); |
| 518 } | 518 } |
| 519 | 519 |
| 520 } // namespace chrome_variations | 520 } // namespace chrome_variations |
| OLD | NEW |