| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" | 5 #include "chrome/browser/policy/configuration_policy_handler_list.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/policy/configuration_policy_handler.h" | 9 #include "chrome/browser/policy/configuration_policy_handler.h" |
| 10 #include "chrome/browser/policy/policy_error_map.h" | 10 #include "chrome/browser/policy/policy_error_map.h" |
| 11 #include "chrome/browser/policy/policy_map.h" | 11 #include "chrome/browser/policy/policy_map.h" |
| 12 #include "chrome/browser/prefs/pref_value_map.h" | 12 #include "chrome/browser/prefs/pref_value_map.h" |
| 13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 14 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
| 15 #include "policy/policy_constants.h" | 15 #include "policy/policy_constants.h" |
| 16 | 16 |
| 17 #if defined(OS_CHROMEOS) | 17 #if defined(OS_CHROMEOS) |
| 18 #include "chrome/browser/policy/configuration_policy_handler_chromeos.h" | 18 #include "chrome/browser/policy/configuration_policy_handler_chromeos.h" |
| 19 #endif // defined(OS_CHROMEOS) | 19 #endif // defined(OS_CHROMEOS) |
| 20 | 20 |
| 21 namespace policy { | 21 namespace policy { |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 // Maps a policy type to a preference path, and to the expected value type. | 25 // Maps a policy type to a preference path, and to the expected value type. |
| 26 // This is the entry type of |kSimplePolicyMap| below. | 26 // This is the entry type of |kSimplePolicyMap| below. |
| 27 struct PolicyToPreferenceMapEntry { | 27 struct PolicyToPreferenceMapEntry { |
| 28 const char* policy_name; |
| 29 const char* preference_path; |
| 28 base::Value::Type value_type; | 30 base::Value::Type value_type; |
| 29 ConfigurationPolicyType policy_type; | |
| 30 const char* preference_path; | |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 // List of policy types to preference names. This is used for simple policies | 33 // List of policy types to preference names. This is used for simple policies |
| 34 // that directly map to a single preference. | 34 // that directly map to a single preference. |
| 35 const PolicyToPreferenceMapEntry kSimplePolicyMap[] = { | 35 const PolicyToPreferenceMapEntry kSimplePolicyMap[] = { |
| 36 { Value::TYPE_STRING, kPolicyHomepageLocation, prefs::kHomePage }, | 36 { key::kHomepageLocation, |
| 37 { Value::TYPE_BOOLEAN, kPolicyHomepageIsNewTabPage, | 37 prefs::kHomePage, |
| 38 prefs::kHomePageIsNewTabPage }, | 38 Value::TYPE_STRING }, |
| 39 { Value::TYPE_INTEGER, kPolicyRestoreOnStartup, | 39 { key::kHomepageIsNewTabPage, |
| 40 prefs::kRestoreOnStartup}, | 40 prefs::kHomePageIsNewTabPage, |
| 41 { Value::TYPE_LIST, kPolicyRestoreOnStartupURLs, | 41 Value::TYPE_BOOLEAN }, |
| 42 prefs::kURLsToRestoreOnStartup }, | 42 { key::kRestoreOnStartup, |
| 43 { Value::TYPE_BOOLEAN, kPolicyAlternateErrorPagesEnabled, | 43 prefs::kRestoreOnStartup, |
| 44 prefs::kAlternateErrorPagesEnabled }, | 44 Value::TYPE_INTEGER }, |
| 45 { Value::TYPE_BOOLEAN, kPolicySearchSuggestEnabled, | 45 { key::kRestoreOnStartupURLs, |
| 46 prefs::kSearchSuggestEnabled }, | 46 prefs::kURLsToRestoreOnStartup, |
| 47 { Value::TYPE_BOOLEAN, kPolicyDnsPrefetchingEnabled, | 47 Value::TYPE_LIST }, |
| 48 prefs::kNetworkPredictionEnabled }, | 48 { key::kAlternateErrorPagesEnabled, |
| 49 { Value::TYPE_BOOLEAN, kPolicyDisableSpdy, | 49 prefs::kAlternateErrorPagesEnabled, |
| 50 prefs::kDisableSpdy }, | 50 Value::TYPE_BOOLEAN }, |
| 51 { Value::TYPE_LIST, kPolicyDisabledSchemes, | 51 { key::kSearchSuggestEnabled, |
| 52 prefs::kDisabledSchemes }, | 52 prefs::kSearchSuggestEnabled, |
| 53 { Value::TYPE_BOOLEAN, kPolicySafeBrowsingEnabled, | 53 Value::TYPE_BOOLEAN }, |
| 54 prefs::kSafeBrowsingEnabled }, | 54 { key::kDnsPrefetchingEnabled, |
| 55 { Value::TYPE_BOOLEAN, kPolicyPasswordManagerEnabled, | 55 prefs::kNetworkPredictionEnabled, |
| 56 prefs::kPasswordManagerEnabled }, | 56 Value::TYPE_BOOLEAN }, |
| 57 { Value::TYPE_BOOLEAN, kPolicyPasswordManagerAllowShowPasswords, | 57 { key::kDisableSpdy, |
| 58 prefs::kPasswordManagerAllowShowPasswords }, | 58 prefs::kDisableSpdy, |
| 59 { Value::TYPE_BOOLEAN, kPolicyPrintingEnabled, | 59 Value::TYPE_BOOLEAN }, |
| 60 prefs::kPrintingEnabled }, | 60 { key::kDisabledSchemes, |
| 61 { Value::TYPE_BOOLEAN, kPolicyDisablePrintPreview, | 61 prefs::kDisabledSchemes, |
| 62 prefs::kPrintPreviewDisabled }, | 62 Value::TYPE_LIST }, |
| 63 { Value::TYPE_BOOLEAN, kPolicyMetricsReportingEnabled, | 63 { key::kSafeBrowsingEnabled, |
| 64 prefs::kMetricsReportingEnabled }, | 64 prefs::kSafeBrowsingEnabled, |
| 65 { Value::TYPE_STRING, kPolicyApplicationLocaleValue, | 65 Value::TYPE_BOOLEAN }, |
| 66 prefs::kApplicationLocale}, | 66 { key::kPasswordManagerEnabled, |
| 67 { Value::TYPE_LIST, kPolicyExtensionInstallWhitelist, | 67 prefs::kPasswordManagerEnabled, |
| 68 prefs::kExtensionInstallAllowList}, | 68 Value::TYPE_BOOLEAN }, |
| 69 { Value::TYPE_LIST, kPolicyExtensionInstallBlacklist, | 69 { key::kPasswordManagerAllowShowPasswords, |
| 70 prefs::kExtensionInstallDenyList}, | 70 prefs::kPasswordManagerAllowShowPasswords, |
| 71 { Value::TYPE_LIST, kPolicyExtensionInstallForcelist, | 71 Value::TYPE_BOOLEAN }, |
| 72 prefs::kExtensionInstallForceList}, | 72 { key::kPrintingEnabled, |
| 73 { Value::TYPE_LIST, kPolicyDisabledPlugins, | 73 prefs::kPrintingEnabled, |
| 74 prefs::kPluginsDisabledPlugins}, | 74 Value::TYPE_BOOLEAN }, |
| 75 { Value::TYPE_LIST, kPolicyDisabledPluginsExceptions, | 75 { key::kDisablePrintPreview, |
| 76 prefs::kPluginsDisabledPluginsExceptions}, | 76 prefs::kPrintPreviewDisabled, |
| 77 { Value::TYPE_LIST, kPolicyEnabledPlugins, | 77 Value::TYPE_BOOLEAN }, |
| 78 prefs::kPluginsEnabledPlugins}, | 78 { key::kMetricsReportingEnabled, |
| 79 { Value::TYPE_BOOLEAN, kPolicyShowHomeButton, | 79 prefs::kMetricsReportingEnabled, |
| 80 prefs::kShowHomeButton }, | 80 Value::TYPE_BOOLEAN }, |
| 81 { Value::TYPE_BOOLEAN, kPolicySavingBrowserHistoryDisabled, | 81 { key::kApplicationLocaleValue, |
| 82 prefs::kSavingBrowserHistoryDisabled }, | 82 prefs::kApplicationLocale, |
| 83 { Value::TYPE_BOOLEAN, kPolicyClearSiteDataOnExit, | 83 Value::TYPE_STRING }, |
| 84 prefs::kClearSiteDataOnExit }, | 84 { key::kExtensionInstallWhitelist, |
| 85 { Value::TYPE_BOOLEAN, kPolicyDeveloperToolsDisabled, | 85 prefs::kExtensionInstallAllowList, |
| 86 prefs::kDevToolsDisabled }, | 86 Value::TYPE_LIST }, |
| 87 { Value::TYPE_BOOLEAN, kPolicyBlockThirdPartyCookies, | 87 { key::kExtensionInstallBlacklist, |
| 88 prefs::kBlockThirdPartyCookies }, | 88 prefs::kExtensionInstallDenyList, |
| 89 { Value::TYPE_INTEGER, kPolicyDefaultCookiesSetting, | 89 Value::TYPE_LIST }, |
| 90 prefs::kManagedDefaultCookiesSetting }, | 90 { key::kExtensionInstallForcelist, |
| 91 { Value::TYPE_INTEGER, kPolicyDefaultImagesSetting, | 91 prefs::kExtensionInstallForceList, |
| 92 prefs::kManagedDefaultImagesSetting }, | 92 Value::TYPE_LIST }, |
| 93 { Value::TYPE_INTEGER, kPolicyDefaultPluginsSetting, | 93 { key::kDisabledPlugins, |
| 94 prefs::kManagedDefaultPluginsSetting }, | 94 prefs::kPluginsDisabledPlugins, |
| 95 { Value::TYPE_INTEGER, kPolicyDefaultPopupsSetting, | 95 Value::TYPE_LIST }, |
| 96 prefs::kManagedDefaultPopupsSetting }, | 96 { key::kDisabledPluginsExceptions, |
| 97 { Value::TYPE_LIST, kPolicyAutoSelectCertificateForUrls, | 97 prefs::kPluginsDisabledPluginsExceptions, |
| 98 prefs::kManagedAutoSelectCertificateForUrls}, | 98 Value::TYPE_LIST }, |
| 99 { Value::TYPE_LIST, kPolicyCookiesAllowedForUrls, | 99 { key::kEnabledPlugins, |
| 100 prefs::kManagedCookiesAllowedForUrls }, | 100 prefs::kPluginsEnabledPlugins, |
| 101 { Value::TYPE_LIST, kPolicyCookiesBlockedForUrls, | 101 Value::TYPE_LIST }, |
| 102 prefs::kManagedCookiesBlockedForUrls }, | 102 { key::kShowHomeButton, |
| 103 { Value::TYPE_LIST, kPolicyCookiesSessionOnlyForUrls, | 103 prefs::kShowHomeButton, |
| 104 prefs::kManagedCookiesSessionOnlyForUrls }, | 104 Value::TYPE_BOOLEAN }, |
| 105 { Value::TYPE_LIST, kPolicyImagesAllowedForUrls, | 105 { key::kSavingBrowserHistoryDisabled, |
| 106 prefs::kManagedImagesAllowedForUrls }, | 106 prefs::kSavingBrowserHistoryDisabled, |
| 107 { Value::TYPE_LIST, kPolicyImagesBlockedForUrls, | 107 Value::TYPE_BOOLEAN }, |
| 108 prefs::kManagedImagesBlockedForUrls }, | 108 { key::kClearSiteDataOnExit, |
| 109 { Value::TYPE_LIST, kPolicyJavaScriptAllowedForUrls, | 109 prefs::kClearSiteDataOnExit, |
| 110 prefs::kManagedJavaScriptAllowedForUrls }, | 110 Value::TYPE_BOOLEAN }, |
| 111 { Value::TYPE_LIST, kPolicyJavaScriptBlockedForUrls, | 111 { key::kDeveloperToolsDisabled, |
| 112 prefs::kManagedJavaScriptBlockedForUrls }, | 112 prefs::kDevToolsDisabled, |
| 113 { Value::TYPE_LIST, kPolicyPluginsAllowedForUrls, | 113 Value::TYPE_BOOLEAN }, |
| 114 prefs::kManagedPluginsAllowedForUrls }, | 114 { key::kBlockThirdPartyCookies, |
| 115 { Value::TYPE_LIST, kPolicyPluginsBlockedForUrls, | 115 prefs::kBlockThirdPartyCookies, |
| 116 prefs::kManagedPluginsBlockedForUrls }, | 116 Value::TYPE_BOOLEAN }, |
| 117 { Value::TYPE_LIST, kPolicyPopupsAllowedForUrls, | 117 { key::kDefaultCookiesSetting, |
| 118 prefs::kManagedPopupsAllowedForUrls }, | 118 prefs::kManagedDefaultCookiesSetting, |
| 119 { Value::TYPE_LIST, kPolicyPopupsBlockedForUrls, | 119 Value::TYPE_INTEGER }, |
| 120 prefs::kManagedPopupsBlockedForUrls }, | 120 { key::kDefaultImagesSetting, |
| 121 { Value::TYPE_LIST, kPolicyNotificationsAllowedForUrls, | 121 prefs::kManagedDefaultImagesSetting, |
| 122 prefs::kManagedNotificationsAllowedForUrls }, | 122 Value::TYPE_INTEGER }, |
| 123 { Value::TYPE_LIST, kPolicyNotificationsBlockedForUrls, | 123 { key::kDefaultPluginsSetting, |
| 124 prefs::kManagedNotificationsBlockedForUrls }, | 124 prefs::kManagedDefaultPluginsSetting, |
| 125 { Value::TYPE_INTEGER, kPolicyDefaultNotificationsSetting, | 125 Value::TYPE_INTEGER }, |
| 126 prefs::kManagedDefaultNotificationsSetting }, | 126 { key::kDefaultPopupsSetting, |
| 127 { Value::TYPE_INTEGER, kPolicyDefaultGeolocationSetting, | 127 prefs::kManagedDefaultPopupsSetting, |
| 128 prefs::kManagedDefaultGeolocationSetting }, | 128 Value::TYPE_INTEGER }, |
| 129 { Value::TYPE_BOOLEAN, kPolicyEnableOriginBoundCerts, | 129 { key::kAutoSelectCertificateForUrls, |
| 130 prefs::kEnableOriginBoundCerts }, | 130 prefs::kManagedAutoSelectCertificateForUrls, |
| 131 { Value::TYPE_STRING, kPolicyAuthSchemes, | 131 Value::TYPE_LIST }, |
| 132 prefs::kAuthSchemes }, | 132 { key::kCookiesAllowedForUrls, |
| 133 { Value::TYPE_BOOLEAN, kPolicyDisableAuthNegotiateCnameLookup, | 133 prefs::kManagedCookiesAllowedForUrls, |
| 134 prefs::kDisableAuthNegotiateCnameLookup }, | 134 Value::TYPE_LIST }, |
| 135 { Value::TYPE_BOOLEAN, kPolicyEnableAuthNegotiatePort, | 135 { key::kCookiesBlockedForUrls, |
| 136 prefs::kEnableAuthNegotiatePort }, | 136 prefs::kManagedCookiesBlockedForUrls, |
| 137 { Value::TYPE_STRING, kPolicyAuthServerWhitelist, | 137 Value::TYPE_LIST }, |
| 138 prefs::kAuthServerWhitelist }, | 138 { key::kCookiesSessionOnlyForUrls, |
| 139 { Value::TYPE_STRING, kPolicyAuthNegotiateDelegateWhitelist, | 139 prefs::kManagedCookiesSessionOnlyForUrls, |
| 140 prefs::kAuthNegotiateDelegateWhitelist }, | 140 Value::TYPE_LIST }, |
| 141 { Value::TYPE_STRING, kPolicyGSSAPILibraryName, | 141 { key::kImagesAllowedForUrls, |
| 142 prefs::kGSSAPILibraryName }, | 142 prefs::kManagedImagesAllowedForUrls, |
| 143 { Value::TYPE_BOOLEAN, kPolicyAllowCrossOriginAuthPrompt, | 143 Value::TYPE_LIST }, |
| 144 prefs::kAllowCrossOriginAuthPrompt }, | 144 { key::kImagesBlockedForUrls, |
| 145 { Value::TYPE_BOOLEAN, kPolicyDisable3DAPIs, | 145 prefs::kManagedImagesBlockedForUrls, |
| 146 prefs::kDisable3DAPIs }, | 146 Value::TYPE_LIST }, |
| 147 { Value::TYPE_BOOLEAN, kPolicyDisablePluginFinder, | 147 { key::kJavaScriptAllowedForUrls, |
| 148 prefs::kDisablePluginFinder }, | 148 prefs::kManagedJavaScriptAllowedForUrls, |
| 149 { Value::TYPE_INTEGER, kPolicyDiskCacheSize, | 149 Value::TYPE_LIST }, |
| 150 prefs::kDiskCacheSize }, | 150 { key::kJavaScriptBlockedForUrls, |
| 151 { Value::TYPE_INTEGER, kPolicyMediaCacheSize, | 151 prefs::kManagedJavaScriptBlockedForUrls, |
| 152 prefs::kMediaCacheSize }, | 152 Value::TYPE_LIST }, |
| 153 { Value::TYPE_INTEGER, kPolicyPolicyRefreshRate, | 153 { key::kPluginsAllowedForUrls, |
| 154 prefs::kUserPolicyRefreshRate }, | 154 prefs::kManagedPluginsAllowedForUrls, |
| 155 { Value::TYPE_INTEGER, kPolicyDevicePolicyRefreshRate, | 155 Value::TYPE_LIST }, |
| 156 prefs::kDevicePolicyRefreshRate }, | 156 { key::kPluginsBlockedForUrls, |
| 157 { Value::TYPE_BOOLEAN, kPolicyInstantEnabled, prefs::kInstantEnabled }, | 157 prefs::kManagedPluginsBlockedForUrls, |
| 158 { Value::TYPE_BOOLEAN, kPolicyDefaultBrowserSettingEnabled, | 158 Value::TYPE_LIST }, |
| 159 prefs::kDefaultBrowserSettingEnabled }, | 159 { key::kPopupsAllowedForUrls, |
| 160 { Value::TYPE_BOOLEAN, kPolicyRemoteAccessHostFirewallTraversal, | 160 prefs::kManagedPopupsAllowedForUrls, |
| 161 prefs::kRemoteAccessHostFirewallTraversal }, | 161 Value::TYPE_LIST }, |
| 162 { Value::TYPE_BOOLEAN, kPolicyCloudPrintProxyEnabled, | 162 { key::kPopupsBlockedForUrls, |
| 163 prefs::kCloudPrintProxyEnabled }, | 163 prefs::kManagedPopupsBlockedForUrls, |
| 164 { Value::TYPE_BOOLEAN, kPolicyCloudPrintSubmitEnabled, | 164 Value::TYPE_LIST }, |
| 165 prefs::kCloudPrintSubmitEnabled }, | 165 { key::kNotificationsAllowedForUrls, |
| 166 { Value::TYPE_BOOLEAN, kPolicyTranslateEnabled, prefs::kEnableTranslate }, | 166 prefs::kManagedNotificationsAllowedForUrls, |
| 167 { Value::TYPE_BOOLEAN, kPolicyAllowOutdatedPlugins, | 167 Value::TYPE_LIST }, |
| 168 prefs::kPluginsAllowOutdated }, | 168 { key::kNotificationsBlockedForUrls, |
| 169 { Value::TYPE_BOOLEAN, kPolicyAlwaysAuthorizePlugins, | 169 prefs::kManagedNotificationsBlockedForUrls, |
| 170 prefs::kPluginsAlwaysAuthorize }, | 170 Value::TYPE_LIST }, |
| 171 { Value::TYPE_BOOLEAN, kPolicyBookmarkBarEnabled, | 171 { key::kDefaultNotificationsSetting, |
| 172 prefs::kShowBookmarkBar }, | 172 prefs::kManagedDefaultNotificationsSetting, |
| 173 { Value::TYPE_BOOLEAN, kPolicyEditBookmarksEnabled, | 173 Value::TYPE_INTEGER }, |
| 174 prefs::kEditBookmarksEnabled }, | 174 { key::kDefaultGeolocationSetting, |
| 175 { Value::TYPE_BOOLEAN, kPolicyAllowFileSelectionDialogs, | 175 prefs::kManagedDefaultGeolocationSetting, |
| 176 prefs::kAllowFileSelectionDialogs }, | 176 Value::TYPE_INTEGER }, |
| 177 { Value::TYPE_BOOLEAN, kPolicyImportBookmarks, | 177 { key::kEnableOriginBoundCerts, |
| 178 prefs::kImportBookmarks}, | 178 prefs::kEnableOriginBoundCerts, |
| 179 { Value::TYPE_BOOLEAN, kPolicyImportHistory, | 179 Value::TYPE_BOOLEAN }, |
| 180 prefs::kImportHistory}, | 180 { key::kAuthSchemes, |
| 181 { Value::TYPE_BOOLEAN, kPolicyImportHomepage, | 181 prefs::kAuthSchemes, |
| 182 prefs::kImportHomepage}, | 182 Value::TYPE_STRING }, |
| 183 { Value::TYPE_BOOLEAN, kPolicyImportSearchEngine, | 183 { key::kDisableAuthNegotiateCnameLookup, |
| 184 prefs::kImportSearchEngine }, | 184 prefs::kDisableAuthNegotiateCnameLookup, |
| 185 { Value::TYPE_BOOLEAN, kPolicyImportSavedPasswords, | 185 Value::TYPE_BOOLEAN }, |
| 186 prefs::kImportSavedPasswords }, | 186 { key::kEnableAuthNegotiatePort, |
| 187 { Value::TYPE_INTEGER, kPolicyMaxConnectionsPerProxy, | 187 prefs::kEnableAuthNegotiatePort, |
| 188 prefs::kMaxConnectionsPerProxy }, | 188 Value::TYPE_BOOLEAN }, |
| 189 { Value::TYPE_BOOLEAN, kPolicyHideWebStorePromo, | 189 { key::kAuthServerWhitelist, |
| 190 prefs::kNTPHideWebStorePromo }, | 190 prefs::kAuthServerWhitelist, |
| 191 { Value::TYPE_LIST, kPolicyURLBlacklist, | 191 Value::TYPE_STRING }, |
| 192 prefs::kUrlBlacklist }, | 192 { key::kAuthNegotiateDelegateWhitelist, |
| 193 { Value::TYPE_LIST, kPolicyURLWhitelist, | 193 prefs::kAuthNegotiateDelegateWhitelist, |
| 194 prefs::kUrlWhitelist }, | 194 Value::TYPE_STRING }, |
| 195 { Value::TYPE_STRING, kPolicyEnterpriseWebStoreURL, | 195 { key::kGSSAPILibraryName, |
| 196 prefs::kEnterpriseWebStoreURL }, | 196 prefs::kGSSAPILibraryName, |
| 197 { Value::TYPE_STRING, kPolicyEnterpriseWebStoreName, | 197 Value::TYPE_STRING }, |
| 198 prefs::kEnterpriseWebStoreName }, | 198 { key::kAllowCrossOriginAuthPrompt, |
| 199 { Value::TYPE_BOOLEAN, kPolicyEnableMemoryInfo, | 199 prefs::kAllowCrossOriginAuthPrompt, |
| 200 prefs::kEnableMemoryInfo }, | 200 Value::TYPE_BOOLEAN }, |
| 201 { key::kDisable3DAPIs, |
| 202 prefs::kDisable3DAPIs, |
| 203 Value::TYPE_BOOLEAN }, |
| 204 { key::kDisablePluginFinder, |
| 205 prefs::kDisablePluginFinder, |
| 206 Value::TYPE_BOOLEAN }, |
| 207 { key::kDiskCacheSize, |
| 208 prefs::kDiskCacheSize, |
| 209 Value::TYPE_INTEGER }, |
| 210 { key::kMediaCacheSize, |
| 211 prefs::kMediaCacheSize, |
| 212 Value::TYPE_INTEGER }, |
| 213 { key::kPolicyRefreshRate, |
| 214 prefs::kUserPolicyRefreshRate, |
| 215 Value::TYPE_INTEGER }, |
| 216 { key::kDevicePolicyRefreshRate, |
| 217 prefs::kDevicePolicyRefreshRate, |
| 218 Value::TYPE_INTEGER }, |
| 219 { key::kInstantEnabled, |
| 220 prefs::kInstantEnabled, |
| 221 Value::TYPE_BOOLEAN }, |
| 222 { key::kDefaultBrowserSettingEnabled, |
| 223 prefs::kDefaultBrowserSettingEnabled, |
| 224 Value::TYPE_BOOLEAN }, |
| 225 { key::kRemoteAccessHostFirewallTraversal, |
| 226 prefs::kRemoteAccessHostFirewallTraversal, |
| 227 Value::TYPE_BOOLEAN }, |
| 228 { key::kCloudPrintProxyEnabled, |
| 229 prefs::kCloudPrintProxyEnabled, |
| 230 Value::TYPE_BOOLEAN }, |
| 231 { key::kCloudPrintSubmitEnabled, |
| 232 prefs::kCloudPrintSubmitEnabled, |
| 233 Value::TYPE_BOOLEAN }, |
| 234 { key::kTranslateEnabled, |
| 235 prefs::kEnableTranslate, |
| 236 Value::TYPE_BOOLEAN }, |
| 237 { key::kAllowOutdatedPlugins, |
| 238 prefs::kPluginsAllowOutdated, |
| 239 Value::TYPE_BOOLEAN }, |
| 240 { key::kAlwaysAuthorizePlugins, |
| 241 prefs::kPluginsAlwaysAuthorize, |
| 242 Value::TYPE_BOOLEAN }, |
| 243 { key::kBookmarkBarEnabled, |
| 244 prefs::kShowBookmarkBar, |
| 245 Value::TYPE_BOOLEAN }, |
| 246 { key::kEditBookmarksEnabled, |
| 247 prefs::kEditBookmarksEnabled, |
| 248 Value::TYPE_BOOLEAN }, |
| 249 { key::kAllowFileSelectionDialogs, |
| 250 prefs::kAllowFileSelectionDialogs, |
| 251 Value::TYPE_BOOLEAN }, |
| 252 { key::kImportBookmarks, |
| 253 prefs::kImportBookmarks, |
| 254 Value::TYPE_BOOLEAN }, |
| 255 { key::kImportHistory, |
| 256 prefs::kImportHistory, |
| 257 Value::TYPE_BOOLEAN }, |
| 258 { key::kImportHomepage, |
| 259 prefs::kImportHomepage, |
| 260 Value::TYPE_BOOLEAN }, |
| 261 { key::kImportSearchEngine, |
| 262 prefs::kImportSearchEngine, |
| 263 Value::TYPE_BOOLEAN }, |
| 264 { key::kImportSavedPasswords, |
| 265 prefs::kImportSavedPasswords, |
| 266 Value::TYPE_BOOLEAN }, |
| 267 { key::kMaxConnectionsPerProxy, |
| 268 prefs::kMaxConnectionsPerProxy, |
| 269 Value::TYPE_INTEGER }, |
| 270 { key::kHideWebStorePromo, |
| 271 prefs::kNTPHideWebStorePromo, |
| 272 Value::TYPE_BOOLEAN }, |
| 273 { key::kURLBlacklist, |
| 274 prefs::kUrlBlacklist, |
| 275 Value::TYPE_LIST }, |
| 276 { key::kURLWhitelist, |
| 277 prefs::kUrlWhitelist, |
| 278 Value::TYPE_LIST }, |
| 279 { key::kEnterpriseWebStoreURL, |
| 280 prefs::kEnterpriseWebStoreURL, |
| 281 Value::TYPE_STRING }, |
| 282 { key::kEnterpriseWebStoreName, |
| 283 prefs::kEnterpriseWebStoreName, |
| 284 Value::TYPE_STRING }, |
| 285 { key::kEnableMemoryInfo, |
| 286 prefs::kEnableMemoryInfo, |
| 287 Value::TYPE_BOOLEAN }, |
| 201 | 288 |
| 202 #if defined(OS_CHROMEOS) | 289 #if defined(OS_CHROMEOS) |
| 203 { Value::TYPE_BOOLEAN, kPolicyChromeOsLockOnIdleSuspend, | 290 { key::kChromeOsLockOnIdleSuspend, |
| 204 prefs::kEnableScreenLock }, | 291 prefs::kEnableScreenLock, |
| 205 { Value::TYPE_STRING, kPolicyChromeOsReleaseChannel, | 292 Value::TYPE_BOOLEAN }, |
| 206 prefs::kChromeOsReleaseChannel }, | 293 { key::kChromeOsReleaseChannel, |
| 294 prefs::kChromeOsReleaseChannel, |
| 295 Value::TYPE_STRING }, |
| 207 #endif // defined(OS_CHROMEOS) | 296 #endif // defined(OS_CHROMEOS) |
| 208 }; | 297 }; |
| 209 | 298 |
| 210 } // namespace | 299 } // namespace |
| 211 | 300 |
| 212 ConfigurationPolicyHandlerList::ConfigurationPolicyHandlerList() { | 301 ConfigurationPolicyHandlerList::ConfigurationPolicyHandlerList() { |
| 213 for (size_t i = 0; i < arraysize(kSimplePolicyMap); ++i) { | 302 for (size_t i = 0; i < arraysize(kSimplePolicyMap); ++i) { |
| 214 handlers_.push_back( | 303 handlers_.push_back( |
| 215 new SimplePolicyHandler(kSimplePolicyMap[i].policy_type, | 304 new SimplePolicyHandler(kSimplePolicyMap[i].policy_name, |
| 216 kSimplePolicyMap[i].value_type, | 305 kSimplePolicyMap[i].preference_path, |
| 217 kSimplePolicyMap[i].preference_path)); | 306 kSimplePolicyMap[i].value_type)); |
| 218 } | 307 } |
| 219 | 308 |
| 220 handlers_.push_back(new AutofillPolicyHandler()); | 309 handlers_.push_back(new AutofillPolicyHandler()); |
| 221 handlers_.push_back(new DefaultSearchPolicyHandler()); | 310 handlers_.push_back(new DefaultSearchPolicyHandler()); |
| 222 handlers_.push_back(new DiskCacheDirPolicyHandler()); | 311 handlers_.push_back(new DiskCacheDirPolicyHandler()); |
| 223 handlers_.push_back(new FileSelectionDialogsHandler()); | 312 handlers_.push_back(new FileSelectionDialogsHandler()); |
| 224 handlers_.push_back(new IncognitoModePolicyHandler()); | 313 handlers_.push_back(new IncognitoModePolicyHandler()); |
| 225 handlers_.push_back(new JavascriptPolicyHandler()); | 314 handlers_.push_back(new JavascriptPolicyHandler()); |
| 226 handlers_.push_back(new ProxyPolicyHandler()); | 315 handlers_.push_back(new ProxyPolicyHandler()); |
| 227 handlers_.push_back(new SyncPolicyHandler()); | 316 handlers_.push_back(new SyncPolicyHandler()); |
| 228 | 317 |
| 229 #if !defined(OS_CHROMEOS) | 318 #if !defined(OS_CHROMEOS) |
| 230 handlers_.push_back(new DownloadDirPolicyHandler()); | 319 handlers_.push_back(new DownloadDirPolicyHandler()); |
| 231 #endif // !defined(OS_CHROMEOS) | 320 #endif // !defined(OS_CHROMEOS) |
| 232 | 321 |
| 233 #if defined(OS_CHROMEOS) | 322 #if defined(OS_CHROMEOS) |
| 234 handlers_.push_back( | 323 handlers_.push_back( |
| 235 new NetworkConfigurationPolicyHandler( | 324 new NetworkConfigurationPolicyHandler( |
| 236 kPolicyDeviceOpenNetworkConfiguration, | 325 key::kDeviceOpenNetworkConfiguration, |
| 237 chromeos::NetworkUIData::ONC_SOURCE_DEVICE_POLICY)); | 326 chromeos::NetworkUIData::ONC_SOURCE_DEVICE_POLICY)); |
| 238 handlers_.push_back( | 327 handlers_.push_back( |
| 239 new NetworkConfigurationPolicyHandler( | 328 new NetworkConfigurationPolicyHandler( |
| 240 kPolicyOpenNetworkConfiguration, | 329 key::kOpenNetworkConfiguration, |
| 241 chromeos::NetworkUIData::ONC_SOURCE_USER_POLICY)); | 330 chromeos::NetworkUIData::ONC_SOURCE_USER_POLICY)); |
| 242 #endif // defined(OS_CHROMEOS) | 331 #endif // defined(OS_CHROMEOS) |
| 243 } | 332 } |
| 244 | 333 |
| 245 ConfigurationPolicyHandlerList::~ConfigurationPolicyHandlerList() { | 334 ConfigurationPolicyHandlerList::~ConfigurationPolicyHandlerList() { |
| 246 STLDeleteElements(&handlers_); | 335 STLDeleteElements(&handlers_); |
| 247 } | 336 } |
| 248 | 337 |
| 249 void ConfigurationPolicyHandlerList::ApplyPolicySettings( | 338 void ConfigurationPolicyHandlerList::ApplyPolicySettings( |
| 250 const PolicyMap& policies, | 339 const PolicyMap& policies, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 269 } | 358 } |
| 270 | 359 |
| 271 void ConfigurationPolicyHandlerList::PrepareForDisplaying( | 360 void ConfigurationPolicyHandlerList::PrepareForDisplaying( |
| 272 PolicyMap* policies) const { | 361 PolicyMap* policies) const { |
| 273 std::vector<ConfigurationPolicyHandler*>::const_iterator handler; | 362 std::vector<ConfigurationPolicyHandler*>::const_iterator handler; |
| 274 for (handler = handlers_.begin(); handler != handlers_.end(); ++handler) | 363 for (handler = handlers_.begin(); handler != handlers_.end(); ++handler) |
| 275 (*handler)->PrepareForDisplaying(policies); | 364 (*handler)->PrepareForDisplaying(policies); |
| 276 } | 365 } |
| 277 | 366 |
| 278 } // namespace policy | 367 } // namespace policy |
| OLD | NEW |