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

Side by Side Diff: components/flags_ui/pref_service_flags_storage.cc

Issue 2030833003: Remove ListValue::Append(new {Fundamental,String}Value(...)) pattern in //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
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
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
OLDNEW
« no previous file with comments | « components/flags_ui/flags_state.cc ('k') | components/json_schema/json_schema_validator_unittest_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698