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

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

Issue 2529083002: Make extensions developer mode adhere to policy (Closed)
Patch Set: Rebase Created 4 years 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 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 index < extensions::schema_constants::kAllowedTypesMapSize; 705 index < extensions::schema_constants::kAllowedTypesMapSize;
706 ++index) { 706 ++index) {
707 const extensions::schema_constants::AllowedTypesMapEntry& entry = 707 const extensions::schema_constants::AllowedTypesMapEntry& entry =
708 extensions::schema_constants::kAllowedTypesMap[index]; 708 extensions::schema_constants::kAllowedTypesMap[index];
709 result->push_back( 709 result->push_back(
710 base::MakeUnique<StringMappingListPolicyHandler::MappingEntry>( 710 base::MakeUnique<StringMappingListPolicyHandler::MappingEntry>(
711 entry.name, std::unique_ptr<base::Value>( 711 entry.name, std::unique_ptr<base::Value>(
712 new base::FundamentalValue(entry.manifest_type)))); 712 new base::FundamentalValue(entry.manifest_type))));
713 } 713 }
714 } 714 }
715
716 // Piggy-back kDeveloperToolsDisabled set to true to also force-disable
717 // kExtensionsUIDeveloperMode.
718 class DevToolsExtensionsUIPolicyHandler : public TypeCheckingPolicyHandler {
719 public:
720 DevToolsExtensionsUIPolicyHandler()
721 : TypeCheckingPolicyHandler(key::kDeveloperToolsDisabled,
722 base::Value::Type::BOOLEAN) {}
723 ~DevToolsExtensionsUIPolicyHandler() override {}
724
725 // ConfigurationPolicyHandler implementation:
726 void ApplyPolicySettings(const PolicyMap& policies,
727 PrefValueMap* prefs) override {
728 const base::Value* value = policies.GetValue(policy_name());
729 bool developerToolsDisabled;
730 if (value && value->GetAsBoolean(&developerToolsDisabled) &&
731 developerToolsDisabled) {
732 prefs->SetValue(prefs::kExtensionsUIDeveloperMode,
733 base::MakeUnique<base::FundamentalValue>(false));
734 }
735 }
736
737 private:
738 DISALLOW_COPY_AND_ASSIGN(DevToolsExtensionsUIPolicyHandler);
739 };
715 #endif 740 #endif
716 741
717 void GetDeprecatedFeaturesMap( 742 void GetDeprecatedFeaturesMap(
718 std::vector<std::unique_ptr<StringMappingListPolicyHandler::MappingEntry>>* 743 std::vector<std::unique_ptr<StringMappingListPolicyHandler::MappingEntry>>*
719 result) { 744 result) {
720 // Maps feature tags as specified in policy to the corresponding switch to 745 // Maps feature tags as specified in policy to the corresponding switch to
721 // re-enable them. 746 // re-enable them.
722 } 747 }
723 748
724 } // namespace 749 } // namespace
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 handlers->AddHandler( 816 handlers->AddHandler(
792 base::MakeUnique<extensions::ExtensionURLPatternListPolicyHandler>( 817 base::MakeUnique<extensions::ExtensionURLPatternListPolicyHandler>(
793 key::kExtensionInstallSources, 818 key::kExtensionInstallSources,
794 extensions::pref_names::kAllowedInstallSites)); 819 extensions::pref_names::kAllowedInstallSites));
795 handlers->AddHandler(base::MakeUnique<StringMappingListPolicyHandler>( 820 handlers->AddHandler(base::MakeUnique<StringMappingListPolicyHandler>(
796 key::kExtensionAllowedTypes, extensions::pref_names::kAllowedTypes, 821 key::kExtensionAllowedTypes, extensions::pref_names::kAllowedTypes,
797 base::Bind(GetExtensionAllowedTypesMap))); 822 base::Bind(GetExtensionAllowedTypesMap)));
798 handlers->AddHandler( 823 handlers->AddHandler(
799 base::MakeUnique<extensions::ExtensionSettingsPolicyHandler>( 824 base::MakeUnique<extensions::ExtensionSettingsPolicyHandler>(
800 chrome_schema)); 825 chrome_schema));
826 handlers->AddHandler(base::MakeUnique<DevToolsExtensionsUIPolicyHandler>());
801 #endif 827 #endif
802 828
803 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) 829 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
804 handlers->AddHandler(base::MakeUnique<DiskCacheDirPolicyHandler>()); 830 handlers->AddHandler(base::MakeUnique<DiskCacheDirPolicyHandler>());
805 831
806 handlers->AddHandler( 832 handlers->AddHandler(
807 base::MakeUnique<extensions::NativeMessagingHostListPolicyHandler>( 833 base::MakeUnique<extensions::NativeMessagingHostListPolicyHandler>(
808 key::kNativeMessagingWhitelist, 834 key::kNativeMessagingWhitelist,
809 extensions::pref_names::kNativeMessagingWhitelist, false)); 835 extensions::pref_names::kNativeMessagingWhitelist, false));
810 handlers->AddHandler( 836 handlers->AddHandler(
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 #endif // defined(OS_CHROMEOS) 960 #endif // defined(OS_CHROMEOS)
935 961
936 #if BUILDFLAG(ENABLE_PLUGINS) 962 #if BUILDFLAG(ENABLE_PLUGINS)
937 handlers->AddHandler(base::MakeUnique<PluginPolicyHandler>()); 963 handlers->AddHandler(base::MakeUnique<PluginPolicyHandler>());
938 #endif // BUILDFLAG(ENABLE_PLUGINS) 964 #endif // BUILDFLAG(ENABLE_PLUGINS)
939 965
940 return handlers; 966 return handlers;
941 } 967 }
942 968
943 } // namespace policy 969 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service_test_base.cc ('k') | chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698