Derek 朕會功夫
Derek 朕會功夫

Reputation: 94319

Chromeless window in Chrome extension?

So recently I've come across a Webapp on Chrome Web Store called Type Fu. What amazed me is they actually created a true chromeless window.

enter image description here

I'm thinking if I can do it in a Chrome extension because in most parts they use the same APIs. However, I can't find anything that will let me to do this effect.

chrome.tabs.create is not useful at all.

It would be madness if I can't do that in an extension because in my opinion, an extension should have more "power" than a webapp (a webpage basically).

I couldn't press Ctrl + Shift + I or even right-click on it. It's just like a real native program on my computer.

Some buttons will open another floating chromeless window.

enter image description here

Upvotes: 2

Views: 3006

Answers (1)

apsillers
apsillers

Reputation: 115940

...in most parts they use the same APIs

Chrome extensions are designed to interact with the browser. Chrome packaged apps are designed to be standalone and operate independently from the browser. Their APIs have now widely diverged. Just take a look at the API listings for apps and the equivalent listing for extensions, and you'll see that they are quite different.

In this case, the Type Fu uses the chrome.app.window API, particularly the frame: 'none' option of the create function.

As the name of app.window suggests, it's only available to packages apps, not extensions. The extension-based chrome.windows.create method will eventually support a type: 'panel' option that will supply visually similar functionality (see it at work in Google's Hangouts extension). It's described in the API with a note:

The 'panel' and 'detached_panel' types create a popup unless the '--enable-panels' flag is set.

Currently only Hangouts is whitelisted to use panels, but the discussion at Having panel behavior in chrome extension suggests that your extension can pretend to be Hangouts by adding a specific key value to your manifest:

"key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDsDApubb73tPfYlNIFxDu3K3/EHgV6/YOJXJkld1OZ20jW/cOht1j0NggnXhQYuu1mXFUufud4I2N7b5ydyg09gcM9Va3Zk17RhNV9smbPHOd4XlzJeXifX/9MgHPu4FzCen3CiSXsOeAELJIXEuT28xICriuUko/rNPwGeIB9VwIDAQAB"

However, I wouldn't rely on this undocumented behavior; Google is likely to fix it, or it may break something else in the future.

Until panels are fully supported then, you can begin developing your extension with the --enable-panel browser flag and hope the feature is enabled by default once you have completed development.

Upvotes: 6

Related Questions