| OLD | NEW |
| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 #if BUILDFLAG(ENABLE_SPELLCHECK) | 89 #if BUILDFLAG(ENABLE_SPELLCHECK) |
| 90 #include "components/spellcheck/browser/pref_names.h" | 90 #include "components/spellcheck/browser/pref_names.h" |
| 91 #endif | 91 #endif |
| 92 | 92 |
| 93 namespace policy { | 93 namespace policy { |
| 94 | 94 |
| 95 namespace { | 95 namespace { |
| 96 | 96 |
| 97 // List of policy types to preference names. This is used for simple policies | 97 // List of policy types to preference names. This is used for simple policies |
| 98 // that directly map to a single preference. | 98 // that directly map to a single preference. |
| 99 // clang-format off |
| 99 const PolicyToPreferenceMapEntry kSimplePolicyMap[] = { | 100 const PolicyToPreferenceMapEntry kSimplePolicyMap[] = { |
| 100 { key::kHomepageLocation, | 101 { key::kHomepageLocation, |
| 101 prefs::kHomePage, | 102 prefs::kHomePage, |
| 102 base::Value::TYPE_STRING }, | 103 base::Value::TYPE_STRING }, |
| 103 { key::kHomepageIsNewTabPage, | 104 { key::kHomepageIsNewTabPage, |
| 104 prefs::kHomePageIsNewTabPage, | 105 prefs::kHomePageIsNewTabPage, |
| 105 base::Value::TYPE_BOOLEAN }, | 106 base::Value::TYPE_BOOLEAN }, |
| 106 { key::kRestoreOnStartupURLs, | 107 { key::kRestoreOnStartupURLs, |
| 107 prefs::kURLsToRestoreOnStartup, | 108 prefs::kURLsToRestoreOnStartup, |
| 108 base::Value::TYPE_LIST }, | 109 base::Value::TYPE_LIST }, |
| 109 { key::kAlternateErrorPagesEnabled, | 110 { key::kAlternateErrorPagesEnabled, |
| 110 prefs::kAlternateErrorPagesEnabled, | 111 prefs::kAlternateErrorPagesEnabled, |
| 111 base::Value::TYPE_BOOLEAN }, | 112 base::Value::TYPE_BOOLEAN }, |
| 112 { key::kSearchSuggestEnabled, | 113 { key::kSearchSuggestEnabled, |
| 113 prefs::kSearchSuggestEnabled, | 114 prefs::kSearchSuggestEnabled, |
| 114 base::Value::TYPE_BOOLEAN }, | 115 base::Value::TYPE_BOOLEAN }, |
| 115 { key::kBuiltInDnsClientEnabled, | 116 { key::kBuiltInDnsClientEnabled, |
| 116 prefs::kBuiltInDnsClientEnabled, | 117 prefs::kBuiltInDnsClientEnabled, |
| 117 base::Value::TYPE_BOOLEAN }, | 118 base::Value::TYPE_BOOLEAN }, |
| 118 { key::kWPADQuickCheckEnabled, | 119 { key::kWPADQuickCheckEnabled, |
| 119 prefs::kQuickCheckEnabled, | 120 prefs::kQuickCheckEnabled, |
| 120 base::Value::TYPE_BOOLEAN }, | 121 base::Value::TYPE_BOOLEAN }, |
| 121 { key::kPacHttpsUrlStrippingEnabled, | 122 { key::kPacHttpsUrlStrippingEnabled, |
| 122 prefs::kPacHttpsUrlStrippingEnabled, | 123 prefs::kPacHttpsUrlStrippingEnabled, |
| 123 base::Value::TYPE_BOOLEAN }, | 124 base::Value::TYPE_BOOLEAN }, |
| 125 { key::kQuicAllowed, |
| 126 prefs::kQuicAllowed, |
| 127 base::Value::TYPE_BOOLEAN }, |
| 124 { key::kSafeBrowsingEnabled, | 128 { key::kSafeBrowsingEnabled, |
| 125 prefs::kSafeBrowsingEnabled, | 129 prefs::kSafeBrowsingEnabled, |
| 126 base::Value::TYPE_BOOLEAN }, | 130 base::Value::TYPE_BOOLEAN }, |
| 127 { key::kForceGoogleSafeSearch, | 131 { key::kForceGoogleSafeSearch, |
| 128 prefs::kForceGoogleSafeSearch, | 132 prefs::kForceGoogleSafeSearch, |
| 129 base::Value::TYPE_BOOLEAN }, | 133 base::Value::TYPE_BOOLEAN }, |
| 130 { key::kForceYouTubeRestrict, | 134 { key::kForceYouTubeRestrict, |
| 131 prefs::kForceYouTubeRestrict, | 135 prefs::kForceYouTubeRestrict, |
| 132 base::Value::TYPE_INTEGER}, | 136 base::Value::TYPE_INTEGER}, |
| 133 { key::kPasswordManagerEnabled, | 137 { key::kPasswordManagerEnabled, |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 base::Value::TYPE_DICTIONARY }, | 618 base::Value::TYPE_DICTIONARY }, |
| 615 | 619 |
| 616 { key::kAllowScreenLock, prefs::kAllowScreenLock, base::Value::TYPE_BOOLEAN }, | 620 { key::kAllowScreenLock, prefs::kAllowScreenLock, base::Value::TYPE_BOOLEAN }, |
| 617 | 621 |
| 618 { key::kQuickUnlockModeWhitelist, prefs::kQuickUnlockModeWhitelist, | 622 { key::kQuickUnlockModeWhitelist, prefs::kQuickUnlockModeWhitelist, |
| 619 base::Value::TYPE_LIST }, | 623 base::Value::TYPE_LIST }, |
| 620 { key::kQuickUnlockTimeout, prefs::kQuickUnlockTimeout, | 624 { key::kQuickUnlockTimeout, prefs::kQuickUnlockTimeout, |
| 621 base::Value::TYPE_INTEGER }, | 625 base::Value::TYPE_INTEGER }, |
| 622 #endif | 626 #endif |
| 623 }; | 627 }; |
| 628 // clang-format on |
| 624 | 629 |
| 625 class ForceSafeSearchPolicyHandler : public TypeCheckingPolicyHandler { | 630 class ForceSafeSearchPolicyHandler : public TypeCheckingPolicyHandler { |
| 626 public: | 631 public: |
| 627 ForceSafeSearchPolicyHandler() | 632 ForceSafeSearchPolicyHandler() |
| 628 : TypeCheckingPolicyHandler(key::kForceSafeSearch, | 633 : TypeCheckingPolicyHandler(key::kForceSafeSearch, |
| 629 base::Value::TYPE_BOOLEAN) {} | 634 base::Value::TYPE_BOOLEAN) {} |
| 630 ~ForceSafeSearchPolicyHandler() override {} | 635 ~ForceSafeSearchPolicyHandler() override {} |
| 631 | 636 |
| 632 // ConfigurationPolicyHandler implementation: | 637 // ConfigurationPolicyHandler implementation: |
| 633 void ApplyPolicySettings(const PolicyMap& policies, | 638 void ApplyPolicySettings(const PolicyMap& policies, |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 #endif // defined(OS_CHROMEOS) | 934 #endif // defined(OS_CHROMEOS) |
| 930 | 935 |
| 931 #if BUILDFLAG(ENABLE_PLUGINS) | 936 #if BUILDFLAG(ENABLE_PLUGINS) |
| 932 handlers->AddHandler(base::MakeUnique<PluginPolicyHandler>()); | 937 handlers->AddHandler(base::MakeUnique<PluginPolicyHandler>()); |
| 933 #endif // BUILDFLAG(ENABLE_PLUGINS) | 938 #endif // BUILDFLAG(ENABLE_PLUGINS) |
| 934 | 939 |
| 935 return handlers; | 940 return handlers; |
| 936 } | 941 } |
| 937 | 942 |
| 938 } // namespace policy | 943 } // namespace policy |
| OLD | NEW |