Chromium APP&Extension 下载安装流程
2016-10-18 13:39
225 查看
打开chromium浏览器的应用商店,点击想安装的应用图标后的页面如下图
1.BeginInstall
点击“添加至chrome”按钮触发事件BeginInstall,开始从webstore获取id,icon_url,manifest等data。这一步应该是在对应的js脚本中完成,然后借助V8引擎的js与C++交互,发送name为webstorePrivate.beginInstallWithManifest3的请求。
2.WebstorePrivateBeginInstallWithManifest3Function::Run
完成WebstorePrivateBeginInstallWithManifest3Function类的初始化后,运行WebstorePrivateBeginInstallWithManifest3Function::Run(),检查id的合法性、icon_url的合法性、是否已经安装过之后,调用WebstoreInstallHelper::Start()
3.WebstoreInstallHelper::Start
这一步的工作是解析manifest.json,成功后调用WebstoreInstallHelper::OnJSONParseSucceeded();获取icon,成功后调用WebstoreInstallHelper::OnFetchComplete()
4.WebstorePrivateBeginInstallWithManifest3Function::OnWebstoreParseSuccess
以上步骤均成功无报错后运行至WebstoreInstallHelper::ReportResultsIfComplete,调用WebstorePrivateBeginInstallWithManifest3Function::OnWebstoreParseSuccess通知data处理完成,在OnWebstoreParseSuccess中检验该应用是否符合管理政策(比如没有被用户加入黑名单之类),浏览器窗口是否被关闭,然后显示是否确定安装的弹框UI,如下图:
5.WebstorePrivateCompleteInstallFunction::Run
点击”添加应用“,触发事件,发送name为webstorePrivate.completeInstall的request,接到请求后完成WebstorePrivateCompleteInstallFunction的初始化,运行至WebstorePrivateCompleteInstallFunction::Run()函数,检查登陆合法性,检查id合法性,检查安装前置步骤解析manifest的完整性,调用WebstoreInstaller::Start()
6.WebstoreInstaller::Start
在这一步,首先检查id的合法性,检验需安装的应用的imports,加上应用的主模块一起加入pending_modules_中,通过V8完成c++与js的交互,改变页面上原来”添加至chrome“图标的显示,调用DownloadNextPendingModule(),判断pending_modules_的个数传不同参数给DownloadCrx()
7.WebstoreInstaller::DownloadCrx
首先根据传入的extension_id调用GetWebstoreInstallURL获取下载链接,创建下载目录后,调用StartDownload()开始下载,经过OnDownloadStarted->OnExtensionDownloadStarted->OnDownloadUpdated->OnExtensionDownloadProgress->UpdateDownloadProgress->OnDownloadUpdated->OnExtensionDownloadProgress->UpdateDownloadProgress->......->OnDownloadUpdated直至状态变为COMPLETE,调用StartCrxInstaller()
8.WebstoreInstaller::StartCrxInstaller
得到上一步的下载文件后,获取安装配置,调用CreateCrxInstaller()新建crx_installer,运行至InstallCrx函数
9.CrxInstaller::InstallCrx
通过NotifyCrxInstallBegin()告知js完成页面交互,借助SandboxedUnpacker类完成解压缩,运行至
OnUnpackSuccess()函数,在该函数中调用AllowInstall()进行许可性检查,之后运行至CheckInstall(),检查完成后调用OnInstallChecksComplete()校验检查结果,确认无误后调用ConfirmInstall()函数->调用UpdateCreationFlagsAndCompleteInstall()函数->调用CompleteInstall()函数,借助ExtensionAssetsManager类完成安装过程
10.CrxInstaller::ReloadExtensionAfterInstall
安装完成后执行回调:CrxInstaller::ReloadExtensionAfterInstall,加载刚刚安装的应用,执行ReportSuccessFromFileThread(),调用CleanupTempFiles(),执行OnExtensionInstalled()、NotifyCrxInstallComplete()进行收尾工作
1.BeginInstall
点击“添加至chrome”按钮触发事件BeginInstall,开始从webstore获取id,icon_url,manifest等data。这一步应该是在对应的js脚本中完成,然后借助V8引擎的js与C++交互,发送name为webstorePrivate.beginInstallWithManifest3的请求。
2.WebstorePrivateBeginInstallWithManifest3Function::Run
完成WebstorePrivateBeginInstallWithManifest3Function类的初始化后,运行WebstorePrivateBeginInstallWithManifest3Function::Run(),检查id的合法性、icon_url的合法性、是否已经安装过之后,调用WebstoreInstallHelper::Start()
3.WebstoreInstallHelper::Start
这一步的工作是解析manifest.json,成功后调用WebstoreInstallHelper::OnJSONParseSucceeded();获取icon,成功后调用WebstoreInstallHelper::OnFetchComplete()
4.WebstorePrivateBeginInstallWithManifest3Function::OnWebstoreParseSuccess
以上步骤均成功无报错后运行至WebstoreInstallHelper::ReportResultsIfComplete,调用WebstorePrivateBeginInstallWithManifest3Function::OnWebstoreParseSuccess通知data处理完成,在OnWebstoreParseSuccess中检验该应用是否符合管理政策(比如没有被用户加入黑名单之类),浏览器窗口是否被关闭,然后显示是否确定安装的弹框UI,如下图:
5.WebstorePrivateCompleteInstallFunction::Run
点击”添加应用“,触发事件,发送name为webstorePrivate.completeInstall的request,接到请求后完成WebstorePrivateCompleteInstallFunction的初始化,运行至WebstorePrivateCompleteInstallFunction::Run()函数,检查登陆合法性,检查id合法性,检查安装前置步骤解析manifest的完整性,调用WebstoreInstaller::Start()
6.WebstoreInstaller::Start
在这一步,首先检查id的合法性,检验需安装的应用的imports,加上应用的主模块一起加入pending_modules_中,通过V8完成c++与js的交互,改变页面上原来”添加至chrome“图标的显示,调用DownloadNextPendingModule(),判断pending_modules_的个数传不同参数给DownloadCrx()
7.WebstoreInstaller::DownloadCrx
首先根据传入的extension_id调用GetWebstoreInstallURL获取下载链接,创建下载目录后,调用StartDownload()开始下载,经过OnDownloadStarted->OnExtensionDownloadStarted->OnDownloadUpdated->OnExtensionDownloadProgress->UpdateDownloadProgress->OnDownloadUpdated->OnExtensionDownloadProgress->UpdateDownloadProgress->......->OnDownloadUpdated直至状态变为COMPLETE,调用StartCrxInstaller()
8.WebstoreInstaller::StartCrxInstaller
得到上一步的下载文件后,获取安装配置,调用CreateCrxInstaller()新建crx_installer,运行至InstallCrx函数
9.CrxInstaller::InstallCrx
通过NotifyCrxInstallBegin()告知js完成页面交互,借助SandboxedUnpacker类完成解压缩,运行至
OnUnpackSuccess()函数,在该函数中调用AllowInstall()进行许可性检查,之后运行至CheckInstall(),检查完成后调用OnInstallChecksComplete()校验检查结果,确认无误后调用ConfirmInstall()函数->调用UpdateCreationFlagsAndCompleteInstall()函数->调用CompleteInstall()函数,借助ExtensionAssetsManager类完成安装过程
10.CrxInstaller::ReloadExtensionAfterInstall
安装完成后执行回调:CrxInstaller::ReloadExtensionAfterInstall,加载刚刚安装的应用,执行ReportSuccessFromFileThread(),调用CleanupTempFiles(),执行OnExtensionInstalled()、NotifyCrxInstallComplete()进行收尾工作
相关文章推荐
- Android&iOS:如何在外部启动app(若有安裝APP, 则自动启动app(使用 URL Schema), 若没有安装, 则询问是不是到应用市场下载)
- iOS应用发布流程(一)------相关app证书的申请、下载以及安装
- PHP开发环境&MySQL下载安装及配置流程
- PHP开发环境&MySQL下载安装及配置流程
- Amazon App Tester工具的安装和配置&Amazon内购接入流程以及测试
- Python distribution打包&安装流程
- Python distribution打包&安装流程
- arm-linux-toolchain & u-boot 下载安装
- 安装Flash Media Server & 免费开发者版下载地址
- AjaxControlToolkit安装&下载
- Android I9100 源码编译 Step.6----下载&安装内核编译器
- iphone app下载并自动安装
- Windows Server 2008 安装详细流程 & 解说
- QTP_QTP 11.0 下载&安装&无限试用30天的暂时破解方法
- CE 6.0 开发工具 Platform Build 5.0 & Evc++4.0 sp4 安装资源下载 收藏
- 【APP】yum只下载软件不安装的两种方法
- VISUALSVN SERVER下载安装流程 及ca证书制作教程
- AjaxControlToolkit安装&下载
- SexyAppFramework分析笔记2(下载,安装和HelloWorld)
- magento安装 “PHP Extension "curl" must be loaded”