Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/policy/configuration_policy_handler_list.h" | |
| 6 | |
| 7 #include "chrome/browser/policy/configuration_policy_handler.h" | |
| 8 #include "chrome/common/pref_names.h" | |
| 9 | |
| 10 namespace policy { | |
| 11 | |
| 12 const PolicyToPreferenceMapEntry kSimplePolicyMap[] = { | |
| 13 { Value::TYPE_STRING, kPolicyHomepageLocation, prefs::kHomePage }, | |
| 14 { Value::TYPE_BOOLEAN, kPolicyHomepageIsNewTabPage, | |
| 15 prefs::kHomePageIsNewTabPage }, | |
| 16 { Value::TYPE_INTEGER, kPolicyRestoreOnStartup, | |
| 17 prefs::kRestoreOnStartup}, | |
| 18 { Value::TYPE_LIST, kPolicyRestoreOnStartupURLs, | |
| 19 prefs::kURLsToRestoreOnStartup }, | |
| 20 { Value::TYPE_BOOLEAN, kPolicyAlternateErrorPagesEnabled, | |
| 21 prefs::kAlternateErrorPagesEnabled }, | |
| 22 { Value::TYPE_BOOLEAN, kPolicySearchSuggestEnabled, | |
| 23 prefs::kSearchSuggestEnabled }, | |
| 24 { Value::TYPE_BOOLEAN, kPolicyDnsPrefetchingEnabled, | |
| 25 prefs::kNetworkPredictionEnabled }, | |
| 26 { Value::TYPE_BOOLEAN, kPolicyDisableSpdy, | |
| 27 prefs::kDisableSpdy }, | |
| 28 { Value::TYPE_LIST, kPolicyDisabledSchemes, | |
| 29 prefs::kDisabledSchemes }, | |
| 30 { Value::TYPE_BOOLEAN, kPolicySafeBrowsingEnabled, | |
| 31 prefs::kSafeBrowsingEnabled }, | |
| 32 { Value::TYPE_BOOLEAN, kPolicyPasswordManagerEnabled, | |
| 33 prefs::kPasswordManagerEnabled }, | |
| 34 { Value::TYPE_BOOLEAN, kPolicyPasswordManagerAllowShowPasswords, | |
| 35 prefs::kPasswordManagerAllowShowPasswords }, | |
| 36 { Value::TYPE_BOOLEAN, kPolicyPrintingEnabled, | |
| 37 prefs::kPrintingEnabled }, | |
| 38 { Value::TYPE_BOOLEAN, kPolicyMetricsReportingEnabled, | |
| 39 prefs::kMetricsReportingEnabled }, | |
| 40 { Value::TYPE_STRING, kPolicyApplicationLocaleValue, | |
| 41 prefs::kApplicationLocale}, | |
| 42 { Value::TYPE_LIST, kPolicyExtensionInstallWhitelist, | |
| 43 prefs::kExtensionInstallAllowList}, | |
| 44 { Value::TYPE_LIST, kPolicyExtensionInstallBlacklist, | |
| 45 prefs::kExtensionInstallDenyList}, | |
| 46 { Value::TYPE_LIST, kPolicyExtensionInstallForcelist, | |
| 47 prefs::kExtensionInstallForceList}, | |
| 48 { Value::TYPE_LIST, kPolicyDisabledPlugins, | |
| 49 prefs::kPluginsDisabledPlugins}, | |
| 50 { Value::TYPE_LIST, kPolicyDisabledPluginsExceptions, | |
| 51 prefs::kPluginsDisabledPluginsExceptions}, | |
| 52 { Value::TYPE_LIST, kPolicyEnabledPlugins, | |
| 53 prefs::kPluginsEnabledPlugins}, | |
| 54 { Value::TYPE_BOOLEAN, kPolicyShowHomeButton, | |
| 55 prefs::kShowHomeButton }, | |
| 56 { Value::TYPE_BOOLEAN, kPolicyJavascriptEnabled, | |
| 57 prefs::kWebKitJavascriptEnabled }, | |
| 58 { Value::TYPE_BOOLEAN, kPolicySavingBrowserHistoryDisabled, | |
| 59 prefs::kSavingBrowserHistoryDisabled }, | |
| 60 { Value::TYPE_BOOLEAN, kPolicyClearSiteDataOnExit, | |
| 61 prefs::kClearSiteDataOnExit }, | |
| 62 { Value::TYPE_BOOLEAN, kPolicyDeveloperToolsDisabled, | |
| 63 prefs::kDevToolsDisabled }, | |
| 64 { Value::TYPE_BOOLEAN, kPolicyBlockThirdPartyCookies, | |
| 65 prefs::kBlockThirdPartyCookies }, | |
| 66 { Value::TYPE_INTEGER, kPolicyDefaultCookiesSetting, | |
| 67 prefs::kManagedDefaultCookiesSetting }, | |
| 68 { Value::TYPE_INTEGER, kPolicyDefaultImagesSetting, | |
| 69 prefs::kManagedDefaultImagesSetting }, | |
| 70 { Value::TYPE_INTEGER, kPolicyDefaultJavaScriptSetting, | |
| 71 prefs::kManagedDefaultJavaScriptSetting }, | |
| 72 { Value::TYPE_INTEGER, kPolicyDefaultPluginsSetting, | |
| 73 prefs::kManagedDefaultPluginsSetting }, | |
| 74 { Value::TYPE_INTEGER, kPolicyDefaultPopupsSetting, | |
| 75 prefs::kManagedDefaultPopupsSetting }, | |
| 76 { Value::TYPE_LIST, kPolicyAutoSelectCertificateForUrls, | |
| 77 prefs::kManagedAutoSelectCertificateForUrls}, | |
| 78 { Value::TYPE_LIST, kPolicyCookiesAllowedForUrls, | |
| 79 prefs::kManagedCookiesAllowedForUrls }, | |
| 80 { Value::TYPE_LIST, kPolicyCookiesBlockedForUrls, | |
| 81 prefs::kManagedCookiesBlockedForUrls }, | |
| 82 { Value::TYPE_LIST, kPolicyCookiesSessionOnlyForUrls, | |
| 83 prefs::kManagedCookiesSessionOnlyForUrls }, | |
| 84 { Value::TYPE_LIST, kPolicyImagesAllowedForUrls, | |
| 85 prefs::kManagedImagesAllowedForUrls }, | |
| 86 { Value::TYPE_LIST, kPolicyImagesBlockedForUrls, | |
| 87 prefs::kManagedImagesBlockedForUrls }, | |
| 88 { Value::TYPE_LIST, kPolicyJavaScriptAllowedForUrls, | |
| 89 prefs::kManagedJavaScriptAllowedForUrls }, | |
| 90 { Value::TYPE_LIST, kPolicyJavaScriptBlockedForUrls, | |
| 91 prefs::kManagedJavaScriptBlockedForUrls }, | |
| 92 { Value::TYPE_LIST, kPolicyPluginsAllowedForUrls, | |
| 93 prefs::kManagedPluginsAllowedForUrls }, | |
| 94 { Value::TYPE_LIST, kPolicyPluginsBlockedForUrls, | |
| 95 prefs::kManagedPluginsBlockedForUrls }, | |
| 96 { Value::TYPE_LIST, kPolicyPopupsAllowedForUrls, | |
| 97 prefs::kManagedPopupsAllowedForUrls }, | |
| 98 { Value::TYPE_LIST, kPolicyPopupsBlockedForUrls, | |
| 99 prefs::kManagedPopupsBlockedForUrls }, | |
| 100 { Value::TYPE_LIST, kPolicyNotificationsAllowedForUrls, | |
| 101 prefs::kManagedNotificationsAllowedForUrls }, | |
| 102 { Value::TYPE_LIST, kPolicyNotificationsBlockedForUrls, | |
| 103 prefs::kManagedNotificationsBlockedForUrls }, | |
| 104 { Value::TYPE_INTEGER, kPolicyDefaultNotificationsSetting, | |
| 105 prefs::kManagedDefaultNotificationsSetting }, | |
| 106 { Value::TYPE_INTEGER, kPolicyDefaultGeolocationSetting, | |
| 107 prefs::kManagedDefaultGeolocationSetting }, | |
| 108 { Value::TYPE_STRING, kPolicyAuthSchemes, | |
| 109 prefs::kAuthSchemes }, | |
| 110 { Value::TYPE_BOOLEAN, kPolicyDisableAuthNegotiateCnameLookup, | |
| 111 prefs::kDisableAuthNegotiateCnameLookup }, | |
| 112 { Value::TYPE_BOOLEAN, kPolicyEnableAuthNegotiatePort, | |
| 113 prefs::kEnableAuthNegotiatePort }, | |
| 114 { Value::TYPE_STRING, kPolicyAuthServerWhitelist, | |
| 115 prefs::kAuthServerWhitelist }, | |
| 116 { Value::TYPE_STRING, kPolicyAuthNegotiateDelegateWhitelist, | |
| 117 prefs::kAuthNegotiateDelegateWhitelist }, | |
| 118 { Value::TYPE_STRING, kPolicyGSSAPILibraryName, | |
| 119 prefs::kGSSAPILibraryName }, | |
| 120 { Value::TYPE_BOOLEAN, kPolicyAllowCrossOriginAuthPrompt, | |
| 121 prefs::kAllowCrossOriginAuthPrompt }, | |
| 122 { Value::TYPE_BOOLEAN, kPolicyDisable3DAPIs, | |
| 123 prefs::kDisable3DAPIs }, | |
| 124 { Value::TYPE_BOOLEAN, kPolicyDisablePluginFinder, | |
| 125 prefs::kDisablePluginFinder }, | |
| 126 { Value::TYPE_INTEGER, kPolicyPolicyRefreshRate, | |
| 127 prefs::kUserPolicyRefreshRate }, | |
| 128 { Value::TYPE_INTEGER, kPolicyDevicePolicyRefreshRate, | |
| 129 prefs::kDevicePolicyRefreshRate }, | |
| 130 { Value::TYPE_BOOLEAN, kPolicyInstantEnabled, prefs::kInstantEnabled }, | |
| 131 { Value::TYPE_BOOLEAN, kPolicyDefaultBrowserSettingEnabled, | |
| 132 prefs::kDefaultBrowserSettingEnabled }, | |
| 133 { Value::TYPE_BOOLEAN, kPolicyRemoteAccessClientFirewallTraversal, | |
| 134 prefs::kRemoteAccessClientFirewallTraversal }, | |
| 135 { Value::TYPE_BOOLEAN, kPolicyRemoteAccessHostFirewallTraversal, | |
| 136 prefs::kRemoteAccessHostFirewallTraversal }, | |
| 137 { Value::TYPE_BOOLEAN, kPolicyCloudPrintProxyEnabled, | |
| 138 prefs::kCloudPrintProxyEnabled }, | |
| 139 { Value::TYPE_BOOLEAN, kPolicyTranslateEnabled, prefs::kEnableTranslate }, | |
| 140 { Value::TYPE_BOOLEAN, kPolicyAllowOutdatedPlugins, | |
| 141 prefs::kPluginsAllowOutdated }, | |
| 142 { Value::TYPE_BOOLEAN, kPolicyAlwaysAuthorizePlugins, | |
| 143 prefs::kPluginsAlwaysAuthorize }, | |
| 144 { Value::TYPE_BOOLEAN, kPolicyEditBookmarksEnabled, | |
| 145 prefs::kEditBookmarksEnabled }, | |
| 146 { Value::TYPE_BOOLEAN, kPolicyAllowFileSelectionDialogs, | |
| 147 prefs::kAllowFileSelectionDialogs }, | |
| 148 { Value::TYPE_BOOLEAN, kPolicyImportBookmarks, | |
| 149 prefs::kImportBookmarks}, | |
| 150 { Value::TYPE_BOOLEAN, kPolicyImportHistory, | |
| 151 prefs::kImportHistory}, | |
| 152 { Value::TYPE_BOOLEAN, kPolicyImportHomepage, | |
| 153 prefs::kImportHomepage}, | |
| 154 { Value::TYPE_BOOLEAN, kPolicyImportSearchEngine, | |
| 155 prefs::kImportSearchEngine }, | |
| 156 { Value::TYPE_BOOLEAN, kPolicyImportSavedPasswords, | |
| 157 prefs::kImportSavedPasswords }, | |
| 158 { Value::TYPE_INTEGER, kPolicyMaxConnectionsPerProxy, | |
| 159 prefs::kMaxConnectionsPerProxy }, | |
| 160 { Value::TYPE_BOOLEAN, kPolicyHideWebStorePromo, | |
| 161 prefs::kNTPHideWebStorePromo }, | |
| 162 { Value::TYPE_LIST, kPolicyURLBlacklist, | |
| 163 prefs::kUrlBlacklist }, | |
| 164 { Value::TYPE_LIST, kPolicyURLWhitelist, | |
| 165 prefs::kUrlWhitelist }, | |
| 166 | |
| 167 #if defined(OS_CHROMEOS) | |
| 168 { Value::TYPE_BOOLEAN, kPolicyChromeOsLockOnIdleSuspend, | |
| 169 prefs::kEnableScreenLock }, | |
| 170 { Value::TYPE_STRING, kPolicyChromeOsReleaseChannel, | |
| 171 prefs::kChromeOsReleaseChannel }, | |
| 172 #endif | |
| 173 }; | |
| 174 | |
| 175 HandlerList* MakeConfigurationPolicyHandlers() { | |
| 176 HandlerList* handlers = | |
| 177 new std::vector<ConfigurationPolicyHandlerInterface*>(); | |
| 178 | |
| 179 unsigned int i = 0; | |
| 180 for ( ; i < arraysize(kSimplePolicyMap); ++i) { | |
| 181 handlers->push_back(new SimplePolicyHandler( | |
| 182 kSimplePolicyMap[i].policy_type, | |
|
Mattias Nissler (ping if slow)
2011/09/26 13:30:48
indentation (maybe break before new?)
simo
2011/09/29 09:33:08
Done.
| |
| 183 kSimplePolicyMap[i].value_type, | |
| 184 kSimplePolicyMap[i].preference_path)); | |
| 185 } | |
| 186 handlers->push_back(new SyncPolicyHandler()); | |
| 187 handlers->push_back(new AutofillPolicyHandler()); | |
| 188 handlers->push_back(new DownloadDirPolicyHandler()); | |
| 189 handlers->push_back(new DiskCacheDirPolicyHandler()); | |
| 190 handlers->push_back(new FileSelectionDialogsHandler()); | |
| 191 handlers->push_back(new BookmarksPolicyHandler()); | |
| 192 handlers->push_back(new ProxyPolicyHandler()); | |
| 193 handlers->push_back(new IncognitoModePolicyHandler()); | |
| 194 handlers->push_back(new DefaultSearchPolicyHandler()); | |
| 195 | |
| 196 return handlers; | |
| 197 } | |
| 198 | |
| 199 } // namespace policy | |
| OLD | NEW |