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

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: Respond to review comments. Created 7 years, 10 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 void VariationsService::StartGoogleUpdateRegistrySync() { 192 void VariationsService::StartGoogleUpdateRegistrySync() {
192 registry_syncer_.RequestRegistrySync(); 193 registry_syncer_.RequestRegistrySync();
193 } 194 }
194 #endif 195 #endif
195 196
196 void VariationsService::SetCreateTrialsFromSeedCalledForTesting(bool called) { 197 void VariationsService::SetCreateTrialsFromSeedCalledForTesting(bool called) {
197 create_trials_from_seed_called_ = called; 198 create_trials_from_seed_called_ = called;
198 } 199 }
199 200
200 // static 201 // static
201 void VariationsService::RegisterPrefs(PrefServiceSimple* prefs) { 202 void VariationsService::RegisterPrefs(PrefRegistrySimple* prefs) {
202 prefs->RegisterStringPref(prefs::kVariationsSeed, std::string()); 203 prefs
Mattias Nissler (ping if slow) 2013/01/31 13:06:25 remove accidental newline.
Jói 2013/01/31 13:43:42 Done. Found a couple of other places like this whi
204 ->RegisterStringPref(prefs::kVariationsSeed, std::string());
203 prefs->RegisterInt64Pref(prefs::kVariationsSeedDate, 205 prefs->RegisterInt64Pref(prefs::kVariationsSeedDate,
204 base::Time().ToInternalValue()); 206 base::Time().ToInternalValue());
205 } 207 }
206 208
207 // static 209 // static
208 VariationsService* VariationsService::Create() { 210 VariationsService* VariationsService::Create() {
209 // This is temporarily disabled for Android. See http://crbug.com/168224 211 // This is temporarily disabled for Android. See http://crbug.com/168224
210 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_ANDROID) 212 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_ANDROID)
211 // Unless the URL was provided, unsupported builds should return NULL to 213 // Unless the URL was provided, unsupported builds should return NULL to
212 // indicate that the service should not be used. 214 // indicate that the service should not be used.
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 variation_id); 561 variation_id);
560 } 562 }
561 } 563 }
562 564
563 trial->SetForced(); 565 trial->SetForced();
564 if (IsStudyExpired(study, reference_date)) 566 if (IsStudyExpired(study, reference_date))
565 trial->Disable(); 567 trial->Disable();
566 } 568 }
567 569
568 } // namespace chrome_variations 570 } // namespace chrome_variations
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698