Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: chrome/browser/metrics/variations/variations_service.cc

Issue 11741003: Remove PrefServiceSimple, replacing it with PrefService and PrefRegistrySimple. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Switch to desired interfaces. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/metrics/field_trial.h" 13 #include "base/metrics/field_trial.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/version.h" 15 #include "base/version.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/metrics/proto/trials_seed.pb.h" 17 #include "chrome/browser/metrics/proto/trials_seed.pb.h"
18 #include "chrome/browser/prefs/pref_registry_simple.h"
18 #include "chrome/browser/prefs/pref_service.h" 19 #include "chrome/browser/prefs/pref_service.h"
19 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/metrics/variations/variations_util.h" 21 #include "chrome/common/metrics/variations/variations_util.h"
21 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
22 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
23 #include "content/public/common/url_fetcher.h" 24 #include "content/public/common/url_fetcher.h"
24 #include "googleurl/src/gurl.h" 25 #include "googleurl/src/gurl.h"
25 #include "net/base/load_flags.h" 26 #include "net/base/load_flags.h"
26 #include "net/base/network_change_notifier.h" 27 #include "net/base/network_change_notifier.h"
27 #include "net/http/http_response_headers.h" 28 #include "net/http/http_response_headers.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // Repeat this periodically. 186 // Repeat this periodically.
186 timer_.Start(FROM_HERE, base::TimeDelta::FromHours(kSeedFetchPeriodHours), 187 timer_.Start(FROM_HERE, base::TimeDelta::FromHours(kSeedFetchPeriodHours),
187 this, &VariationsService::FetchVariationsSeed); 188 this, &VariationsService::FetchVariationsSeed);
188 } 189 }
189 190
190 void VariationsService::SetCreateTrialsFromSeedCalledForTesting(bool called) { 191 void VariationsService::SetCreateTrialsFromSeedCalledForTesting(bool called) {
191 create_trials_from_seed_called_ = called; 192 create_trials_from_seed_called_ = called;
192 } 193 }
193 194
194 // static 195 // static
195 void VariationsService::RegisterPrefs(PrefServiceSimple* prefs) { 196 void VariationsService::RegisterPrefs(PrefRegistrySimple* prefs) {
196 prefs->RegisterStringPref(prefs::kVariationsSeed, std::string()); 197 prefs
198 ->RegisterStringPref(prefs::kVariationsSeed, std::string());
197 prefs->RegisterInt64Pref(prefs::kVariationsSeedDate, 199 prefs->RegisterInt64Pref(prefs::kVariationsSeedDate,
198 base::Time().ToInternalValue()); 200 base::Time().ToInternalValue());
199 } 201 }
200 202
201 // static 203 // static
202 VariationsService* VariationsService::Create() { 204 VariationsService* VariationsService::Create() {
203 // This is temporarily disabled for Android. See http://crbug.com/168224 205 // This is temporarily disabled for Android. See http://crbug.com/168224
204 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_ANDROID) 206 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_ANDROID)
205 // Unless the URL was provided, unsupported builds should return NULL to 207 // Unless the URL was provided, unsupported builds should return NULL to
206 // indicate that the service should not be used. 208 // indicate that the service should not be used.
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 variation_id); 555 variation_id);
554 } 556 }
555 } 557 }
556 558
557 trial->SetForced(); 559 trial->SetForced();
558 if (IsStudyExpired(study, reference_date)) 560 if (IsStudyExpired(study, reference_date))
559 trial->Disable(); 561 trial->Disable();
560 } 562 }
561 563
562 } // namespace chrome_variations 564 } // namespace chrome_variations
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698