| 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/net/proxy_policy_handler.h" | 11 #include "chrome/browser/net/proxy_policy_handler.h" |
| 12 #include "chrome/browser/profiles/incognito_mode_policy_handler.h" | 12 #include "chrome/browser/profiles/incognito_mode_policy_handler.h" |
| 13 #include "chrome/browser/search_engines/default_search_policy_handler.h" | 13 #include "chrome/browser/search_engines/default_search_policy_handler.h" |
| 14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 15 #include "components/password_manager/core/common/password_manager_pref_names.h" | 15 #include "components/password_manager/core/common/password_manager_pref_names.h" |
| 16 #include "components/policy/core/browser/autofill_policy_handler.h" | 16 #include "components/policy/core/browser/autofill_policy_handler.h" |
| 17 #include "components/policy/core/browser/configuration_policy_handler.h" | 17 #include "components/policy/core/browser/configuration_policy_handler.h" |
| 18 #include "components/policy/core/browser/configuration_policy_handler_list.h" | 18 #include "components/policy/core/browser/configuration_policy_handler_list.h" |
| 19 #include "components/policy/core/browser/configuration_policy_handler_parameters
.h" | 19 #include "components/policy/core/browser/configuration_policy_handler_parameters
.h" |
| 20 #include "components/policy/core/browser/url_blacklist_policy_handler.h" | 20 #include "components/policy/core/browser/url_blacklist_policy_handler.h" |
| 21 #include "components/policy/core/common/policy_details.h" | 21 #include "components/policy/core/common/policy_details.h" |
| 22 #include "components/policy/core/common/policy_map.h" | 22 #include "components/policy/core/common/policy_map.h" |
| 23 #include "components/policy/core/common/policy_pref_names.h" | 23 #include "components/policy/core/common/policy_pref_names.h" |
| 24 #include "components/policy/core/common/schema.h" | 24 #include "components/policy/core/common/schema.h" |
| 25 #include "components/translate/core/common/translate_pref_names.h" | 25 #include "components/translate/core/common/translate_pref_names.h" |
| 26 #include "grit/component_strings.h" | 26 #include "grit/component_strings.h" |
| 27 #include "policy/policy_constants.h" | 27 #include "policy/policy_constants.h" |
| 28 #include "webkit/common/webpreferences.h" |
| 28 | 29 |
| 29 #if !defined(OS_IOS) | 30 #if !defined(OS_IOS) |
| 30 #include "chrome/browser/extensions/api/messaging/native_messaging_policy_handle
r.h" | 31 #include "chrome/browser/extensions/api/messaging/native_messaging_policy_handle
r.h" |
| 31 #include "chrome/browser/extensions/policy_handlers.h" | 32 #include "chrome/browser/extensions/policy_handlers.h" |
| 32 #include "chrome/browser/net/disk_cache_dir_policy_handler.h" | 33 #include "chrome/browser/net/disk_cache_dir_policy_handler.h" |
| 33 #include "chrome/browser/policy/file_selection_dialogs_policy_handler.h" | 34 #include "chrome/browser/policy/file_selection_dialogs_policy_handler.h" |
| 34 #include "chrome/browser/policy/javascript_policy_handler.h" | 35 #include "chrome/browser/policy/javascript_policy_handler.h" |
| 35 #include "chrome/browser/sessions/restore_on_startup_policy_handler.h" | 36 #include "chrome/browser/sessions/restore_on_startup_policy_handler.h" |
| 36 #include "chrome/browser/sync/sync_policy_handler.h" | 37 #include "chrome/browser/sync/sync_policy_handler.h" |
| 37 #include "extensions/browser/pref_names.h" | 38 #include "extensions/browser/pref_names.h" |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 #if !defined(OS_IOS) | 485 #if !defined(OS_IOS) |
| 485 // Mapping from extension type names to Manifest::Type. | 486 // Mapping from extension type names to Manifest::Type. |
| 486 StringToIntEnumListPolicyHandler::MappingEntry kExtensionAllowedTypesMap[] = { | 487 StringToIntEnumListPolicyHandler::MappingEntry kExtensionAllowedTypesMap[] = { |
| 487 { "extension", extensions::Manifest::TYPE_EXTENSION }, | 488 { "extension", extensions::Manifest::TYPE_EXTENSION }, |
| 488 { "theme", extensions::Manifest::TYPE_THEME }, | 489 { "theme", extensions::Manifest::TYPE_THEME }, |
| 489 { "user_script", extensions::Manifest::TYPE_USER_SCRIPT }, | 490 { "user_script", extensions::Manifest::TYPE_USER_SCRIPT }, |
| 490 { "hosted_app", extensions::Manifest::TYPE_HOSTED_APP }, | 491 { "hosted_app", extensions::Manifest::TYPE_HOSTED_APP }, |
| 491 { "legacy_packaged_app", extensions::Manifest::TYPE_LEGACY_PACKAGED_APP }, | 492 { "legacy_packaged_app", extensions::Manifest::TYPE_LEGACY_PACKAGED_APP }, |
| 492 { "platform_app", extensions::Manifest::TYPE_PLATFORM_APP }, | 493 { "platform_app", extensions::Manifest::TYPE_PLATFORM_APP }, |
| 493 }; | 494 }; |
| 495 |
| 496 // Maps feature tags as specified in policy to the corresponding enum value. |
| 497 StringToIntEnumListPolicyHandler::MappingEntry |
| 498 kEnableDeprecatedWebPlatformFeaturesMap[] = { |
| 499 // TODO: Remove after 2015-04-30 per http://crbug.com/374782. |
| 500 { "ShowModalDialog_EffectiveUntil20150430", |
| 501 webkit_glue::DEPRECATED_FEATURE_SHOW_MODAL_DIALOG }, |
| 502 }; |
| 494 #endif // !defined(OS_IOS) | 503 #endif // !defined(OS_IOS) |
| 495 | 504 |
| 496 } // namespace | 505 } // namespace |
| 497 | 506 |
| 498 void PopulatePolicyHandlerParameters(PolicyHandlerParameters* parameters) { | 507 void PopulatePolicyHandlerParameters(PolicyHandlerParameters* parameters) { |
| 499 #if defined(OS_CHROMEOS) | 508 #if defined(OS_CHROMEOS) |
| 500 if (chromeos::UserManager::IsInitialized()) { | 509 if (chromeos::UserManager::IsInitialized()) { |
| 501 const chromeos::User* user = chromeos::UserManager::Get()->GetActiveUser(); | 510 const chromeos::User* user = chromeos::UserManager::Get()->GetActiveUser(); |
| 502 if (user) | 511 if (user) |
| 503 parameters->user_id_hash = user->username_hash(); | 512 parameters->user_id_hash = user->username_hash(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( | 563 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( |
| 555 new extensions::ExtensionURLPatternListPolicyHandler( | 564 new extensions::ExtensionURLPatternListPolicyHandler( |
| 556 key::kExtensionInstallSources, | 565 key::kExtensionInstallSources, |
| 557 extensions::pref_names::kAllowedInstallSites))); | 566 extensions::pref_names::kAllowedInstallSites))); |
| 558 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( | 567 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( |
| 559 new StringToIntEnumListPolicyHandler( | 568 new StringToIntEnumListPolicyHandler( |
| 560 key::kExtensionAllowedTypes, | 569 key::kExtensionAllowedTypes, |
| 561 extensions::pref_names::kAllowedTypes, | 570 extensions::pref_names::kAllowedTypes, |
| 562 kExtensionAllowedTypesMap, | 571 kExtensionAllowedTypesMap, |
| 563 kExtensionAllowedTypesMap + arraysize(kExtensionAllowedTypesMap)))); | 572 kExtensionAllowedTypesMap + arraysize(kExtensionAllowedTypesMap)))); |
| 573 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( |
| 574 new StringToIntEnumListPolicyHandler( |
| 575 key::kEnableDeprecatedWebPlatformFeatures, |
| 576 prefs::kWebKitEnableDeprecatedFeatures, |
| 577 kEnableDeprecatedWebPlatformFeaturesMap, |
| 578 kEnableDeprecatedWebPlatformFeaturesMap + |
| 579 arraysize(kEnableDeprecatedWebPlatformFeaturesMap)))); |
| 564 #endif // !defined(OS_IOS) | 580 #endif // !defined(OS_IOS) |
| 565 | 581 |
| 566 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) | 582 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) |
| 567 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( | 583 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( |
| 568 new DiskCacheDirPolicyHandler())); | 584 new DiskCacheDirPolicyHandler())); |
| 569 | 585 |
| 570 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( | 586 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( |
| 571 new extensions::NativeMessagingHostListPolicyHandler( | 587 new extensions::NativeMessagingHostListPolicyHandler( |
| 572 key::kNativeMessagingWhitelist, | 588 key::kNativeMessagingWhitelist, |
| 573 extensions::pref_names::kNativeMessagingWhitelist, | 589 extensions::pref_names::kNativeMessagingWhitelist, |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 #endif // defined(OS_CHROMEOS) | 749 #endif // defined(OS_CHROMEOS) |
| 734 | 750 |
| 735 #if defined(OS_ANDROID) || defined(OS_IOS) | 751 #if defined(OS_ANDROID) || defined(OS_IOS) |
| 736 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( | 752 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( |
| 737 new ManagedBookmarksPolicyHandler())); | 753 new ManagedBookmarksPolicyHandler())); |
| 738 #endif | 754 #endif |
| 739 return handlers.Pass(); | 755 return handlers.Pass(); |
| 740 } | 756 } |
| 741 | 757 |
| 742 } // namespace policy | 758 } // namespace policy |
| OLD | NEW |