Google环聊扩展程序如何创建面板窗口? [英] How does the Google Hangouts extension create the panel window?

查看:354
本文介绍了Google环聊扩展程序如何创建面板窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文档说明如果您想创建面板窗口,您应该使用

  chrome.windows.create({...,类型:面板},函数回调)

同时,它说:指定要创建的浏览器窗口类型。'面板'类型创建弹出,除非设置了'--enable-panels'标志。



所以你应该去chrome:// flags手动改变它。但 Google环聊无需这样做即可创建面板。它是怎么做到的?

谷歌环聊扩展程序(以前称为Google for Chat)明确地为在源代码中列入白名单,即使在 - enable-panels 标志未设置的情况下,它也允许其使用面板功能:

  bool PanelManager :: ShouldUsePanels(const std :: string& extension_id){
...
return CommandLine :: ForCurrentProcess() - > HasSwitch(
switches :: kEnablePanels)||
extension_id == std :: string(nckgahadagoaajjgafhacjanaoiihapd)||
...


The Doc says if you want to create a panel window ,you should use

chrome.windows.create({...,type:"panel"}, function callback)

At the same time, it says "Specifies what type of browser window to create. The 'panel' type creates a popup unless the '--enable-panels' flag is set."

So you should go to "chrome://flags" to change it manually. But Google Hangouts can create the panel without doing that. How does it do that?

解决方案

The Google Hangouts extension (formerly called "Chat for Google") is explicitly whitelisted in the source code, which allows it to use the panel feature even when --enable-panels flag is unset:

bool PanelManager::ShouldUsePanels(const std::string& extension_id) {
 ...
    return CommandLine::ForCurrentProcess()->HasSwitch(
        switches::kEnablePanels) ||
        extension_id == std::string("nckgahadagoaajjgafhacjanaoiihapd") ||
 ...

这篇关于Google环聊扩展程序如何创建面板窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