#include "chrome/browser/supervised_user/supervised_user_extensions_manager.h"
#include <string>
#include "base/containers/contains.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_key.h"
#include "chrome/browser/supervised_user/supervised_user_browser_utils.h"
#include "chrome/browser/supervised_user/supervised_user_extensions_metrics_recorder.h"
#include "chrome/browser/supervised_user/supervised_user_service_factory.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
#include "components/supervised_user/core/browser/supervised_user_preferences.h"
#include "components/supervised_user/core/browser/supervised_user_service.h"
#include "components/supervised_user/core/common/features.h"
#include "components/supervised_user/core/common/pref_names.h"
#include "components/supervised_user/core/common/supervised_user_constants.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/pref_names.h"
#include "ui/base/l10n/l10n_util.h"
namespace extensions {
namespace {
constexpr char const* kAllowlistExtensionIds[] = …;
base::Value::Dict GetExtensionsMissingApproval(const PrefService& user_prefs) { … }
}
SupervisedUserExtensionsManager::SupervisedUserExtensionsManager(
content::BrowserContext* context)
: … { … }
SupervisedUserExtensionsManager::~SupervisedUserExtensionsManager() { … }
void SupervisedUserExtensionsManager::UpdateManagementPolicyRegistration() { … }
void SupervisedUserExtensionsManager::AddExtensionApproval(
const extensions::Extension& extension) { … }
void SupervisedUserExtensionsManager::MaybeRecordPermissionsIncreaseMetrics(
const extensions::Extension& extension) { … }
void SupervisedUserExtensionsManager::RemoveExtensionApproval(
const extensions::Extension& extension) { … }
bool SupervisedUserExtensionsManager::IsExtensionAllowed(
const extensions::Extension& extension) const { … }
bool SupervisedUserExtensionsManager::CanInstallExtensions() const { … }
void SupervisedUserExtensionsManager::RecordExtensionEnablementUmaMetrics(
bool enabled) const { … }
std::string SupervisedUserExtensionsManager::GetDebugPolicyProviderName()
const { … }
bool SupervisedUserExtensionsManager::UserMayLoad(
const extensions::Extension* extension,
std::u16string* error) const { … }
bool SupervisedUserExtensionsManager::MustRemainDisabled(
const extensions::Extension* extension,
extensions::disable_reason::DisableReason* reason,
std::u16string* error) const { … }
void SupervisedUserExtensionsManager::OnExtensionInstalled(
content::BrowserContext* browser_context,
const extensions::Extension* extension,
bool is_update) { … }
void SupervisedUserExtensionsManager::OnExtensionUninstalled(
content::BrowserContext* browser_context,
const extensions::Extension* extension,
extensions::UninstallReason reason) { … }
SupervisedUserExtensionsManager::ExtensionState
SupervisedUserExtensionsManager::GetExtensionState(
const extensions::Extension& extension) const { … }
void SupervisedUserExtensionsManager::RefreshApprovedExtensionsFromPrefs() { … }
void SupervisedUserExtensionsManager::SetActiveForSupervisedUsers() { … }
void SupervisedUserExtensionsManager::
ActivateManagementPolicyAndUpdateRegistration() { … }
void SupervisedUserExtensionsManager::UpdateApprovedExtension(
const std::string& extension_id,
const std::string& version,
ApprovedExtensionChange type) { … }
std::u16string SupervisedUserExtensionsManager::GetExtensionsLockedMessage()
const { … }
void SupervisedUserExtensionsManager::ChangeExtensionStateIfNecessary(
const std::string& extension_id) { … }
bool SupervisedUserExtensionsManager::ShouldBlockExtension(
const std::string& extension_id) const { … }
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
void SupervisedUserExtensionsManager::
MaybeMarkExtensionsLocallyParentApproved() { … }
void SupervisedUserExtensionsManager::DoExtensionsMigrationToParentApproved() { … }
#endif
bool SupervisedUserExtensionsManager::IsLocallyParentApprovedExtension(
const std::string& extension_id) const { … }
void SupervisedUserExtensionsManager::RemoveLocalParentalApproval(
const std::set<std::string> extension_ids) { … }
void SupervisedUserExtensionsManager::
OnSkipParentApprovalToInstallExtensionsChanged() { … }
}