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

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

Issue 2287733002: Switch //components away from base::ListValue::Append(Value*) overload. (Closed)
Patch Set: Test fix Created 4 years, 3 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 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 <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 std::set<std::string> enabled_entries; 480 std::set<std::string> enabled_entries;
481 GetSanitizedEnabledFlags(flags_storage, &enabled_entries); 481 GetSanitizedEnabledFlags(flags_storage, &enabled_entries);
482 482
483 int current_platform = GetCurrentPlatform(); 483 int current_platform = GetCurrentPlatform();
484 484
485 for (size_t i = 0; i < num_feature_entries_; ++i) { 485 for (size_t i = 0; i < num_feature_entries_; ++i) {
486 const FeatureEntry& entry = feature_entries_[i]; 486 const FeatureEntry& entry = feature_entries_[i];
487 if (skip_feature_entry.Run(entry)) 487 if (skip_feature_entry.Run(entry))
488 continue; 488 continue;
489 489
490 base::DictionaryValue* data = new base::DictionaryValue(); 490 std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
491 data->SetString("internal_name", entry.internal_name); 491 data->SetString("internal_name", entry.internal_name);
492 data->SetString("name", l10n_util::GetStringUTF16(entry.visible_name_id)); 492 data->SetString("name", l10n_util::GetStringUTF16(entry.visible_name_id));
493 data->SetString("description", 493 data->SetString("description",
494 l10n_util::GetStringUTF16(entry.visible_description_id)); 494 l10n_util::GetStringUTF16(entry.visible_description_id));
495 495
496 base::ListValue* supported_platforms = new base::ListValue(); 496 base::ListValue* supported_platforms = new base::ListValue();
497 AddOsStrings(entry.supported_platforms, supported_platforms); 497 AddOsStrings(entry.supported_platforms, supported_platforms);
498 data->Set("supported_platforms", supported_platforms); 498 data->Set("supported_platforms", supported_platforms);
499 // True if the switch is not currently passed. 499 // True if the switch is not currently passed.
500 bool is_default_value = IsDefaultValue(entry, enabled_entries); 500 bool is_default_value = IsDefaultValue(entry, enabled_entries);
(...skipping 21 matching lines...) Expand all
522 if (access == kOwnerAccessToFlags && 522 if (access == kOwnerAccessToFlags &&
523 (entry.supported_platforms & kOsCrOSOwnerOnly) != 0) { 523 (entry.supported_platforms & kOsCrOSOwnerOnly) != 0) {
524 supported = true; 524 supported = true;
525 } 525 }
526 #endif 526 #endif
527 #if defined(OS_IOS) 527 #if defined(OS_IOS)
528 if (access == kAppleReviewAccessToFlags) 528 if (access == kAppleReviewAccessToFlags)
529 supported = ((entry.supported_platforms & kOsIosAppleReview) != 0); 529 supported = ((entry.supported_platforms & kOsIosAppleReview) != 0);
530 #endif 530 #endif
531 if (supported) 531 if (supported)
532 supported_entries->Append(data); 532 supported_entries->Append(std::move(data));
533 else 533 else
534 unsupported_entries->Append(data); 534 unsupported_entries->Append(std::move(data));
535 } 535 }
536 } 536 }
537 537
538 // static 538 // static
539 int FlagsState::GetCurrentPlatform() { 539 int FlagsState::GetCurrentPlatform() {
540 #if defined(OS_IOS) // Needs to be before the OS_MACOSX check. 540 #if defined(OS_IOS) // Needs to be before the OS_MACOSX check.
541 return kOsIos; 541 return kOsIos;
542 #elif defined(OS_MACOSX) 542 #elif defined(OS_MACOSX)
543 return kOsMac; 543 return kOsMac;
544 #elif defined(OS_WIN) 544 #elif defined(OS_WIN)
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 } 726 }
727 727
728 std::set<std::string> new_enabled_entries = 728 std::set<std::string> new_enabled_entries =
729 base::STLSetIntersection<std::set<std::string>>(platform_entries, 729 base::STLSetIntersection<std::set<std::string>>(platform_entries,
730 *result); 730 *result);
731 731
732 result->swap(new_enabled_entries); 732 result->swap(new_enabled_entries);
733 } 733 }
734 734
735 } // namespace flags_ui 735 } // namespace flags_ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698