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

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

Issue 138163015: More fixes to enable ios build with policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed obsolete files from gyp Created 6 years, 11 months 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 | Annotate | Revision Log
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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/common/pref_names.h"
11 #include "components/policy/core/browser/configuration_policy_handler.h"
12 #include "components/policy/core/browser/configuration_policy_handler_list.h"
13 #include "components/policy/core/common/policy_details.h"
14 #include "components/policy/core/common/policy_map.h"
15 #include "components/policy/core/common/policy_pref_names.h"
16 #include "grit/component_strings.h"
17 #include "policy/policy_constants.h"
18
19 #if !defined(OS_IOS)
10 #include "chrome/browser/extensions/api/messaging/native_messaging_policy_handle r.h" 20 #include "chrome/browser/extensions/api/messaging/native_messaging_policy_handle r.h"
11 #include "chrome/browser/extensions/policy_handlers.h" 21 #include "chrome/browser/extensions/policy_handlers.h"
12 #include "chrome/browser/net/disk_cache_dir_policy_handler.h" 22 #include "chrome/browser/net/disk_cache_dir_policy_handler.h"
13 #include "chrome/browser/net/proxy_policy_handler.h" 23 #include "chrome/browser/net/proxy_policy_handler.h"
14 #include "chrome/browser/policy/file_selection_dialogs_policy_handler.h" 24 #include "chrome/browser/policy/file_selection_dialogs_policy_handler.h"
15 #include "chrome/browser/policy/javascript_policy_handler.h" 25 #include "chrome/browser/policy/javascript_policy_handler.h"
16 #include "chrome/browser/profiles/incognito_mode_policy_handler.h" 26 #include "chrome/browser/profiles/incognito_mode_policy_handler.h"
17 #include "chrome/browser/search_engines/default_search_policy_handler.h" 27 #include "chrome/browser/search_engines/default_search_policy_handler.h"
18 #include "chrome/browser/sessions/restore_on_startup_policy_handler.h" 28 #include "chrome/browser/sessions/restore_on_startup_policy_handler.h"
19 #include "chrome/browser/sync/sync_policy_handler.h" 29 #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" 30 #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" 31 #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" 32 #include "extensions/browser/pref_names.h"
29 #include "extensions/common/manifest.h" 33 #include "extensions/common/manifest.h"
30 #include "grit/component_strings.h" 34 #endif
31 #include "policy/policy_constants.h"
32 35
33 #if defined(OS_CHROMEOS) 36 #if defined(OS_CHROMEOS)
34 #include "ash/magnifier/magnifier_constants.h" 37 #include "ash/magnifier/magnifier_constants.h"
35 #include "chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h " 38 #include "chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h "
36 #include "chromeos/dbus/power_policy_controller.h" 39 #include "chromeos/dbus/power_policy_controller.h"
37 #endif // defined(OS_CHROMEOS) 40 #endif // defined(OS_CHROMEOS)
38 41
39 #if defined(OS_ANDROID) 42 #if defined(OS_ANDROID)
40 #include "chrome/browser/policy/configuration_policy_handler_android.h" 43 #include "chrome/browser/policy/configuration_policy_handler_android.h"
41 #endif // defined(OS_ANDROID) 44 #endif // defined(OS_ANDROID)
42 45
43 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) 46 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
44 #include "chrome/browser/download/download_dir_policy_handler.h" 47 #include "chrome/browser/download/download_dir_policy_handler.h"
45 #endif 48 #endif
46 49
47 #if !defined(OS_MACOSX) 50 #if !defined(OS_MACOSX) && !defined(OS_IOS)
48 #include "apps/pref_names.h" 51 #include "apps/pref_names.h"
49 #endif 52 #endif
50 53
51 namespace policy { 54 namespace policy {
52 55
53 namespace { 56 namespace {
54 57
55 // List of policy types to preference names. This is used for simple policies 58 // List of policy types to preference names. This is used for simple policies
56 // that directly map to a single preference. 59 // that directly map to a single preference.
57 const PolicyToPreferenceMapEntry kSimplePolicyMap[] = { 60 const PolicyToPreferenceMapEntry kSimplePolicyMap[] = {
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 { key::kVariationsRestrictParameter, 346 { key::kVariationsRestrictParameter,
344 prefs::kVariationsRestrictParameter, 347 prefs::kVariationsRestrictParameter,
345 base::Value::TYPE_STRING }, 348 base::Value::TYPE_STRING },
346 { key::kSupervisedUserCreationEnabled, 349 { key::kSupervisedUserCreationEnabled,
347 prefs::kManagedUserCreationAllowed, 350 prefs::kManagedUserCreationAllowed,
348 base::Value::TYPE_BOOLEAN }, 351 base::Value::TYPE_BOOLEAN },
349 { key::kForceEphemeralProfiles, 352 { key::kForceEphemeralProfiles,
350 prefs::kForceEphemeralProfiles, 353 prefs::kForceEphemeralProfiles,
351 base::Value::TYPE_BOOLEAN }, 354 base::Value::TYPE_BOOLEAN },
352 355
353 #if !defined(OS_MACOSX) 356 #if !defined(OS_MACOSX) && !defined(OS_IOS)
354 { key::kFullscreenAllowed, 357 { key::kFullscreenAllowed,
355 prefs::kFullscreenAllowed, 358 prefs::kFullscreenAllowed,
356 base::Value::TYPE_BOOLEAN }, 359 base::Value::TYPE_BOOLEAN },
357 { key::kFullscreenAllowed, 360 { key::kFullscreenAllowed,
358 apps::prefs::kAppFullscreenAllowed, 361 apps::prefs::kAppFullscreenAllowed,
359 base::Value::TYPE_BOOLEAN }, 362 base::Value::TYPE_BOOLEAN },
360 #endif // !defined(OS_MACOSX) 363 #endif // !defined(OS_MACOSX) && !defined(OS_IOS)
361 364
362 #if defined(OS_CHROMEOS) 365 #if defined(OS_CHROMEOS)
363 { key::kChromeOsLockOnIdleSuspend, 366 { key::kChromeOsLockOnIdleSuspend,
364 prefs::kEnableScreenLock, 367 prefs::kEnableScreenLock,
365 base::Value::TYPE_BOOLEAN }, 368 base::Value::TYPE_BOOLEAN },
366 { key::kChromeOsReleaseChannel, 369 { key::kChromeOsReleaseChannel,
367 prefs::kChromeOsReleaseChannel, 370 prefs::kChromeOsReleaseChannel,
368 base::Value::TYPE_STRING }, 371 base::Value::TYPE_STRING },
369 { key::kDriveDisabled, 372 { key::kDriveDisabled,
370 prefs::kDisableDrive, 373 prefs::kDisableDrive,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 base::Value::TYPE_BOOLEAN }, 446 base::Value::TYPE_BOOLEAN },
444 #endif // !defined(OS_MACOSX) && !defined(OS_CHROMEOS) 447 #endif // !defined(OS_MACOSX) && !defined(OS_CHROMEOS)
445 448
446 #if defined(OS_ANDROID) 449 #if defined(OS_ANDROID)
447 { key::kDataCompressionProxyEnabled, 450 { key::kDataCompressionProxyEnabled,
448 prefs::kSpdyProxyAuthEnabled, 451 prefs::kSpdyProxyAuthEnabled,
449 base::Value::TYPE_BOOLEAN }, 452 base::Value::TYPE_BOOLEAN },
450 #endif // defined(OS_ANDROID) 453 #endif // defined(OS_ANDROID)
451 }; 454 };
452 455
456 #if !defined(OS_IOS)
453 // Mapping from extension type names to Manifest::Type. 457 // Mapping from extension type names to Manifest::Type.
454 StringToIntEnumListPolicyHandler::MappingEntry kExtensionAllowedTypesMap[] = { 458 StringToIntEnumListPolicyHandler::MappingEntry kExtensionAllowedTypesMap[] = {
455 { "extension", extensions::Manifest::TYPE_EXTENSION }, 459 { "extension", extensions::Manifest::TYPE_EXTENSION },
456 { "theme", extensions::Manifest::TYPE_THEME }, 460 { "theme", extensions::Manifest::TYPE_THEME },
457 { "user_script", extensions::Manifest::TYPE_USER_SCRIPT }, 461 { "user_script", extensions::Manifest::TYPE_USER_SCRIPT },
458 { "hosted_app", extensions::Manifest::TYPE_HOSTED_APP }, 462 { "hosted_app", extensions::Manifest::TYPE_HOSTED_APP },
459 { "legacy_packaged_app", extensions::Manifest::TYPE_LEGACY_PACKAGED_APP }, 463 { "legacy_packaged_app", extensions::Manifest::TYPE_LEGACY_PACKAGED_APP },
460 { "platform_app", extensions::Manifest::TYPE_PLATFORM_APP }, 464 { "platform_app", extensions::Manifest::TYPE_PLATFORM_APP },
461 }; 465 };
466 #endif // !defined(OS_IOS)
462 467
463 } // namespace 468 } // namespace
464 469
465 #if !defined(OS_IOS)
466 scoped_ptr<ConfigurationPolicyHandlerList> BuildHandlerList() { 470 scoped_ptr<ConfigurationPolicyHandlerList> BuildHandlerList() {
467 scoped_ptr<ConfigurationPolicyHandlerList> handlers( 471 scoped_ptr<ConfigurationPolicyHandlerList> handlers(
468 new ConfigurationPolicyHandlerList(base::Bind(&GetChromePolicyDetails))); 472 new ConfigurationPolicyHandlerList(base::Bind(&GetChromePolicyDetails)));
469 for (size_t i = 0; i < arraysize(kSimplePolicyMap); ++i) { 473 for (size_t i = 0; i < arraysize(kSimplePolicyMap); ++i) {
470 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 474 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
471 new SimplePolicyHandler(kSimplePolicyMap[i].policy_name, 475 new SimplePolicyHandler(kSimplePolicyMap[i].policy_name,
472 kSimplePolicyMap[i].preference_path, 476 kSimplePolicyMap[i].preference_path,
473 kSimplePolicyMap[i].value_type))); 477 kSimplePolicyMap[i].value_type)));
474 } 478 }
475 479
480 #if !defined(OS_IOS)
476 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 481 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
477 new AutofillPolicyHandler())); 482 new AutofillPolicyHandler()));
478 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 483 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
479 new DefaultSearchPolicyHandler())); 484 new DefaultSearchPolicyHandler()));
480 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 485 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
481 new FileSelectionDialogsPolicyHandler())); 486 new FileSelectionDialogsPolicyHandler()));
482 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 487 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
483 new IncognitoModePolicyHandler())); 488 new IncognitoModePolicyHandler()));
484 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 489 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
485 new JavascriptPolicyHandler())); 490 new JavascriptPolicyHandler()));
(...skipping 21 matching lines...) Expand all
507 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 512 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
508 new extensions::ExtensionURLPatternListPolicyHandler( 513 new extensions::ExtensionURLPatternListPolicyHandler(
509 key::kExtensionInstallSources, 514 key::kExtensionInstallSources,
510 extensions::pref_names::kAllowedInstallSites))); 515 extensions::pref_names::kAllowedInstallSites)));
511 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 516 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
512 new StringToIntEnumListPolicyHandler( 517 new StringToIntEnumListPolicyHandler(
513 key::kExtensionAllowedTypes, 518 key::kExtensionAllowedTypes,
514 extensions::pref_names::kAllowedTypes, 519 extensions::pref_names::kAllowedTypes,
515 kExtensionAllowedTypesMap, 520 kExtensionAllowedTypesMap,
516 kExtensionAllowedTypesMap + arraysize(kExtensionAllowedTypesMap)))); 521 kExtensionAllowedTypesMap + arraysize(kExtensionAllowedTypesMap))));
517 #if defined(OS_CHROMEOS) 522 #endif // !defined(OS_IOS)
518 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
519 new extensions::ExtensionListPolicyHandler(
520 key::kAttestationExtensionWhitelist,
521 prefs::kAttestationExtensionWhitelist,
522 false)));
523 #endif // defined(OS_CHROMEOS)
524 523
525 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) 524 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
526 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 525 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
527 new DiskCacheDirPolicyHandler())); 526 new DiskCacheDirPolicyHandler()));
528 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 527 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
529 new DownloadDirPolicyHandler)); 528 new DownloadDirPolicyHandler));
530 529
531 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 530 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
532 new extensions::NativeMessagingHostListPolicyHandler( 531 new extensions::NativeMessagingHostListPolicyHandler(
533 key::kNativeMessagingWhitelist, 532 key::kNativeMessagingWhitelist,
534 extensions::pref_names::kNativeMessagingWhitelist, 533 extensions::pref_names::kNativeMessagingWhitelist,
535 false))); 534 false)));
536 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 535 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
537 new extensions::NativeMessagingHostListPolicyHandler( 536 new extensions::NativeMessagingHostListPolicyHandler(
538 key::kNativeMessagingBlacklist, 537 key::kNativeMessagingBlacklist,
539 extensions::pref_names::kNativeMessagingBlacklist, 538 extensions::pref_names::kNativeMessagingBlacklist,
540 true))); 539 true)));
541 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) 540 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
542 541
543 #if defined(OS_CHROMEOS) 542 #if defined(OS_CHROMEOS)
544 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 543 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
544 new extensions::ExtensionListPolicyHandler(
545 key::kAttestationExtensionWhitelist,
546 prefs::kAttestationExtensionWhitelist,
547 false)));
548 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
545 NetworkConfigurationPolicyHandler::CreateForDevicePolicy())); 549 NetworkConfigurationPolicyHandler::CreateForDevicePolicy()));
546 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 550 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
547 NetworkConfigurationPolicyHandler::CreateForUserPolicy())); 551 NetworkConfigurationPolicyHandler::CreateForUserPolicy()));
548 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 552 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
549 new PinnedLauncherAppsPolicyHandler())); 553 new PinnedLauncherAppsPolicyHandler()));
550 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 554 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
551 new ScreenMagnifierPolicyHandler())); 555 new ScreenMagnifierPolicyHandler()));
552 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 556 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
553 new LoginScreenPowerManagementPolicyHandler)); 557 new LoginScreenPowerManagementPolicyHandler));
554 558
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 663 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
660 new ExternalDataPolicyHandler(key::kUserAvatarImage))); 664 new ExternalDataPolicyHandler(key::kUserAvatarImage)));
661 #endif // defined(OS_CHROMEOS) 665 #endif // defined(OS_CHROMEOS)
662 666
663 #if defined(OS_ANDROID) 667 #if defined(OS_ANDROID)
664 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 668 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
665 new ManagedBookmarksPolicyHandler())); 669 new ManagedBookmarksPolicyHandler()));
666 #endif 670 #endif
667 return handlers.Pass(); 671 return handlers.Pass();
668 } 672 }
669 #endif // !defined(OS_IOS)
670 673
671 } // namespace policy 674 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/browser_process_platform_part_base.cc ('k') | chrome/browser/policy/policy_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698