OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/prefs/pref_metrics_service.h" | 5 #include "chrome/browser/prefs/pref_metrics_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 histogram_name_prefix, callback)); | 201 histogram_name_prefix, callback)); |
202 } | 202 } |
203 | 203 |
204 void PrefMetricsService::OnPrefChanged( | 204 void PrefMetricsService::OnPrefChanged( |
205 const std::string& histogram_name_prefix, | 205 const std::string& histogram_name_prefix, |
206 const LogHistogramValueCallback& callback, | 206 const LogHistogramValueCallback& callback, |
207 const std::string& path, | 207 const std::string& path, |
208 bool from_sync) { | 208 bool from_sync) { |
209 sync_preferences::PrefServiceSyncable* prefs = | 209 sync_preferences::PrefServiceSyncable* prefs = |
210 PrefServiceSyncableFromProfile(profile_); | 210 PrefServiceSyncableFromProfile(profile_); |
211 const PrefService::Preference* pref = prefs->FindPreference(path.c_str()); | 211 const PrefService::Preference* pref = prefs->FindPreference(path); |
212 DCHECK(pref); | 212 DCHECK(pref); |
213 std::string source_name( | 213 std::string source_name( |
214 from_sync ? ".PulledFromSync" : ".PushedToSync"); | 214 from_sync ? ".PulledFromSync" : ".PushedToSync"); |
215 std::string histogram_name("Settings." + histogram_name_prefix + source_name); | 215 std::string histogram_name("Settings." + histogram_name_prefix + source_name); |
216 callback.Run(histogram_name, pref->GetValue()); | 216 callback.Run(histogram_name, pref->GetValue()); |
217 } | 217 } |
218 | 218 |
219 void PrefMetricsService::LogBooleanPrefChange(const std::string& histogram_name, | 219 void PrefMetricsService::LogBooleanPrefChange(const std::string& histogram_name, |
220 const base::Value* value) { | 220 const base::Value* value) { |
221 bool boolean_value = false; | 221 bool boolean_value = false; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 } | 273 } |
274 | 274 |
275 bool PrefMetricsService::Factory::ServiceIsNULLWhileTesting() const { | 275 bool PrefMetricsService::Factory::ServiceIsNULLWhileTesting() const { |
276 return false; | 276 return false; |
277 } | 277 } |
278 | 278 |
279 content::BrowserContext* PrefMetricsService::Factory::GetBrowserContextToUse( | 279 content::BrowserContext* PrefMetricsService::Factory::GetBrowserContextToUse( |
280 content::BrowserContext* context) const { | 280 content::BrowserContext* context) const { |
281 return chrome::GetBrowserContextRedirectedInIncognito(context); | 281 return chrome::GetBrowserContextRedirectedInIncognito(context); |
282 } | 282 } |
OLD | NEW |