扩展安装 主要是通过UserMayLoad 函数控制,true允许加载,否则禁用
引自chromiun参考。【一般可以根据扩展ID禁用】
chrome\browser\extensions\standard_management_policy_provider.cc
bool StandardManagementPolicyProvider::UserMayLoad(
const Extension* extension,
std::u16string* error) const {
if (Manifest::IsComponentLocation(extension->location())) {
return true;
}
// Shared modules are always allowed too: they only contain resources that
// are used by other extensions. The extension that depends on the shared
// module may be filtered by policy.
if (extension->is_shared_module())
return true;
// Check whether the extension type is allowed.
//
// If you get a compile error here saying that the type you added is not
// handled by the switch statement below, please consider whether enterprise
// policy should be able to disallow extensions of the new type. If so, add
// a branch to the second block and add a line to the definition of
// kAllowedTypesMap in extension_management_constants.h.
switch (extension->GetType()) {
case Manifest::TYPE_UNKNOWN:
break;
case Manifest::TYPE_EXTENSION:
case Manifest::TYPE_THEME:
case Manifest::TYPE_USER_SCRIPT:
case Manifest::TYPE_HOSTED_APP:
case Manifest::TYPE_LEGACY_PACKAGED_APP:
case Manifest::TYPE_PLATFORM_APP:
case Manifest::TYPE_SHARED_MODULE:
case Manifest::TYPE_LOGIN_SCREEN_EXTENSION:
case Manifest::TYPE_CHROMEOS_SYSTEM_EXTENSION: {
if (!settings_->IsAllowedManifestType(extension->GetType(),
extension->id()))
return ReturnLoadError(extension, error);
break;
}
case Manifest::NUM_LOAD_TYPES:
NOTREACHED();
}
ExtensionManagement::InstallationMode installation_mode =
settings_->GetInstallationMode(extension);
if (installation_mode == ExtensionManagement::INSTALLATION_BLOCKED ||
installation_mode == ExtensionManagement::INSTALLATION_REMOVED) {
return ReturnLoadError(extension, error);
}
return true;
}