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

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

Issue 344693004: Add a policy to re-enable deprecated web platform features. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review feedback. Created 6 years, 6 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/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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 extensions::pref_names::kNativeMessagingUserLevelHosts, 482 extensions::pref_names::kNativeMessagingUserLevelHosts,
482 base::Value::TYPE_BOOLEAN }, 483 base::Value::TYPE_BOOLEAN },
483 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) 484 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
484 }; 485 };
485 486
486 #if !defined(OS_IOS) 487 #if !defined(OS_IOS)
487 void GetExtensionAllowedTypesMap( 488 void GetExtensionAllowedTypesMap(
488 ScopedVector<StringMappingListPolicyHandler::MappingEntry>* result) { 489 ScopedVector<StringMappingListPolicyHandler::MappingEntry>* result) {
489 // Mapping from extension type names to Manifest::Type. 490 // Mapping from extension type names to Manifest::Type.
490 result->push_back(new StringMappingListPolicyHandler::MappingEntry( 491 result->push_back(new StringMappingListPolicyHandler::MappingEntry(
491 "extension", scoped_ptr<base::Value>(base::Value::CreateIntegerValue( 492 "extension", scoped_ptr<base::Value>(new base::FundamentalValue(
492 extensions::Manifest::TYPE_EXTENSION)))); 493 extensions::Manifest::TYPE_EXTENSION))));
493 result->push_back(new StringMappingListPolicyHandler::MappingEntry( 494 result->push_back(new StringMappingListPolicyHandler::MappingEntry(
494 "theme", scoped_ptr<base::Value>(base::Value::CreateIntegerValue( 495 "theme", scoped_ptr<base::Value>(new base::FundamentalValue(
495 extensions::Manifest::TYPE_THEME)))); 496 extensions::Manifest::TYPE_THEME))));
496 result->push_back(new StringMappingListPolicyHandler::MappingEntry( 497 result->push_back(new StringMappingListPolicyHandler::MappingEntry(
497 "user_script", scoped_ptr<base::Value>(base::Value::CreateIntegerValue( 498 "user_script", scoped_ptr<base::Value>(new base::FundamentalValue(
498 extensions::Manifest::TYPE_USER_SCRIPT)))); 499 extensions::Manifest::TYPE_USER_SCRIPT))));
499 result->push_back(new StringMappingListPolicyHandler::MappingEntry( 500 result->push_back(new StringMappingListPolicyHandler::MappingEntry(
500 "hosted_app", scoped_ptr<base::Value>(base::Value::CreateIntegerValue( 501 "hosted_app", scoped_ptr<base::Value>(new base::FundamentalValue(
501 extensions::Manifest::TYPE_HOSTED_APP)))); 502 extensions::Manifest::TYPE_HOSTED_APP))));
502 result->push_back(new StringMappingListPolicyHandler::MappingEntry( 503 result->push_back(new StringMappingListPolicyHandler::MappingEntry(
503 "legacy_packaged_app", scoped_ptr<base::Value>( 504 "legacy_packaged_app", scoped_ptr<base::Value>(new base::FundamentalValue(
504 base::Value::CreateIntegerValue( 505 extensions::Manifest::TYPE_LEGACY_PACKAGED_APP))));
505 extensions::Manifest::TYPE_LEGACY_PACKAGED_APP))));
506 result->push_back(new StringMappingListPolicyHandler::MappingEntry( 506 result->push_back(new StringMappingListPolicyHandler::MappingEntry(
507 "platform_app", scoped_ptr<base::Value>(base::Value::CreateIntegerValue( 507 "platform_app", scoped_ptr<base::Value>(new base::FundamentalValue(
508 extensions::Manifest::TYPE_PLATFORM_APP)))); 508 extensions::Manifest::TYPE_PLATFORM_APP))));
509 } 509 }
510
511 void GetDeprecatedFeaturesMap(
512 ScopedVector<StringMappingListPolicyHandler::MappingEntry>* result) {
513 // Maps feature tags as specified in policy to the corresponding switch to
514 // re-enable them.
515 // TODO: Remove after 2015-04-30 per http://crbug.com/374782.
516 result->push_back(new StringMappingListPolicyHandler::MappingEntry(
517 "ShowModalDialog_EffectiveUntil20150430",
518 scoped_ptr<base::Value>(new base::StringValue(
519 switches::kEnableShowModalDialog))));
520 }
510 #endif // !defined(OS_IOS) 521 #endif // !defined(OS_IOS)
511 522
512 } // namespace 523 } // namespace
513 524
514 void PopulatePolicyHandlerParameters(PolicyHandlerParameters* parameters) { 525 void PopulatePolicyHandlerParameters(PolicyHandlerParameters* parameters) {
515 #if defined(OS_CHROMEOS) 526 #if defined(OS_CHROMEOS)
516 if (chromeos::UserManager::IsInitialized()) { 527 if (chromeos::UserManager::IsInitialized()) {
517 const chromeos::User* user = chromeos::UserManager::Get()->GetActiveUser(); 528 const chromeos::User* user = chromeos::UserManager::Get()->GetActiveUser();
518 if (user) 529 if (user)
519 parameters->user_id_hash = user->username_hash(); 530 parameters->user_id_hash = user->username_hash();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 new extensions::ExtensionInstallForcelistPolicyHandler())); 582 new extensions::ExtensionInstallForcelistPolicyHandler()));
572 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 583 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
573 new extensions::ExtensionURLPatternListPolicyHandler( 584 new extensions::ExtensionURLPatternListPolicyHandler(
574 key::kExtensionInstallSources, 585 key::kExtensionInstallSources,
575 extensions::pref_names::kAllowedInstallSites))); 586 extensions::pref_names::kAllowedInstallSites)));
576 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 587 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
577 new StringMappingListPolicyHandler( 588 new StringMappingListPolicyHandler(
578 key::kExtensionAllowedTypes, 589 key::kExtensionAllowedTypes,
579 extensions::pref_names::kAllowedTypes, 590 extensions::pref_names::kAllowedTypes,
580 base::Bind(GetExtensionAllowedTypesMap)))); 591 base::Bind(GetExtensionAllowedTypesMap))));
592 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
593 new StringMappingListPolicyHandler(
594 key::kEnableDeprecatedWebPlatformFeatures,
595 prefs::kEnableDeprecatedWebPlatformFeatures,
596 base::Bind(GetDeprecatedFeaturesMap))));
581 #endif // !defined(OS_IOS) 597 #endif // !defined(OS_IOS)
582 598
583 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) 599 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
584 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 600 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
585 new DiskCacheDirPolicyHandler())); 601 new DiskCacheDirPolicyHandler()));
586 602
587 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 603 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
588 new extensions::NativeMessagingHostListPolicyHandler( 604 new extensions::NativeMessagingHostListPolicyHandler(
589 key::kNativeMessagingWhitelist, 605 key::kNativeMessagingWhitelist,
590 extensions::pref_names::kNativeMessagingWhitelist, 606 extensions::pref_names::kNativeMessagingWhitelist,
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 771 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
756 new ExternalDataPolicyHandler(key::kUserAvatarImage))); 772 new ExternalDataPolicyHandler(key::kUserAvatarImage)));
757 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( 773 handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>(
758 new ExternalDataPolicyHandler(key::kWallpaperImage))); 774 new ExternalDataPolicyHandler(key::kWallpaperImage)));
759 #endif // defined(OS_CHROMEOS) 775 #endif // defined(OS_CHROMEOS)
760 776
761 return handlers.Pass(); 777 return handlers.Pass();
762 } 778 }
763 779
764 } // namespace policy 780 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698