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

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

Issue 2581643002: Define a new policy to disable clearing the browsing history from the UI. (Closed)
Patch Set: less headers Created 4 years 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
« no previous file with comments | « no previous file | chrome/browser/resources/options/clear_browser_data_overlay.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/policy/managed_bookmarks_policy_handler.h" 21 #include "chrome/browser/policy/managed_bookmarks_policy_handler.h"
22 #include "chrome/browser/policy/network_prediction_policy_handler.h" 22 #include "chrome/browser/policy/network_prediction_policy_handler.h"
23 #include "chrome/browser/profiles/guest_mode_policy_handler.h" 23 #include "chrome/browser/profiles/guest_mode_policy_handler.h"
24 #include "chrome/browser/profiles/incognito_mode_policy_handler.h" 24 #include "chrome/browser/profiles/incognito_mode_policy_handler.h"
25 #include "chrome/browser/sessions/restore_on_startup_policy_handler.h" 25 #include "chrome/browser/sessions/restore_on_startup_policy_handler.h"
26 #include "chrome/browser/supervised_user/supervised_user_creation_policy_handler .h" 26 #include "chrome/browser/supervised_user/supervised_user_creation_policy_handler .h"
27 #include "chrome/common/chrome_switches.h" 27 #include "chrome/common/chrome_switches.h"
28 #include "chrome/common/features.h" 28 #include "chrome/common/features.h"
29 #include "chrome/common/pref_names.h" 29 #include "chrome/common/pref_names.h"
30 #include "components/bookmarks/common/bookmark_pref_names.h" 30 #include "components/bookmarks/common/bookmark_pref_names.h"
31 #include "components/browsing_data/core/pref_names.h"
31 #include "components/certificate_transparency/pref_names.h" 32 #include "components/certificate_transparency/pref_names.h"
32 #include "components/content_settings/core/common/pref_names.h" 33 #include "components/content_settings/core/common/pref_names.h"
33 #include "components/metrics/metrics_pref_names.h" 34 #include "components/metrics/metrics_pref_names.h"
34 #include "components/ntp_snippets/pref_names.h" 35 #include "components/ntp_snippets/pref_names.h"
35 #include "components/password_manager/core/common/password_manager_pref_names.h" 36 #include "components/password_manager/core/common/password_manager_pref_names.h"
36 #include "components/policy/core/browser/autofill_policy_handler.h" 37 #include "components/policy/core/browser/autofill_policy_handler.h"
37 #include "components/policy/core/browser/configuration_policy_handler.h" 38 #include "components/policy/core/browser/configuration_policy_handler.h"
38 #include "components/policy/core/browser/configuration_policy_handler_list.h" 39 #include "components/policy/core/browser/configuration_policy_handler_list.h"
39 #include "components/policy/core/browser/configuration_policy_handler_parameters .h" 40 #include "components/policy/core/browser/configuration_policy_handler_parameters .h"
40 #include "components/policy/core/browser/proxy_policy_handler.h" 41 #include "components/policy/core/browser/proxy_policy_handler.h"
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 base::MakeUnique<base::FundamentalValue>( 690 base::MakeUnique<base::FundamentalValue>(
690 enabled ? safe_search_util::YOUTUBE_RESTRICT_MODERATE 691 enabled ? safe_search_util::YOUTUBE_RESTRICT_MODERATE
691 : safe_search_util::YOUTUBE_RESTRICT_OFF)); 692 : safe_search_util::YOUTUBE_RESTRICT_OFF));
692 } 693 }
693 } 694 }
694 695
695 private: 696 private:
696 DISALLOW_COPY_AND_ASSIGN(ForceYouTubeSafetyModePolicyHandler); 697 DISALLOW_COPY_AND_ASSIGN(ForceYouTubeSafetyModePolicyHandler);
697 }; 698 };
698 699
700 class BrowsingHistoryPolicyHandler : public TypeCheckingPolicyHandler {
701 public:
702 BrowsingHistoryPolicyHandler()
703 : TypeCheckingPolicyHandler(key::kAllowDeletingBrowserHistory,
704 base::Value::Type::BOOLEAN) {}
705 ~BrowsingHistoryPolicyHandler() override {}
706
707 void ApplyPolicySettings(const PolicyMap& policies,
708 PrefValueMap* prefs) override {
709 const base::Value* value = policies.GetValue(policy_name());
710 bool deleting_history_allowed;
711 if (value && value->GetAsBoolean(&deleting_history_allowed) &&
712 !deleting_history_allowed) {
713 prefs->SetBoolean(
714 browsing_data::prefs::kDeleteBrowsingHistory, false);
715 prefs->SetBoolean(
716 browsing_data::prefs::kDeleteDownloadHistory, false);
717 }
718 }
719 };
720
699 #if BUILDFLAG(ENABLE_EXTENSIONS) 721 #if BUILDFLAG(ENABLE_EXTENSIONS)
700 void GetExtensionAllowedTypesMap( 722 void GetExtensionAllowedTypesMap(
701 std::vector<std::unique_ptr<StringMappingListPolicyHandler::MappingEntry>>* 723 std::vector<std::unique_ptr<StringMappingListPolicyHandler::MappingEntry>>*
702 result) { 724 result) {
703 // Mapping from extension type names to Manifest::Type. 725 // Mapping from extension type names to Manifest::Type.
704 for (size_t index = 0; 726 for (size_t index = 0;
705 index < extensions::schema_constants::kAllowedTypesMapSize; 727 index < extensions::schema_constants::kAllowedTypesMapSize;
706 ++index) { 728 ++index) {
707 const extensions::schema_constants::AllowedTypesMapEntry& entry = 729 const extensions::schema_constants::AllowedTypesMapEntry& entry =
708 extensions::schema_constants::kAllowedTypesMap[index]; 730 extensions::schema_constants::kAllowedTypesMap[index];
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 handlers->AddHandler(base::MakeUnique<JavascriptPolicyHandler>()); 819 handlers->AddHandler(base::MakeUnique<JavascriptPolicyHandler>());
798 handlers->AddHandler(base::MakeUnique<NetworkPredictionPolicyHandler>()); 820 handlers->AddHandler(base::MakeUnique<NetworkPredictionPolicyHandler>());
799 handlers->AddHandler(base::MakeUnique<RestoreOnStartupPolicyHandler>()); 821 handlers->AddHandler(base::MakeUnique<RestoreOnStartupPolicyHandler>());
800 handlers->AddHandler(base::MakeUnique<syncer::SyncPolicyHandler>()); 822 handlers->AddHandler(base::MakeUnique<syncer::SyncPolicyHandler>());
801 823
802 handlers->AddHandler(base::MakeUnique<StringMappingListPolicyHandler>( 824 handlers->AddHandler(base::MakeUnique<StringMappingListPolicyHandler>(
803 key::kEnableDeprecatedWebPlatformFeatures, 825 key::kEnableDeprecatedWebPlatformFeatures,
804 prefs::kEnableDeprecatedWebPlatformFeatures, 826 prefs::kEnableDeprecatedWebPlatformFeatures,
805 base::Bind(GetDeprecatedFeaturesMap))); 827 base::Bind(GetDeprecatedFeaturesMap)));
806 828
829 handlers->AddHandler(base::MakeUnique<BrowsingHistoryPolicyHandler>());
830
807 #if BUILDFLAG(ENABLE_EXTENSIONS) 831 #if BUILDFLAG(ENABLE_EXTENSIONS)
808 handlers->AddHandler(base::MakeUnique<extensions::ExtensionListPolicyHandler>( 832 handlers->AddHandler(base::MakeUnique<extensions::ExtensionListPolicyHandler>(
809 key::kExtensionInstallWhitelist, 833 key::kExtensionInstallWhitelist,
810 extensions::pref_names::kInstallAllowList, false)); 834 extensions::pref_names::kInstallAllowList, false));
811 handlers->AddHandler(base::MakeUnique<extensions::ExtensionListPolicyHandler>( 835 handlers->AddHandler(base::MakeUnique<extensions::ExtensionListPolicyHandler>(
812 key::kExtensionInstallBlacklist, extensions::pref_names::kInstallDenyList, 836 key::kExtensionInstallBlacklist, extensions::pref_names::kInstallDenyList,
813 true)); 837 true));
814 handlers->AddHandler( 838 handlers->AddHandler(
815 base::MakeUnique<extensions::ExtensionInstallForcelistPolicyHandler>()); 839 base::MakeUnique<extensions::ExtensionInstallForcelistPolicyHandler>());
816 handlers->AddHandler( 840 handlers->AddHandler(
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 #endif // defined(OS_CHROMEOS) 984 #endif // defined(OS_CHROMEOS)
961 985
962 #if BUILDFLAG(ENABLE_PLUGINS) 986 #if BUILDFLAG(ENABLE_PLUGINS)
963 handlers->AddHandler(base::MakeUnique<PluginPolicyHandler>()); 987 handlers->AddHandler(base::MakeUnique<PluginPolicyHandler>());
964 #endif // BUILDFLAG(ENABLE_PLUGINS) 988 #endif // BUILDFLAG(ENABLE_PLUGINS)
965 989
966 return handlers; 990 return handlers;
967 } 991 }
968 992
969 } // namespace policy 993 } // namespace policy
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/options/clear_browser_data_overlay.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698