| 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 "components/flags_ui/pref_service_flags_storage.h" | 5 #include "components/flags_ui/pref_service_flags_storage.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "components/flags_ui/flags_ui_pref_names.h" | 9 #include "components/flags_ui/flags_ui_pref_names.h" |
| 10 #include "components/pref_registry/pref_registry_syncable.h" | 10 #include "components/pref_registry/pref_registry_syncable.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 return flags; | 35 return flags; |
| 36 } | 36 } |
| 37 | 37 |
| 38 bool PrefServiceFlagsStorage::SetFlags(const std::set<std::string>& flags) { | 38 bool PrefServiceFlagsStorage::SetFlags(const std::set<std::string>& flags) { |
| 39 ListPrefUpdate update(prefs_, prefs::kEnabledLabsExperiments); | 39 ListPrefUpdate update(prefs_, prefs::kEnabledLabsExperiments); |
| 40 base::ListValue* experiments_list = update.Get(); | 40 base::ListValue* experiments_list = update.Get(); |
| 41 | 41 |
| 42 experiments_list->Clear(); | 42 experiments_list->Clear(); |
| 43 for (std::set<std::string>::const_iterator it = flags.begin(); | 43 for (std::set<std::string>::const_iterator it = flags.begin(); |
| 44 it != flags.end(); ++it) { | 44 it != flags.end(); ++it) { |
| 45 experiments_list->Append(new base::StringValue(*it)); | 45 experiments_list->AppendString(*it); |
| 46 } | 46 } |
| 47 | 47 |
| 48 return true; | 48 return true; |
| 49 } | 49 } |
| 50 | 50 |
| 51 // static | 51 // static |
| 52 void PrefServiceFlagsStorage::RegisterPrefs(PrefRegistrySimple* registry) { | 52 void PrefServiceFlagsStorage::RegisterPrefs(PrefRegistrySimple* registry) { |
| 53 registry->RegisterListPref(prefs::kEnabledLabsExperiments); | 53 registry->RegisterListPref(prefs::kEnabledLabsExperiments); |
| 54 } | 54 } |
| 55 | 55 |
| 56 #if defined(OS_CHROMEOS) | 56 #if defined(OS_CHROMEOS) |
| 57 // static | 57 // static |
| 58 void PrefServiceFlagsStorage::RegisterProfilePrefs( | 58 void PrefServiceFlagsStorage::RegisterProfilePrefs( |
| 59 user_prefs::PrefRegistrySyncable* registry) { | 59 user_prefs::PrefRegistrySyncable* registry) { |
| 60 registry->RegisterListPref(prefs::kEnabledLabsExperiments); | 60 registry->RegisterListPref(prefs::kEnabledLabsExperiments); |
| 61 } | 61 } |
| 62 #endif // defined(OS_CHROMEOS) | 62 #endif // defined(OS_CHROMEOS) |
| 63 | 63 |
| 64 } // namespace flags_ui | 64 } // namespace flags_ui |
| OLD | NEW |