Google Chrome Extension - Programmatically Open Popup - google-chrome

When you make a Google Chrome Extension you can choose to have a "Default_Popup", is there any way to programmatically open the popup?

There is no direct way to open the popup programmatically. However, if you're looking to open it based on a keyboard shortcut, you can use the commands API with the _execute_browser_action command (the API is currently available on the beta channel only).

There is an API, chrome.browserAction.openPopup(function callback), that will hopefully be available soon. Please star this bug: https://code.google.com/p/chromium/issues/detail?id=436489

Related

Adding a system tray icon to a Chrome App like the Google Hangouts app does? [duplicate]

I'm trying to create a Chrome package App with an icon in the system menu bar as explain here : https://docs.google.com/document/d/1QhhfR33Y28Yqnnoa_Sl3fnZK_mKtwt4dZe6kNyJ_MjU/edit ,
The Google Hangout App can implement this feature (it's not exactly the same behavior) but I don't find any good documentation to do the same.
In the manifest page of Google Packaged App, we can see the field "system_indicator". Is it what I'm looking for ? When I try to set this field to an url of an icon, Chrome return me this error :
'system_indicator' requires Google Chrome dev channel or newer, but this is the beta channel.
I've also found this old page from the chromium project : http://www.chromium.org/developers/design-documents/extensions/proposed-changes/apis-under-development/system-indicator-api
So my question is simple : can I build this feature for my app ? And if yes, how ?
Thank you for your help ! :-)
The system_indicator was an experimental API partly introduced in the dev channel, but was later removed, as the Chrome/Chromium team deemed it too costly to maintain across all platforms. The entire history of this API is available at issue 142450.
In other words, as for now, there is no API for a system tray icon.
The hangouts app uses a "panel" type window to achieve its behaviour, see Abraham's answer on How to build an chrome extension like Google Hangouts. Essentially, when you open a window, add type="panel" parameter:
chrome.windows.create({ url: 'https://mobile.twitter.com/', type: 'panel' });
Regarding the error you mentioned, this is because you are using the Beta Chrome build, and it has realised that the feature is not available in this version, and is advising you that you need a dev channel or trunk release. Find out more about Chrome release channels here: http://www.chromium.org/getting-involved/dev-channel

Has offscreen-tabs been removed from Chrome browser?

I'm looking at the offscreen-tabs experimental API here.
Then I tried to enable this but I don't see it in the chrome://flags/ part of the browser. Has it been removed from the browser as an experimental API or has it become a real API?
Yes Chrome OffScreen Tabs API was deleted from chrome extensions code base on 13 Dec 2012 as shown in this Patch / Changelist. This Chrome Issue asked to delete the specific API.
Chrome Extension Dev Page for Offline Tabs API also gives 404 that means corresponding document was also removed.
try this ref: https://support.google.com/chrome/answer/2765944#browsersettings
On your Windows computer, visit the Chrome Cleanup Tool website.
Click Download now.
Read the terms of service, and click Accept and Download.
When the file is downloaded, you'll see it at the bottom. Click the filename (chrome_cleanup_tool.exe).
Windows will ask if you want to run the file. Click Run.
The Chrome Cleanup Tool will scan your computer. You'll see a list of any malicious software found.
Click Remove suspicious programs.
Chrome will open a new tab, and ask you to reset your settings. Click Reset.

Assign tray icon to Google Chrome web application

