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/prefs/chrome_pref_service_factory.h" | 5 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 GROUP_ENFORCE_DEFAULT; | 245 GROUP_ENFORCE_DEFAULT; |
246 #else | 246 #else |
247 GROUP_NO_ENFORCEMENT; | 247 GROUP_NO_ENFORCEMENT; |
248 #endif | 248 #endif |
249 bool group_determined_from_trial = false; | 249 bool group_determined_from_trial = false; |
250 base::FieldTrial* trial = | 250 base::FieldTrial* trial = |
251 base::FieldTrialList::Find( | 251 base::FieldTrialList::Find( |
252 chrome_prefs::internals::kSettingsEnforcementTrialName); | 252 chrome_prefs::internals::kSettingsEnforcementTrialName); |
253 if (trial) { | 253 if (trial) { |
254 const std::string& group_name = trial->group_name(); | 254 const std::string& group_name = trial->group_name(); |
255 // ARRAYSIZE_UNSAFE must be used since the array is declared locally; it is | 255 for (size_t i = 0; i < arraysize(kEnforcementLevelMap); ++i) { |
256 // only unsafe because it could not trigger a compile error on some | |
257 // non-array pointer types; this is fine since kEnforcementLevelMap is | |
258 // clearly an array. | |
259 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kEnforcementLevelMap); ++i) { | |
260 if (kEnforcementLevelMap[i].group_name == group_name) { | 256 if (kEnforcementLevelMap[i].group_name == group_name) { |
261 enforcement_group = kEnforcementLevelMap[i].group; | 257 enforcement_group = kEnforcementLevelMap[i].group; |
262 group_determined_from_trial = true; | 258 group_determined_from_trial = true; |
263 break; | 259 break; |
264 } | 260 } |
265 } | 261 } |
266 } | 262 } |
267 UMA_HISTOGRAM_BOOLEAN("Settings.EnforcementGroupDeterminedFromTrial", | 263 UMA_HISTOGRAM_BOOLEAN("Settings.EnforcementGroupDeterminedFromTrial", |
268 group_determined_from_trial); | 264 group_determined_from_trial); |
269 return enforcement_group; | 265 return enforcement_group; |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 | 513 |
518 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 514 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
519 ProfilePrefStoreManager::RegisterProfilePrefs(registry); | 515 ProfilePrefStoreManager::RegisterProfilePrefs(registry); |
520 } | 516 } |
521 | 517 |
522 void RegisterPrefs(PrefRegistrySimple* registry) { | 518 void RegisterPrefs(PrefRegistrySimple* registry) { |
523 ProfilePrefStoreManager::RegisterPrefs(registry); | 519 ProfilePrefStoreManager::RegisterPrefs(registry); |
524 } | 520 } |
525 | 521 |
526 } // namespace chrome_prefs | 522 } // namespace chrome_prefs |
OLD | NEW |