#include "chrome/browser/supervised_user/supervised_user_extensions_delegate_impl.h"
#include <utility>
#include "base/functional/bind.h"
#include "base/task/single_thread_task_runner.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/supervised_user/extension_icon_loader.h"
#include "chrome/browser/supervised_user/supervised_user_browser_utils.h"
#include "chrome/browser/supervised_user/supervised_user_extensions_manager.h"
#include "chrome/browser/supervised_user/supervised_user_extensions_metrics_recorder.h"
#include "chrome/browser/supervised_user/supervised_user_service_factory.h"
#include "chrome/browser/ui/extensions/extensions_dialogs.h"
#include "chrome/browser/ui/supervised_user/parent_permission_dialog.h"
#include "components/supervised_user/core/common/features.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_dialog_auto_confirm.h"
#include "ui/gfx/image/image_skia.h"
namespace {
void OnParentPermissionDialogComplete(
extensions::SupervisedUserExtensionsDelegate::ExtensionApprovalDoneCallback
delegate_done_callback,
ParentPermissionDialog::Result result) { … }
}
namespace extensions {
SupervisedUserExtensionsDelegateImpl::SupervisedUserExtensionsDelegateImpl(
content::BrowserContext* browser_context)
: … { … }
SupervisedUserExtensionsDelegateImpl::~SupervisedUserExtensionsDelegateImpl() =
default;
void SupervisedUserExtensionsDelegateImpl::
UpdateManagementPolicyRegistration() { … }
bool SupervisedUserExtensionsDelegateImpl::IsChild() const { … }
bool SupervisedUserExtensionsDelegateImpl::IsExtensionAllowedByParent(
const Extension& extension) const { … }
void SupervisedUserExtensionsDelegateImpl::RequestToAddExtensionOrShowError(
const Extension& extension,
content::WebContents* web_contents,
const gfx::ImageSkia& icon,
SupervisedUserExtensionParentApprovalEntryPoint
extension_approval_entry_point,
ExtensionApprovalDoneCallback extension_approval_callback) { … }
void SupervisedUserExtensionsDelegateImpl::RequestToEnableExtensionOrShowError(
const Extension& extension,
content::WebContents* web_contents,
SupervisedUserExtensionParentApprovalEntryPoint
extension_approval_entry_point,
ExtensionApprovalDoneCallback extension_approval_callback) { … }
bool SupervisedUserExtensionsDelegateImpl::CanInstallExtensions() const { … }
void SupervisedUserExtensionsDelegateImpl::AddExtensionApproval(
const extensions::Extension& extension) { … }
void SupervisedUserExtensionsDelegateImpl::MaybeRecordPermissionsIncreaseMetrics(
const extensions::Extension& extension) { … }
void SupervisedUserExtensionsDelegateImpl::RemoveExtensionApproval(
const extensions::Extension& extension) { … }
void SupervisedUserExtensionsDelegateImpl::RecordExtensionEnablementUmaMetrics(
bool enabled) const { … }
void SupervisedUserExtensionsDelegateImpl::
ShowParentPermissionDialogForExtension(
const Extension& extension,
content::WebContents* contents,
const gfx::ImageSkia& icon,
SupervisedUserExtensionParentApprovalEntryPoint
extension_approval_entry_point) { … }
void SupervisedUserExtensionsDelegateImpl::
ShowInstallBlockedByParentDialogForExtension(
const Extension& extension,
content::WebContents* contents,
ExtensionInstalledBlockedByParentDialogAction blocked_action) { … }
void SupervisedUserExtensionsDelegateImpl::RequestExtensionApproval(
const Extension& extension,
std::optional<base::WeakPtr<content::WebContents>> contents,
SupervisedUserExtensionParentApprovalEntryPoint
extension_approval_entry_point,
const gfx::ImageSkia& icon) { … }
}