I need to create a web application which will be stored in the traybar of Windows, this to prevent users from accidentally close my application (without the need of a pre-close alert message).
I thought that Google Chrome's background apps could be the right way to go, mostly because I don't need cross-browser compatibility and I have to choose which browser my users will use to run this web application.
The only problem is that I don't understand if I can achieve what I need with this feature.
I've found only this example of background app in Chrome countdown app
But this app uses the "background page" feature, that is different from what I'm looking for.
How can I let a Chrome app be minimized in the traybar (or even in the taskbar would be ok) instead of be closed?
Try to use node-webkit (chromium + node.js) for it: https://github.com/rogerwang/node-webkit
It allow to create any web-app and it support tray icons: https://github.com/rogerwang/node-webkit/wiki/Tray
You can download my windows example app here: https://mega.co.nz/#!xQMzgbxD!S58G-V23QLNRDFC10xso41-T2V8OZQVsQEH-lr46R3s
If you want exactly chrome, try this NPAPI plugin example: http://minimizetotray.googlecode.com/files/SourceCode.zip from http://habrahabr.ru/post/73003/
Unfortunately, I don't think you will be able to achieve exactly what you're after. You might be able to combine the two solutions below to nearly achieve your requirements. However, I don't think the type of control you are after is available via Google Apps.
Google App Launcher
The Google App Launcher would fulfill the "stored in the traybar of Windows" requirement.
The Chrome App Launcher is the hub of all your Chrome apps and with it
you have quick access to all of your apps from the desktop. When you
install an app from the "For Your Desktop" collection of the Chrome
Web Store, you get the App Launcher. The App Launcher requires you to
sign in to Chrome to enable apps that need access to your Google
account.
Manage apps
When you download a new app that enables App Launcher, the apps from
your Apps bookmark on Chrome New Tab page will also appear in the App
Launcher. Managing apps in the App Launcher is simple.
Add more apps: Click the Chrome Web Store button in your apps list and explore the apps in the store.
...
Background: Extending Your App's Life
You mentioned background apps in your question but I would recommend you explore it further. It essentially provides the "prevent users from accidentally close my application" requirement that you stated. This isn't foolproof (see bold sentence below) but it is about as close to the requirement I think you will be able to achieve.
As of Google Chrome 10, the background feature lets a hosted app run
as soon as the user logs into their computer—before the user launches
Chrome or the app—and to continue running even when Chrome or the app
has no visible windows. However, if the user explicitly quits Chrome,
the browser and app both exit.

Can you still create a Chrome packaged app in the browser with manifest 2.0?

All of the examples I've seen show apps launching in their own windows. This may be great an all for chromebook/chrome os, but is there still an option to launch in a browser tab?
No, there is no way to do that. Chrome Packaged Apps are not supposed to run inside a browser. You can, however, open URLs in a browser tab using window.open. But you won't have control of that tab after you issue the command.
If you need some sort of integration/control between your Chrome Packaged App and the browser, you can create an extension and make a communication pipe between the extension and the app - as long as both are running, using the chrome.runtime.sendMessage API.
See this sample for a simple code that does exactly that (two apps and one extension exchanging messages directly, without any server component).
chrome.app.window.create will create a new Window for an App.
If you want window manipulation, you should switch to chrome.tabs API and look for an extension instead of an App.
Reference
chrome.tabs
chrome.app.window

Local install of Google API Explorer?

Has anybody succeeded installing locally Google's open-sourced API Explorer? I'm trying to use that tool to expose my company's API, and I find it difficult to get it running: compilation required some minor code changes and library upgrades, and at runtime, some pieces of JavaScript get downloaded from different google servers etc.
I was able to see the API by doing the following in Chrome Version 31.0.1650.63:
Hit the combination "Ctrl+Shift+N" to open a "New incognito window" (or use the "Customize and control Google Chrome" menu to the right of the address box)
Enter the URL in the "incognito" window
http://localhost:8080/_ah/api/explorer
After the page loads, click the shield icon that appears at the far right within the address box.
Click "Load unsafe script". The API appeared.
There may be a way to configure Chrome to get past these steps but I have not found that yet.
The opensource repository for the APIs Explorer is woefully out of date, that is partially if not entirely my own fault. I'll work on that.
That being said, the APIs Explorer is not really intended for exploring just any API. It will work well for any of Google's Discovery-based APIs, which happens to include APIs created by the new Cloud Endpoints service, recently demoed at Google I/O.