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

Side by Side Diff: chrome/browser/policy/configuration_policy_handler_list_factory.cc

Issue 2476493003: Remove FundamentalValue
Patch Set: Fix Created 4 years, 1 month 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 "chrome/browser/policy/configuration_policy_handler_list_factory.h" 5 #include "chrome/browser/policy/configuration_policy_handler_list_factory.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 const base::Value* value = policies.GetValue(policy_name()); 643 const base::Value* value = policies.GetValue(policy_name());
644 if (value) { 644 if (value) {
645 bool enabled; 645 bool enabled;
646 prefs->SetValue(prefs::kForceGoogleSafeSearch, value->CreateDeepCopy()); 646 prefs->SetValue(prefs::kForceGoogleSafeSearch, value->CreateDeepCopy());
647 647
648 // Note that ForceYouTubeRestrict is an int policy, we cannot simply deep 648 // Note that ForceYouTubeRestrict is an int policy, we cannot simply deep
649 // copy value, which is a boolean. 649 // copy value, which is a boolean.
650 if (value->GetAsBoolean(&enabled)) { 650 if (value->GetAsBoolean(&enabled)) {
651 prefs->SetValue( 651 prefs->SetValue(
652 prefs::kForceYouTubeRestrict, 652 prefs::kForceYouTubeRestrict,
653 base::MakeUnique<base::FundamentalValue>( 653 base::MakeUnique<base::Value>(
654 enabled ? safe_search_util::YOUTUBE_RESTRICT_MODERATE 654 enabled ? safe_search_util::YOUTUBE_RESTRICT_MODERATE
655 : safe_search_util::YOUTUBE_RESTRICT_OFF)); 655 : safe_search_util::YOUTUBE_RESTRICT_OFF));
656 } 656 }
657 } 657 }
658 } 658 }
659 659
660 private: 660 private:
661 DISALLOW_COPY_AND_ASSIGN(ForceSafeSearchPolicyHandler); 661 DISALLOW_COPY_AND_ASSIGN(ForceSafeSearchPolicyHandler);
662 }; 662 };
663 663
(...skipping 10 matching lines...) Expand all
674 // If only the deprecated ForceYouTubeSafetyMode policy is set, 674 // If only the deprecated ForceYouTubeSafetyMode policy is set,
675 // but not ForceYouTubeRestrict, set ForceYouTubeRestrict to Moderate. 675 // but not ForceYouTubeRestrict, set ForceYouTubeRestrict to Moderate.
676 if (policies.GetValue(key::kForceYouTubeRestrict)) 676 if (policies.GetValue(key::kForceYouTubeRestrict))
677 return; 677 return;
678 678
679 const base::Value* value = policies.GetValue(policy_name()); 679 const base::Value* value = policies.GetValue(policy_name());
680 bool enabled; 680 bool enabled;
681 if (value && value->GetAsBoolean(&enabled)) { 681 if (value && value->GetAsBoolean(&enabled)) {
682 prefs->SetValue( 682 prefs->SetValue(
683 prefs::kForceYouTubeRestrict, 683 prefs::kForceYouTubeRestrict,
684 base::MakeUnique<base::FundamentalValue>( 684 base::MakeUnique<base::Value>(
685 enabled ? safe_search_util::YOUTUBE_RESTRICT_MODERATE 685 enabled ? safe_search_util::YOUTUBE_RESTRICT_MODERATE
686 : safe_search_util::YOUTUBE_RESTRICT_OFF)); 686 : safe_search_util::YOUTUBE_RESTRICT_OFF));
687 } 687 }
688 } 688 }
689 689
690 private: 690 private:
691 DISALLOW_COPY_AND_ASSIGN(ForceYouTubeSafetyModePolicyHandler); 691 DISALLOW_COPY_AND_ASSIGN(ForceYouTubeSafetyModePolicyHandler);
692 }; 692 };
693 693
694 #if BUILDFLAG(ENABLE_EXTENSIONS) 694 #if BUILDFLAG(ENABLE_EXTENSIONS)
695 void GetExtensionAllowedTypesMap( 695 void GetExtensionAllowedTypesMap(
696 std::vector<std::unique_ptr<StringMappingListPolicyHandler::MappingEntry>>* 696 std::vector<std::unique_ptr<StringMappingListPolicyHandler::MappingEntry>>*
697 result) { 697 result) {
698 // Mapping from extension type names to Manifest::Type. 698 // Mapping from extension type names to Manifest::Type.
699 for (size_t index = 0; 699 for (size_t index = 0;
700 index < extensions::schema_constants::kAllowedTypesMapSize; 700 index < extensions::schema_constants::kAllowedTypesMapSize;
701 ++index) { 701 ++index) {
702 const extensions::schema_constants::AllowedTypesMapEntry& entry = 702 const extensions::schema_constants::AllowedTypesMapEntry& entry =
703 extensions::schema_constants::kAllowedTypesMap[index]; 703 extensions::schema_constants::kAllowedTypesMap[index];
704 result->push_back( 704 result->push_back(
705 base::MakeUnique<StringMappingListPolicyHandler::MappingEntry>( 705 base::MakeUnique<StringMappingListPolicyHandler::MappingEntry>(
706 entry.name, std::unique_ptr<base::Value>( 706 entry.name, std::unique_ptr<base::Value>(
707 new base::FundamentalValue(entry.manifest_type)))); 707 new base::Value(entry.manifest_type))));
708 } 708 }
709 } 709 }
710 #endif 710 #endif
711 711
712 void GetDeprecatedFeaturesMap( 712 void GetDeprecatedFeaturesMap(
713 std::vector<std::unique_ptr<StringMappingListPolicyHandler::MappingEntry>>* 713 std::vector<std::unique_ptr<StringMappingListPolicyHandler::MappingEntry>>*
714 result) { 714 result) {
715 // Maps feature tags as specified in policy to the corresponding switch to 715 // Maps feature tags as specified in policy to the corresponding switch to
716 // re-enable them. 716 // re-enable them.
717 } 717 }
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 #endif // defined(OS_CHROMEOS) 927 #endif // defined(OS_CHROMEOS)
928 928
929 #if defined(ENABLE_PLUGINS) 929 #if defined(ENABLE_PLUGINS)
930 handlers->AddHandler(base::MakeUnique<PluginPolicyHandler>()); 930 handlers->AddHandler(base::MakeUnique<PluginPolicyHandler>());
931 #endif // defined(ENABLE_PLUGINS) 931 #endif // defined(ENABLE_PLUGINS)
932 932
933 return handlers; 933 return handlers;
934 } 934 }
935 935
936 } // namespace policy 936 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698