Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / policy / configuration_policy_handler_list_factory.cc
blob37a75dfbf448b503213378b05d5aecf2c73c4ddb
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
3 // found in the LICENSE file.
5 #include "chrome/browser/policy/configuration_policy_handler_list_factory.h"
7 #include "base/basictypes.h"
8 #include "base/bind.h"
9 #include "base/values.h"
10 #include "chrome/browser/extensions/api/messaging/native_messaging_policy_handler.h"
11 #include "chrome/browser/extensions/policy_handlers.h"
12 #include "chrome/browser/net/disk_cache_dir_policy_handler.h"
13 #include "chrome/browser/net/proxy_policy_handler.h"
14 #include "chrome/browser/policy/file_selection_dialogs_policy_handler.h"
15 #include "chrome/browser/policy/javascript_policy_handler.h"
16 #include "chrome/browser/profiles/incognito_mode_policy_handler.h"
17 #include "chrome/browser/search_engines/default_search_policy_handler.h"
18 #include "chrome/browser/sessions/restore_on_startup_policy_handler.h"
19 #include "chrome/browser/sync/sync_policy_handler.h"
20 #include "chrome/common/pref_names.h"
21 #include "components/policy/core/browser/autofill_policy_handler.h"
22 #include "components/policy/core/browser/configuration_policy_handler.h"
23 #include "components/policy/core/browser/configuration_policy_handler_list.h"
24 #include "components/policy/core/browser/url_blacklist_policy_handler.h"
25 #include "components/policy/core/common/policy_details.h"
26 #include "components/policy/core/common/policy_map.h"
27 #include "components/policy/core/common/policy_pref_names.h"
28 #include "extensions/browser/pref_names.h"
29 #include "extensions/common/manifest.h"
30 #include "grit/component_strings.h"
31 #include "policy/policy_constants.h"
33 #if defined(OS_CHROMEOS)
34 #include "ash/magnifier/magnifier_constants.h"
35 #include "chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h"
36 #include "chromeos/dbus/power_policy_controller.h"
37 #endif // defined(OS_CHROMEOS)
39 #if defined(OS_ANDROID)
40 #include "chrome/browser/policy/configuration_policy_handler_android.h"
41 #endif // defined(OS_ANDROID)
43 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
44 #include "chrome/browser/download/download_dir_policy_handler.h"
45 #endif
47 #if !defined(OS_MACOSX)
48 #include "apps/pref_names.h"
49 #endif
51 namespace policy {
53 namespace {
55 // List of policy types to preference names. This is used for simple policies
56 // that directly map to a single preference.
57 const PolicyToPreferenceMapEntry kSimplePolicyMap[] = {
58 { key::kHomepageLocation,
59 prefs::kHomePage,
60 base::Value::TYPE_STRING },
61 { key::kHomepageIsNewTabPage,
62 prefs::kHomePageIsNewTabPage,
63 base::Value::TYPE_BOOLEAN },
64 { key::kRestoreOnStartupURLs,
65 prefs::kURLsToRestoreOnStartup,
66 base::Value::TYPE_LIST },
67 { key::kAlternateErrorPagesEnabled,
68 prefs::kAlternateErrorPagesEnabled,
69 base::Value::TYPE_BOOLEAN },
70 { key::kSearchSuggestEnabled,
71 prefs::kSearchSuggestEnabled,
72 base::Value::TYPE_BOOLEAN },
73 { key::kDnsPrefetchingEnabled,
74 prefs::kNetworkPredictionEnabled,
75 base::Value::TYPE_BOOLEAN },
76 { key::kBuiltInDnsClientEnabled,
77 prefs::kBuiltInDnsClientEnabled,
78 base::Value::TYPE_BOOLEAN },
79 { key::kDisableSpdy,
80 prefs::kDisableSpdy,
81 base::Value::TYPE_BOOLEAN },
82 { key::kSafeBrowsingEnabled,
83 prefs::kSafeBrowsingEnabled,
84 base::Value::TYPE_BOOLEAN },
85 { key::kForceSafeSearch,
86 prefs::kForceSafeSearch,
87 base::Value::TYPE_BOOLEAN },
88 { key::kPasswordManagerEnabled,
89 prefs::kPasswordManagerEnabled,
90 base::Value::TYPE_BOOLEAN },
91 { key::kPasswordManagerAllowShowPasswords,
92 prefs::kPasswordManagerAllowShowPasswords,
93 base::Value::TYPE_BOOLEAN },
94 { key::kPrintingEnabled,
95 prefs::kPrintingEnabled,
96 base::Value::TYPE_BOOLEAN },
97 { key::kDisablePrintPreview,
98 prefs::kPrintPreviewDisabled,
99 base::Value::TYPE_BOOLEAN },
100 { key::kMetricsReportingEnabled,
101 prefs::kMetricsReportingEnabled,
102 base::Value::TYPE_BOOLEAN },
103 { key::kApplicationLocaleValue,
104 prefs::kApplicationLocale,
105 base::Value::TYPE_STRING },
106 { key::kDisabledPlugins,
107 prefs::kPluginsDisabledPlugins,
108 base::Value::TYPE_LIST },
109 { key::kDisabledPluginsExceptions,
110 prefs::kPluginsDisabledPluginsExceptions,
111 base::Value::TYPE_LIST },
112 { key::kEnabledPlugins,
113 prefs::kPluginsEnabledPlugins,
114 base::Value::TYPE_LIST },
115 { key::kShowHomeButton,
116 prefs::kShowHomeButton,
117 base::Value::TYPE_BOOLEAN },
118 { key::kSavingBrowserHistoryDisabled,
119 prefs::kSavingBrowserHistoryDisabled,
120 base::Value::TYPE_BOOLEAN },
121 { key::kAllowDeletingBrowserHistory,
122 prefs::kAllowDeletingBrowserHistory,
123 base::Value::TYPE_BOOLEAN },
124 { key::kDeveloperToolsDisabled,
125 prefs::kDevToolsDisabled,
126 base::Value::TYPE_BOOLEAN },
127 { key::kBlockThirdPartyCookies,
128 prefs::kBlockThirdPartyCookies,
129 base::Value::TYPE_BOOLEAN },
130 { key::kDefaultCookiesSetting,
131 prefs::kManagedDefaultCookiesSetting,
132 base::Value::TYPE_INTEGER },
133 { key::kDefaultImagesSetting,
134 prefs::kManagedDefaultImagesSetting,
135 base::Value::TYPE_INTEGER },
136 { key::kDefaultPluginsSetting,
137 prefs::kManagedDefaultPluginsSetting,
138 base::Value::TYPE_INTEGER },
139 { key::kDefaultPopupsSetting,
140 prefs::kManagedDefaultPopupsSetting,
141 base::Value::TYPE_INTEGER },
142 { key::kAutoSelectCertificateForUrls,
143 prefs::kManagedAutoSelectCertificateForUrls,
144 base::Value::TYPE_LIST },
145 { key::kCookiesAllowedForUrls,
146 prefs::kManagedCookiesAllowedForUrls,
147 base::Value::TYPE_LIST },
148 { key::kCookiesBlockedForUrls,
149 prefs::kManagedCookiesBlockedForUrls,
150 base::Value::TYPE_LIST },
151 { key::kCookiesSessionOnlyForUrls,
152 prefs::kManagedCookiesSessionOnlyForUrls,
153 base::Value::TYPE_LIST },
154 { key::kImagesAllowedForUrls,
155 prefs::kManagedImagesAllowedForUrls,
156 base::Value::TYPE_LIST },
157 { key::kImagesBlockedForUrls,
158 prefs::kManagedImagesBlockedForUrls,
159 base::Value::TYPE_LIST },
160 { key::kJavaScriptAllowedForUrls,
161 prefs::kManagedJavaScriptAllowedForUrls,
162 base::Value::TYPE_LIST },
163 { key::kJavaScriptBlockedForUrls,
164 prefs::kManagedJavaScriptBlockedForUrls,
165 base::Value::TYPE_LIST },
166 { key::kPluginsAllowedForUrls,
167 prefs::kManagedPluginsAllowedForUrls,
168 base::Value::TYPE_LIST },
169 { key::kPluginsBlockedForUrls,
170 prefs::kManagedPluginsBlockedForUrls,
171 base::Value::TYPE_LIST },
172 { key::kPopupsAllowedForUrls,
173 prefs::kManagedPopupsAllowedForUrls,
174 base::Value::TYPE_LIST },
175 { key::kPopupsBlockedForUrls,
176 prefs::kManagedPopupsBlockedForUrls,
177 base::Value::TYPE_LIST },
178 { key::kNotificationsAllowedForUrls,
179 prefs::kManagedNotificationsAllowedForUrls,
180 base::Value::TYPE_LIST },
181 { key::kNotificationsBlockedForUrls,
182 prefs::kManagedNotificationsBlockedForUrls,
183 base::Value::TYPE_LIST },
184 { key::kDefaultNotificationsSetting,
185 prefs::kManagedDefaultNotificationsSetting,
186 base::Value::TYPE_INTEGER },
187 { key::kDefaultGeolocationSetting,
188 prefs::kManagedDefaultGeolocationSetting,
189 base::Value::TYPE_INTEGER },
190 { key::kSigninAllowed,
191 prefs::kSigninAllowed,
192 base::Value::TYPE_BOOLEAN },
193 { key::kEnableOriginBoundCerts,
194 prefs::kEnableOriginBoundCerts,
195 base::Value::TYPE_BOOLEAN },
196 { key::kDisableSSLRecordSplitting,
197 prefs::kDisableSSLRecordSplitting,
198 base::Value::TYPE_BOOLEAN },
199 { key::kEnableOnlineRevocationChecks,
200 prefs::kCertRevocationCheckingEnabled,
201 base::Value::TYPE_BOOLEAN },
202 { key::kRequireOnlineRevocationChecksForLocalAnchors,
203 prefs::kCertRevocationCheckingRequiredLocalAnchors,
204 base::Value::TYPE_BOOLEAN },
205 { key::kAuthSchemes,
206 prefs::kAuthSchemes,
207 base::Value::TYPE_STRING },
208 { key::kDisableAuthNegotiateCnameLookup,
209 prefs::kDisableAuthNegotiateCnameLookup,
210 base::Value::TYPE_BOOLEAN },
211 { key::kEnableAuthNegotiatePort,
212 prefs::kEnableAuthNegotiatePort,
213 base::Value::TYPE_BOOLEAN },
214 { key::kAuthServerWhitelist,
215 prefs::kAuthServerWhitelist,
216 base::Value::TYPE_STRING },
217 { key::kAuthNegotiateDelegateWhitelist,
218 prefs::kAuthNegotiateDelegateWhitelist,
219 base::Value::TYPE_STRING },
220 { key::kGSSAPILibraryName,
221 prefs::kGSSAPILibraryName,
222 base::Value::TYPE_STRING },
223 { key::kAllowCrossOriginAuthPrompt,
224 prefs::kAllowCrossOriginAuthPrompt,
225 base::Value::TYPE_BOOLEAN },
226 { key::kDisable3DAPIs,
227 prefs::kDisable3DAPIs,
228 base::Value::TYPE_BOOLEAN },
229 { key::kDisablePluginFinder,
230 prefs::kDisablePluginFinder,
231 base::Value::TYPE_BOOLEAN },
232 { key::kDiskCacheSize,
233 prefs::kDiskCacheSize,
234 base::Value::TYPE_INTEGER },
235 { key::kMediaCacheSize,
236 prefs::kMediaCacheSize,
237 base::Value::TYPE_INTEGER },
238 { key::kPolicyRefreshRate,
239 policy_prefs::kUserPolicyRefreshRate,
240 base::Value::TYPE_INTEGER },
241 { key::kDevicePolicyRefreshRate,
242 prefs::kDevicePolicyRefreshRate,
243 base::Value::TYPE_INTEGER },
244 { key::kDefaultBrowserSettingEnabled,
245 prefs::kDefaultBrowserSettingEnabled,
246 base::Value::TYPE_BOOLEAN },
247 { key::kRemoteAccessHostFirewallTraversal,
248 prefs::kRemoteAccessHostFirewallTraversal,
249 base::Value::TYPE_BOOLEAN },
250 { key::kRemoteAccessHostRequireTwoFactor,
251 prefs::kRemoteAccessHostRequireTwoFactor,
252 base::Value::TYPE_BOOLEAN },
253 { key::kRemoteAccessHostDomain,
254 prefs::kRemoteAccessHostDomain,
255 base::Value::TYPE_STRING },
256 { key::kRemoteAccessHostTalkGadgetPrefix,
257 prefs::kRemoteAccessHostTalkGadgetPrefix,
258 base::Value::TYPE_STRING },
259 { key::kRemoteAccessHostRequireCurtain,
260 prefs::kRemoteAccessHostRequireCurtain,
261 base::Value::TYPE_BOOLEAN },
262 { key::kRemoteAccessHostAllowClientPairing,
263 prefs::kRemoteAccessHostAllowClientPairing,
264 base::Value::TYPE_BOOLEAN },
265 { key::kCloudPrintProxyEnabled,
266 prefs::kCloudPrintProxyEnabled,
267 base::Value::TYPE_BOOLEAN },
268 { key::kCloudPrintSubmitEnabled,
269 prefs::kCloudPrintSubmitEnabled,
270 base::Value::TYPE_BOOLEAN },
271 { key::kTranslateEnabled,
272 prefs::kEnableTranslate,
273 base::Value::TYPE_BOOLEAN },
274 { key::kAllowOutdatedPlugins,
275 prefs::kPluginsAllowOutdated,
276 base::Value::TYPE_BOOLEAN },
277 { key::kAlwaysAuthorizePlugins,
278 prefs::kPluginsAlwaysAuthorize,
279 base::Value::TYPE_BOOLEAN },
280 { key::kBookmarkBarEnabled,
281 prefs::kShowBookmarkBar,
282 base::Value::TYPE_BOOLEAN },
283 { key::kEditBookmarksEnabled,
284 prefs::kEditBookmarksEnabled,
285 base::Value::TYPE_BOOLEAN },
286 { key::kAllowFileSelectionDialogs,
287 prefs::kAllowFileSelectionDialogs,
288 base::Value::TYPE_BOOLEAN },
289 { key::kImportBookmarks,
290 prefs::kImportBookmarks,
291 base::Value::TYPE_BOOLEAN },
292 { key::kImportHistory,
293 prefs::kImportHistory,
294 base::Value::TYPE_BOOLEAN },
295 { key::kImportHomepage,
296 prefs::kImportHomepage,
297 base::Value::TYPE_BOOLEAN },
298 { key::kImportSearchEngine,
299 prefs::kImportSearchEngine,
300 base::Value::TYPE_BOOLEAN },
301 { key::kImportSavedPasswords,
302 prefs::kImportSavedPasswords,
303 base::Value::TYPE_BOOLEAN },
304 { key::kMaxConnectionsPerProxy,
305 prefs::kMaxConnectionsPerProxy,
306 base::Value::TYPE_INTEGER },
307 { key::kURLWhitelist,
308 policy_prefs::kUrlWhitelist,
309 base::Value::TYPE_LIST },
310 { key::kEnableMemoryInfo,
311 prefs::kEnableMemoryInfo,
312 base::Value::TYPE_BOOLEAN },
313 { key::kRestrictSigninToPattern,
314 prefs::kGoogleServicesUsernamePattern,
315 base::Value::TYPE_STRING },
316 { key::kDefaultMediaStreamSetting,
317 prefs::kManagedDefaultMediaStreamSetting,
318 base::Value::TYPE_INTEGER },
319 { key::kDisableSafeBrowsingProceedAnyway,
320 prefs::kSafeBrowsingProceedAnywayDisabled,
321 base::Value::TYPE_BOOLEAN },
322 { key::kSpellCheckServiceEnabled,
323 prefs::kSpellCheckUseSpellingService,
324 base::Value::TYPE_BOOLEAN },
325 { key::kDisableScreenshots,
326 prefs::kDisableScreenshots,
327 base::Value::TYPE_BOOLEAN },
328 { key::kAudioCaptureAllowed,
329 prefs::kAudioCaptureAllowed,
330 base::Value::TYPE_BOOLEAN },
331 { key::kVideoCaptureAllowed,
332 prefs::kVideoCaptureAllowed,
333 base::Value::TYPE_BOOLEAN },
334 { key::kAudioCaptureAllowedUrls,
335 prefs::kAudioCaptureAllowedUrls,
336 base::Value::TYPE_LIST },
337 { key::kVideoCaptureAllowedUrls,
338 prefs::kVideoCaptureAllowedUrls,
339 base::Value::TYPE_LIST },
340 { key::kHideWebStoreIcon,
341 prefs::kHideWebStoreIcon,
342 base::Value::TYPE_BOOLEAN },
343 { key::kVariationsRestrictParameter,
344 prefs::kVariationsRestrictParameter,
345 base::Value::TYPE_STRING },
346 { key::kSupervisedUserCreationEnabled,
347 prefs::kManagedUserCreationAllowed,
348 base::Value::TYPE_BOOLEAN },
349 { key::kForceEphemeralProfiles,
350 prefs::kForceEphemeralProfiles,
351 base::Value::TYPE_BOOLEAN },
353 #if !defined(OS_MACOSX)
354 { key::kFullscreenAllowed,
355 prefs::kFullscreenAllowed,
356 base::Value::TYPE_BOOLEAN },
357 { key::kFullscreenAllowed,
358 apps::prefs::kAppFullscreenAllowed,
359 base::Value::TYPE_BOOLEAN },
360 #endif // !defined(OS_MACOSX)
362 #if defined(OS_CHROMEOS)
363 { key::kChromeOsLockOnIdleSuspend,
364 prefs::kEnableScreenLock,
365 base::Value::TYPE_BOOLEAN },
366 { key::kChromeOsReleaseChannel,
367 prefs::kChromeOsReleaseChannel,
368 base::Value::TYPE_STRING },
369 { key::kDriveDisabled,
370 prefs::kDisableDrive,
371 base::Value::TYPE_BOOLEAN },
372 { key::kDriveDisabledOverCellular,
373 prefs::kDisableDriveOverCellular,
374 base::Value::TYPE_BOOLEAN },
375 { key::kExternalStorageDisabled,
376 prefs::kExternalStorageDisabled,
377 base::Value::TYPE_BOOLEAN },
378 { key::kAudioOutputAllowed,
379 prefs::kAudioOutputAllowed,
380 base::Value::TYPE_BOOLEAN },
381 { key::kShowLogoutButtonInTray,
382 prefs::kShowLogoutButtonInTray,
383 base::Value::TYPE_BOOLEAN },
384 { key::kShelfAutoHideBehavior,
385 prefs::kShelfAutoHideBehaviorLocal,
386 base::Value::TYPE_STRING },
387 { key::kSessionLengthLimit,
388 prefs::kSessionLengthLimit,
389 base::Value::TYPE_INTEGER },
390 { key::kWaitForInitialUserActivity,
391 prefs::kSessionWaitForInitialUserActivity,
392 base::Value::TYPE_BOOLEAN },
393 { key::kPowerManagementUsesAudioActivity,
394 prefs::kPowerUseAudioActivity,
395 base::Value::TYPE_BOOLEAN },
396 { key::kPowerManagementUsesVideoActivity,
397 prefs::kPowerUseVideoActivity,
398 base::Value::TYPE_BOOLEAN },
399 { key::kAllowScreenWakeLocks,
400 prefs::kPowerAllowScreenWakeLocks,
401 base::Value::TYPE_BOOLEAN },
402 { key::kWaitForInitialUserActivity,
403 prefs::kPowerWaitForInitialUserActivity,
404 base::Value::TYPE_BOOLEAN },
405 { key::kTermsOfServiceURL,
406 prefs::kTermsOfServiceURL,
407 base::Value::TYPE_STRING },
408 { key::kShowAccessibilityOptionsInSystemTrayMenu,
409 prefs::kShouldAlwaysShowAccessibilityMenu,
410 base::Value::TYPE_BOOLEAN },
411 { key::kLargeCursorEnabled,
412 prefs::kLargeCursorEnabled,
413 base::Value::TYPE_BOOLEAN },
414 { key::kSpokenFeedbackEnabled,
415 prefs::kSpokenFeedbackEnabled,
416 base::Value::TYPE_BOOLEAN },
417 { key::kHighContrastEnabled,
418 prefs::kHighContrastEnabled,
419 base::Value::TYPE_BOOLEAN },
420 { key::kDeviceLoginScreenDefaultLargeCursorEnabled,
421 NULL,
422 base::Value::TYPE_BOOLEAN },
423 { key::kDeviceLoginScreenDefaultSpokenFeedbackEnabled,
424 NULL,
425 base::Value::TYPE_BOOLEAN },
426 { key::kDeviceLoginScreenDefaultHighContrastEnabled,
427 NULL,
428 base::Value::TYPE_BOOLEAN },
429 { key::kRebootAfterUpdate,
430 prefs::kRebootAfterUpdate,
431 base::Value::TYPE_BOOLEAN },
432 { key::kAttestationEnabledForUser,
433 prefs::kAttestationEnabled,
434 base::Value::TYPE_BOOLEAN },
435 { key::kChromeOsMultiProfileUserBehavior,
436 prefs::kMultiProfileUserBehavior,
437 base::Value::TYPE_STRING },
438 #endif // defined(OS_CHROMEOS)
440 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS)
441 { key::kBackgroundModeEnabled,
442 prefs::kBackgroundModeEnabled,
443 base::Value::TYPE_BOOLEAN },
444 #endif // !defined(OS_MACOSX) && !defined(OS_CHROMEOS)
446 #if defined(OS_ANDROID)
447 { key::kDataCompressionProxyEnabled,
448 prefs::kSpdyProxyAuthEnabled,
449 base::Value::TYPE_BOOLEAN },
450 #endif // defined(OS_ANDROID)
453 // Mapping from extension type names to Manifest::Type.
454 StringToIntEnumListPolicyHandler::MappingEntry kExtensionAllowedTypesMap[] = {
455 { "extension", extensions::Manifest::TYPE_EXTENSION },
456 { "theme", extensions::Manifest::TYPE_THEME },
457 { "user_script", extensions::Manifest::TYPE_USER_SCRIPT },
458 { "hosted_app", extensions::Manifest::TYPE_HOSTED_APP },
459 { "legacy_packaged_app", extensions::Manifest::TYPE_LEGACY_PACKAGED_APP },
460 { "platform_app", extensions::Manifest::TYPE_PLATFORM_APP },
463 } // namespace
465 #if !defined(OS_IOS)
466 scoped_ptr<ConfigurationPolicyHandlerList> BuildHandlerList() {
467 scoped_ptr<ConfigurationPolicyHandlerList> handlers(
468 new ConfigurationPolicyHandlerList(base::Bind(&GetChromePolicyDetails)));
469 for (size_t i = 0; i < arraysize(kSimplePolicyMap); ++i) {
470 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
471 new SimplePolicyHandler(kSimplePolicyMap[i].policy_name,
472 kSimplePolicyMap[i].preference_path,
473 kSimplePolicyMap[i].value_type)));
476 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
477 new AutofillPolicyHandler()));
478 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
479 new DefaultSearchPolicyHandler()));
480 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
481 new FileSelectionDialogsPolicyHandler()));
482 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
483 new IncognitoModePolicyHandler()));
484 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
485 new JavascriptPolicyHandler()));
486 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
487 new ProxyPolicyHandler()));
488 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
489 new RestoreOnStartupPolicyHandler()));
490 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
491 new browser_sync::SyncPolicyHandler()));
492 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
493 new URLBlacklistPolicyHandler()));
495 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
496 new extensions::ExtensionListPolicyHandler(
497 key::kExtensionInstallWhitelist,
498 extensions::pref_names::kInstallAllowList,
499 false)));
500 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
501 new extensions::ExtensionListPolicyHandler(
502 key::kExtensionInstallBlacklist,
503 extensions::pref_names::kInstallDenyList,
504 true)));
505 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
506 new extensions::ExtensionInstallForcelistPolicyHandler()));
507 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
508 new extensions::ExtensionURLPatternListPolicyHandler(
509 key::kExtensionInstallSources,
510 extensions::pref_names::kAllowedInstallSites)));
511 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
512 new StringToIntEnumListPolicyHandler(
513 key::kExtensionAllowedTypes,
514 extensions::pref_names::kAllowedTypes,
515 kExtensionAllowedTypesMap,
516 kExtensionAllowedTypesMap + arraysize(kExtensionAllowedTypesMap))));
517 #if defined(OS_CHROMEOS)
518 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
519 new extensions::ExtensionListPolicyHandler(
520 key::kAttestationExtensionWhitelist,
521 prefs::kAttestationExtensionWhitelist,
522 false)));
523 #endif // defined(OS_CHROMEOS)
525 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
526 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
527 new DiskCacheDirPolicyHandler()));
528 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
529 new DownloadDirPolicyHandler));
531 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
532 new extensions::NativeMessagingHostListPolicyHandler(
533 key::kNativeMessagingWhitelist,
534 extensions::pref_names::kNativeMessagingWhitelist,
535 false)));
536 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
537 new extensions::NativeMessagingHostListPolicyHandler(
538 key::kNativeMessagingBlacklist,
539 extensions::pref_names::kNativeMessagingBlacklist,
540 true)));
541 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
543 #if defined(OS_CHROMEOS)
544 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
545 NetworkConfigurationPolicyHandler::CreateForDevicePolicy()));
546 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
547 NetworkConfigurationPolicyHandler::CreateForUserPolicy()));
548 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
549 new PinnedLauncherAppsPolicyHandler()));
550 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
551 new ScreenMagnifierPolicyHandler()));
552 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
553 new LoginScreenPowerManagementPolicyHandler));
555 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
556 new IntRangePolicyHandler(key::kScreenDimDelayAC,
557 prefs::kPowerAcScreenDimDelayMs,
559 INT_MAX,
560 true)));
561 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
562 new IntRangePolicyHandler(key::kScreenOffDelayAC,
563 prefs::kPowerAcScreenOffDelayMs,
565 INT_MAX,
566 true)));
567 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
568 new IntRangePolicyHandler(key::kScreenLockDelayAC,
569 prefs::kPowerAcScreenLockDelayMs,
571 INT_MAX,
572 true)));
573 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
574 new IntRangePolicyHandler(key::kIdleWarningDelayAC,
575 prefs::kPowerAcIdleWarningDelayMs,
577 INT_MAX,
578 true)));
579 handlers->AddHandler(
580 make_scoped_ptr<ConfigurationPolicyHandler>(new IntRangePolicyHandler(
581 key::kIdleDelayAC, prefs::kPowerAcIdleDelayMs, 0, INT_MAX, true)));
582 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
583 new IntRangePolicyHandler(key::kScreenDimDelayBattery,
584 prefs::kPowerBatteryScreenDimDelayMs,
586 INT_MAX,
587 true)));
588 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
589 new IntRangePolicyHandler(key::kScreenOffDelayBattery,
590 prefs::kPowerBatteryScreenOffDelayMs,
592 INT_MAX,
593 true)));
594 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
595 new IntRangePolicyHandler(key::kScreenLockDelayBattery,
596 prefs::kPowerBatteryScreenLockDelayMs,
598 INT_MAX,
599 true)));
600 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
601 new IntRangePolicyHandler(key::kIdleWarningDelayBattery,
602 prefs::kPowerBatteryIdleWarningDelayMs,
604 INT_MAX,
605 true)));
606 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
607 new IntRangePolicyHandler(key::kIdleDelayBattery,
608 prefs::kPowerBatteryIdleDelayMs,
610 INT_MAX,
611 true)));
612 handlers->AddHandler(
613 make_scoped_ptr<ConfigurationPolicyHandler>(new IntRangePolicyHandler(
614 key::kIdleActionAC,
615 prefs::kPowerAcIdleAction,
616 chromeos::PowerPolicyController::ACTION_SUSPEND,
617 chromeos::PowerPolicyController::ACTION_DO_NOTHING,
618 false)));
619 handlers->AddHandler(
620 make_scoped_ptr<ConfigurationPolicyHandler>(new IntRangePolicyHandler(
621 key::kIdleActionBattery,
622 prefs::kPowerBatteryIdleAction,
623 chromeos::PowerPolicyController::ACTION_SUSPEND,
624 chromeos::PowerPolicyController::ACTION_DO_NOTHING,
625 false)));
626 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
627 new DeprecatedIdleActionHandler()));
628 handlers->AddHandler(
629 make_scoped_ptr<ConfigurationPolicyHandler>(new IntRangePolicyHandler(
630 key::kLidCloseAction,
631 prefs::kPowerLidClosedAction,
632 chromeos::PowerPolicyController::ACTION_SUSPEND,
633 chromeos::PowerPolicyController::ACTION_DO_NOTHING,
634 false)));
635 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
636 new IntPercentageToDoublePolicyHandler(
637 key::kPresentationScreenDimDelayScale,
638 prefs::kPowerPresentationScreenDimDelayFactor,
639 100,
640 INT_MAX,
641 true)));
642 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
643 new IntPercentageToDoublePolicyHandler(
644 key::kUserActivityScreenDimDelayScale,
645 prefs::kPowerUserActivityScreenDimDelayFactor,
646 100,
647 INT_MAX,
648 true)));
649 handlers->AddHandler(
650 make_scoped_ptr<ConfigurationPolicyHandler>(new IntRangePolicyHandler(
651 key::kUptimeLimit, prefs::kUptimeLimit, 3600, INT_MAX, true)));
652 handlers->AddHandler(
653 make_scoped_ptr<ConfigurationPolicyHandler>(new IntRangePolicyHandler(
654 key::kDeviceLoginScreenDefaultScreenMagnifierType,
655 NULL,
657 ash::MAGNIFIER_FULL,
658 false)));
659 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
660 new ExternalDataPolicyHandler(key::kUserAvatarImage)));
661 #endif // defined(OS_CHROMEOS)
663 #if defined(OS_ANDROID)
664 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
665 new ManagedBookmarksPolicyHandler()));
666 #endif
667 return handlers.Pass();
669 #endif // !defined(OS_IOS)
671 } // namespace policy