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/policy/managed_bookmarks_policy_handler.h" | 12 #include "chrome/browser/policy/managed_bookmarks_policy_handler.h" |
13 #include "chrome/browser/profiles/incognito_mode_policy_handler.h" | 13 #include "chrome/browser/profiles/incognito_mode_policy_handler.h" |
14 #include "chrome/browser/search_engines/default_search_policy_handler.h" | 14 #include "chrome/browser/search_engines/default_search_policy_handler.h" |
| 15 #include "chrome/common/chrome_switches.h" |
15 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
16 #include "components/password_manager/core/common/password_manager_pref_names.h" | 17 #include "components/password_manager/core/common/password_manager_pref_names.h" |
17 #include "components/policy/core/browser/autofill_policy_handler.h" | 18 #include "components/policy/core/browser/autofill_policy_handler.h" |
18 #include "components/policy/core/browser/configuration_policy_handler.h" | 19 #include "components/policy/core/browser/configuration_policy_handler.h" |
19 #include "components/policy/core/browser/configuration_policy_handler_list.h" | 20 #include "components/policy/core/browser/configuration_policy_handler_list.h" |
20 #include "components/policy/core/browser/configuration_policy_handler_parameters
.h" | 21 #include "components/policy/core/browser/configuration_policy_handler_parameters
.h" |
21 #include "components/policy/core/browser/url_blacklist_policy_handler.h" | 22 #include "components/policy/core/browser/url_blacklist_policy_handler.h" |
22 #include "components/policy/core/common/policy_details.h" | 23 #include "components/policy/core/common/policy_details.h" |
23 #include "components/policy/core/common/policy_map.h" | 24 #include "components/policy/core/common/policy_map.h" |
24 #include "components/policy/core/common/policy_pref_names.h" | 25 #include "components/policy/core/common/policy_pref_names.h" |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 extensions::pref_names::kNativeMessagingUserLevelHosts, | 485 extensions::pref_names::kNativeMessagingUserLevelHosts, |
485 base::Value::TYPE_BOOLEAN }, | 486 base::Value::TYPE_BOOLEAN }, |
486 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) | 487 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) |
487 }; | 488 }; |
488 | 489 |
489 #if !defined(OS_IOS) | 490 #if !defined(OS_IOS) |
490 void GetExtensionAllowedTypesMap( | 491 void GetExtensionAllowedTypesMap( |
491 ScopedVector<StringMappingListPolicyHandler::MappingEntry>* result) { | 492 ScopedVector<StringMappingListPolicyHandler::MappingEntry>* result) { |
492 // Mapping from extension type names to Manifest::Type. | 493 // Mapping from extension type names to Manifest::Type. |
493 result->push_back(new StringMappingListPolicyHandler::MappingEntry( | 494 result->push_back(new StringMappingListPolicyHandler::MappingEntry( |
494 "extension", scoped_ptr<base::Value>(base::Value::CreateIntegerValue( | 495 "extension", scoped_ptr<base::Value>(new base::FundamentalValue( |
495 extensions::Manifest::TYPE_EXTENSION)))); | 496 extensions::Manifest::TYPE_EXTENSION)))); |
496 result->push_back(new StringMappingListPolicyHandler::MappingEntry( | 497 result->push_back(new StringMappingListPolicyHandler::MappingEntry( |
497 "theme", scoped_ptr<base::Value>(base::Value::CreateIntegerValue( | 498 "theme", scoped_ptr<base::Value>(new base::FundamentalValue( |
498 extensions::Manifest::TYPE_THEME)))); | 499 extensions::Manifest::TYPE_THEME)))); |
499 result->push_back(new StringMappingListPolicyHandler::MappingEntry( | 500 result->push_back(new StringMappingListPolicyHandler::MappingEntry( |
500 "user_script", scoped_ptr<base::Value>(base::Value::CreateIntegerValue( | 501 "user_script", scoped_ptr<base::Value>(new base::FundamentalValue( |
501 extensions::Manifest::TYPE_USER_SCRIPT)))); | 502 extensions::Manifest::TYPE_USER_SCRIPT)))); |
502 result->push_back(new StringMappingListPolicyHandler::MappingEntry( | 503 result->push_back(new StringMappingListPolicyHandler::MappingEntry( |
503 "hosted_app", scoped_ptr<base::Value>(base::Value::CreateIntegerValue( | 504 "hosted_app", scoped_ptr<base::Value>(new base::FundamentalValue( |
504 extensions::Manifest::TYPE_HOSTED_APP)))); | 505 extensions::Manifest::TYPE_HOSTED_APP)))); |
505 result->push_back(new StringMappingListPolicyHandler::MappingEntry( | 506 result->push_back(new StringMappingListPolicyHandler::MappingEntry( |
506 "legacy_packaged_app", scoped_ptr<base::Value>( | 507 "legacy_packaged_app", scoped_ptr<base::Value>(new base::FundamentalValue( |
507 base::Value::CreateIntegerValue( | 508 extensions::Manifest::TYPE_LEGACY_PACKAGED_APP)))); |
508 extensions::Manifest::TYPE_LEGACY_PACKAGED_APP)))); | |
509 result->push_back(new StringMappingListPolicyHandler::MappingEntry( | 509 result->push_back(new StringMappingListPolicyHandler::MappingEntry( |
510 "platform_app", scoped_ptr<base::Value>(base::Value::CreateIntegerValue( | 510 "platform_app", scoped_ptr<base::Value>(new base::FundamentalValue( |
511 extensions::Manifest::TYPE_PLATFORM_APP)))); | 511 extensions::Manifest::TYPE_PLATFORM_APP)))); |
512 } | 512 } |
| 513 |
| 514 void GetDeprecatedFeaturesMap( |
| 515 ScopedVector<StringMappingListPolicyHandler::MappingEntry>* result) { |
| 516 // Maps feature tags as specified in policy to the corresponding switch to |
| 517 // re-enable them. |
| 518 // TODO: Remove after 2015-04-30 per http://crbug.com/374782. |
| 519 result->push_back(new StringMappingListPolicyHandler::MappingEntry( |
| 520 "ShowModalDialog_EffectiveUntil20150430", |
| 521 scoped_ptr<base::Value>(new base::StringValue( |
| 522 switches::kEnableShowModalDialog)))); |
| 523 } |
513 #endif // !defined(OS_IOS) | 524 #endif // !defined(OS_IOS) |
514 | 525 |
515 } // namespace | 526 } // namespace |
516 | 527 |
517 void PopulatePolicyHandlerParameters(PolicyHandlerParameters* parameters) { | 528 void PopulatePolicyHandlerParameters(PolicyHandlerParameters* parameters) { |
518 #if defined(OS_CHROMEOS) | 529 #if defined(OS_CHROMEOS) |
519 if (chromeos::UserManager::IsInitialized()) { | 530 if (chromeos::UserManager::IsInitialized()) { |
520 const chromeos::User* user = chromeos::UserManager::Get()->GetActiveUser(); | 531 const chromeos::User* user = chromeos::UserManager::Get()->GetActiveUser(); |
521 if (user) | 532 if (user) |
522 parameters->user_id_hash = user->username_hash(); | 533 parameters->user_id_hash = user->username_hash(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 new extensions::ExtensionInstallForcelistPolicyHandler())); | 585 new extensions::ExtensionInstallForcelistPolicyHandler())); |
575 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( | 586 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( |
576 new extensions::ExtensionURLPatternListPolicyHandler( | 587 new extensions::ExtensionURLPatternListPolicyHandler( |
577 key::kExtensionInstallSources, | 588 key::kExtensionInstallSources, |
578 extensions::pref_names::kAllowedInstallSites))); | 589 extensions::pref_names::kAllowedInstallSites))); |
579 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( | 590 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( |
580 new StringMappingListPolicyHandler( | 591 new StringMappingListPolicyHandler( |
581 key::kExtensionAllowedTypes, | 592 key::kExtensionAllowedTypes, |
582 extensions::pref_names::kAllowedTypes, | 593 extensions::pref_names::kAllowedTypes, |
583 base::Bind(GetExtensionAllowedTypesMap)))); | 594 base::Bind(GetExtensionAllowedTypesMap)))); |
| 595 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( |
| 596 new StringMappingListPolicyHandler( |
| 597 key::kEnableDeprecatedWebPlatformFeatures, |
| 598 prefs::kEnableDeprecatedWebPlatformFeatures, |
| 599 base::Bind(GetDeprecatedFeaturesMap)))); |
584 #endif // !defined(OS_IOS) | 600 #endif // !defined(OS_IOS) |
585 | 601 |
586 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) | 602 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) |
587 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( | 603 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( |
588 new DiskCacheDirPolicyHandler())); | 604 new DiskCacheDirPolicyHandler())); |
589 | 605 |
590 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( | 606 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( |
591 new extensions::NativeMessagingHostListPolicyHandler( | 607 new extensions::NativeMessagingHostListPolicyHandler( |
592 key::kNativeMessagingWhitelist, | 608 key::kNativeMessagingWhitelist, |
593 extensions::pref_names::kNativeMessagingWhitelist, | 609 extensions::pref_names::kNativeMessagingWhitelist, |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( | 774 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( |
759 new ExternalDataPolicyHandler(key::kUserAvatarImage))); | 775 new ExternalDataPolicyHandler(key::kUserAvatarImage))); |
760 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( | 776 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( |
761 new ExternalDataPolicyHandler(key::kWallpaperImage))); | 777 new ExternalDataPolicyHandler(key::kWallpaperImage))); |
762 #endif // defined(OS_CHROMEOS) | 778 #endif // defined(OS_CHROMEOS) |
763 | 779 |
764 return handlers.Pass(); | 780 return handlers.Pass(); |
765 } | 781 } |
766 | 782 |
767 } // namespace policy | 783 } // namespace policy |
OLD | NEW |