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

Side by Side Diff: components/flags_ui/flags_state.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
« no previous file with comments | « no previous file | components/flags_ui/pref_service_flags_storage.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/flags_state.h" 5 #include "components/flags_ui/flags_state.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/feature_list.h" 8 #include "base/feature_list.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 {kOsAndroid, "Android"}, 75 {kOsAndroid, "Android"},
76 {kOsCrOSOwnerOnly, "Chrome OS (owner only)"}, 76 {kOsCrOSOwnerOnly, "Chrome OS (owner only)"},
77 {kOsIos, "iOS"}, 77 {kOsIos, "iOS"},
78 }; 78 };
79 79
80 // Adds a |StringValue| to |list| for each platform where |bitmask| indicates 80 // Adds a |StringValue| to |list| for each platform where |bitmask| indicates
81 // whether the entry is available on that platform. 81 // whether the entry is available on that platform.
82 void AddOsStrings(unsigned bitmask, base::ListValue* list) { 82 void AddOsStrings(unsigned bitmask, base::ListValue* list) {
83 for (size_t i = 0; i < arraysize(kBitsToOs); ++i) { 83 for (size_t i = 0; i < arraysize(kBitsToOs); ++i) {
84 if (bitmask & kBitsToOs[i].bit) 84 if (bitmask & kBitsToOs[i].bit)
85 list->Append(new base::StringValue(kBitsToOs[i].name)); 85 list->AppendString(kBitsToOs[i].name);
86 } 86 }
87 } 87 }
88 88
89 // Adds the internal names for the specified entry to |names|. 89 // Adds the internal names for the specified entry to |names|.
90 void AddInternalName(const FeatureEntry& e, std::set<std::string>* names) { 90 void AddInternalName(const FeatureEntry& e, std::set<std::string>* names) {
91 switch (e.type) { 91 switch (e.type) {
92 case FeatureEntry::SINGLE_VALUE: 92 case FeatureEntry::SINGLE_VALUE:
93 case FeatureEntry::SINGLE_DISABLE_VALUE: 93 case FeatureEntry::SINGLE_DISABLE_VALUE:
94 names->insert(e.internal_name); 94 names->insert(e.internal_name);
95 break; 95 break;
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 } 631 }
632 632
633 std::set<std::string> new_enabled_entries = 633 std::set<std::string> new_enabled_entries =
634 base::STLSetIntersection<std::set<std::string>>(platform_entries, 634 base::STLSetIntersection<std::set<std::string>>(platform_entries,
635 *result); 635 *result);
636 636
637 result->swap(new_enabled_entries); 637 result->swap(new_enabled_entries);
638 } 638 }
639 639
640 } // namespace flags_ui 640 } // namespace flags_ui
OLDNEW
« no previous file with comments | « no previous file | components/flags_ui/pref_service_flags_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698