// Copyright 2020 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/policy/core/common/policy_loader_common.h" #include <string> #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "base/strings/string_util.h" #include "components/policy/core/common/policy_map.h" #include "components/policy/policy_constants.h" #include "components/strings/grit/components_strings.h" namespace policy { namespace { #if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS) // Duplicate the extension constants in order to avoid extension dependency. // However, those values below must be synced with files in extension folders. // In long term, we can refactor the code and create an interface for sensitive // policy filtering so that each policy component users can have their own // implementation. And the Chrome one can be moved to c/b/policy. // From extensions/common/extension_urls.cc const char kChromeWebstoreUpdateURL[] = …; const char16_t kChromeWebstoreUpdateURL16[] = …; // From chrome/browser/extensions/extension_management_constants.cc const char kWildcard[] = …; const char kInstallationMode[] = …; const char kForceInstalled[] = …; const char kNormalInstalled[] = …; const char kUpdateUrl[] = …; // String to be prepended to each blocked entry. const char kBlockedExtensionPrefix[] = …; #endif // List of policies that are considered only if the user is part of a AD domain // on Windows or managed on the Mac. Please document any new additions in the // policy definition file. // Please keep the list in alphabetical order! const char* kSensitivePolicies[] = …; void RecordInvalidPolicies(const std::string& policy_name) { … } #if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS) // Marks the sensitive ExtensionInstallForceList policy entries, returns true if // there is any sensitive entries in the policy. bool FilterSensitiveExtensionsInstallForcelist(PolicyMap::Entry* map_entry) { … } // Marks the sensitive ExtensionSettings policy entries, returns the number of // sensitive entries in the policy. bool FilterSensitiveExtensionSettings(PolicyMap::Entry* map_entry) { … } #endif } // namespace void FilterSensitivePolicies(PolicyMap* policy) { … } bool IsPolicyNameSensitive(const std::string& policy_name) { … } } // namespace policy