当前位置: 首页 > news >正文

Chromium 如何在c++里面控制扩展加载

扩展安装 主要是通过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;

}

http://www.lryc.cn/news/125235.html

相关文章:

  • 分类预测 | MATLAB实现MTBO-CNN多输入分类预测
  • 操作符和表达式求值
  • Unity Spine帧事件
  • AE使用(一)
  • YOLOv5、YOLOv8改进:MobileViT:轻量通用且适合移动端的视觉Transformer
  • 06-4_Qt 5.9 C++开发指南_MDI应用程序设计
  • 【SCI征稿】3区SCI,正刊,智能传感、机器学习、智能检测与测量等均可
  • 神经网络ANN(MLP),CNN以及RNN区别和应用
  • CUDA、cuDNN以及Pytorch介绍
  • 使用shift关键字,写一个带二级命令的脚本(如:docker run -a -b -c中的run)
  • MySQL学习笔记 - 进阶部分
  • 微信小程序实现左滑删除
  • 安防视频监控有哪些存储方式?哪种存储方式最优?
  • 02-C++数据类型-高级
  • Kotlin实战之获取本地配置文件、远程Apollo配置失败问题排查
  • TCP协议的报头格式和滑动窗口
  • java 使用log4j显示到界面和文件 并格式化
  • 【js】链接中有多余的怎么取出参数值
  • Verdi_traceX and autotrace
  • 安卓逆向 - 某严选app sign算法还原
  • arcgis数据采集与拓扑检查
  • 【前端 | CSS】滚动到底部加载,滚动监听、懒加载
  • word将mathtype公式批量转为latex公式
  • docker-compose部署nacos 2.2.3
  • 软件测试52讲-学习笔记
  • 【ARM 嵌入式 编译系列 4 -- GCC 编译属性 __read_mostly 详细介绍】
  • Maven在IDEA2021版本中全局配置(一次配置处处生效)
  • 名侦探番外——Arduino“炸弹”引爆摩天大楼
  • 自适应AI chatgpt智能聊天创作官网html源码
  • 防抖,节流