How to detect if the "Enable Extension" notification is showing? - google-chrome

I've built a simple chrome extension for a client that has a windows application.
He wants to install the extension with the install of the software itself, I've managed to get this done.
I understood that since the install is done externally the user will see this message:
I also understood that this message will be shown for a limited number of times.
I would like to detect if this message is shown or not, how can I do that?

This will be shown once on first install. If the user accepts, the extension will be activated and will update automatically in future; if the user declines, the extension is blacklisted and will not be installed automatically again.
You can't detect it from the extension, as the extension (as per security measures) is not enabled yet.

Related

A custom extension is not listed in extensions page in some computers

I have developed a Google Extension for which I created a Windows installer package. That installer writes the corresponding registry entries as explained in https://developer.chrome.com/extensions/external_extensions#registry
All that works well in some computers. So, after I run the installer package and then run Google Chrome, a little popup appears telling me to enable the extension. I answer “Yes” to that question and from that time on, the extension works as expected.
However, in some computers, with the same version of Chrome (53.0.2785.116 m), the installer writes the corresponding entries to the registry but when I run Chrome, nothing happens and the extension is not listed in the chrome://extensions/ page.
In such cases, I can connect to web store to install the extension manually. However, this extension launches an application because it implements Native Messaging. When I install the extension manually it works (the native messaging host application is launched and works) but when I close and re-open Chrome, the host application is not run. To run it, I need to manually disable and then re-enable the extension.
Very strange what happening. Can you help me on this please?
Based from this thread, (which is somewhat related to your issue), when you close the Chrome, it will fire onDisconnect event that's why the application is not running.
Native messaging means only Chrome can start a host instance when it "connects". It's a misnomer, since connect() means "launch a new copy and talk to it".
There is no way to "attach" to an already-running process. If you close the host, stdio pipe is broken the Port object fires onDisconnect event. Then you need to re-launch the host from the extension to be able to talk to it.
You can check on this link. Just make sure that no antivirus or firewall programs on your computer are causing the problem. If you can open Google Chrome when the firewall is off, you may need to create an exception in your antivirus or firewall settings.
However, in some computers, with the same version of Chrome (53.0.2785.116 m), the installer writes the corresponding entries to the registry but when I run Chrome, nothing happens and the extension is not listed in the chrome://extensions/ page.
You may be encountering blacklisting if that extension was ever installed, then uninstalled.
What if the user uninstalls the extension?
If the user uninstalls the extension through the UI, it will no longer
be installed or updated on each startup. In other words, the external
extension is blacklisted.
How do I get off the blacklist?
If the user uninstalls your extension, you should respect that
decision. However, if you (the developer) accidentally uninstalled
your extension through the UI, you can remove the blacklist tag by
installing the extension normally through the UI, and then
uninstalling it.

How to create installer for a Google Chrome Extension

I have developed a Google Chrome Extension that I need to automate installation for my users.
I have published it in Google Web Store but I don't want a user to search for it in order to install, because this extension is part of other development, including a C# application.
I am creating an installer that installs the C# application but I need to add the automatic installation for my extension. How can I do it?
Yes, you can. The procedure is described in the docs.
Summary:
The installer adds a registry entry that contains the extension ID.
Upon next Chrome restart (you may want to ask the user to do it), the extension will be downloaded and then the user will be prompted whether he/she wants to install it.
If yes, you live happily ever after, with the extension bearing "Installed by a third-party" mark in the extension list.
If no, the extension will be disabled, and you cannot enable it yourself (you have to ask the user to do that by going to chrome://extensions/ or the CWS listing)
If the user ever uninstalls the extension, it will be blacklisted from ever attempting that install procedure on this Chrome profile; if the user changes his mind, he'll have to install it directly from the Store.
Leave clear instructions for your users: that they must restart the browser and expect/accept the prompt.
The best way to do this is the way that Xan wrote in his answer.
If you need to force install Chrome extensions in your company without user interaction. You can do this with ExtensionInstallForcelist policy or with master_preferences file. Both ways described here.

How to save a chrome extension as .exe file?

I have implemented a chrome extension project but I need to install it by running a .exe file.
I tried many ways like extracting files to C:\Users\user\AppData\Local\Google\Chrome\User Data\Default\Extensions automatically using iExpress(i gave the id of extension to the folder),
i tried creating ExtensionInstallForceList under HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Google\Chrome\ and creating new string value "1" giving it value "id;https://clients2.google.com/service/update2/crx"
and lots of other ways but still I couldn't make it. I would appreciate a little help
The only programmatic way to install an extension on Windows (assuming you're not a Windows Domain sysadmin, which seems to be a safe assumption) is as follows:
Upload your extension to Chrome Web Store and publish.
This is mandatory, but the extension can be specified to be unlisted.
Create an installer that adds a registry entry as described here.
Upon next browser restart, Chrome will:
Download the extension from Web Store (and nowhere else)
Ask a confirmation from the user to allow that extension.
If the user agrees, you're done. If the user does not agree, the extension is blacklisted and you can't try again on this install unless the user installs directly from Web Store.
ExtensionInstallForceList is only for enterprise deployments via group policy. Chrome will ignore local registry values and query the domain policy directly.

Is it possible to create a custom Chrome installer with specific extentions that will be installed automatically?

I'm looking to be able to provide a Chrome installer that as they go through the wizard it installs Google Chrome as per normal, however it will also automatically install specific extentions from the App Store that will be there when they first open the browser.
Is there a tool available that would allow me to do this easily? I've done a number of searches on the topic but I have been successful.
You can configure a list of extensions to be installed on first run of every new profile by using https://developer.chrome.com/extensions/external_extensions
So you'd just need to write a program that first lays this configuration down, and then runs the regular chrome installer.

Installing External Extension

I want to create a Chrome extension and install it as part of a larger desktop software install. This is on Windows XP/Vista/7 etc. I've used the method described here and it works.
However, the extension is installed in a disabled state. The user has to explicitly enable it from the Chrome menu (the user has 3 chances to do that before the menu badge disappears) or from the extensions page. Enabling the extension brings up a prompt in which Chrome informs the user of the permissions the extension is requesting and asks the user to reject or accept the extension.
I understand that Google wants to ensure that users have a chance to reject external extensions. I also understand that Google prefers installs via its Web Store (for various logistical reasons, that is not a preferred option for this app). In fact, our application specifically asks the user for permission before installing the extension.
My issue is that the member has to affirmatively ask for the extension to be enabled before the permissions dialog comes up. Is there any programmatic/command line way to get Chrome to bring the permissions dialog up? The user still has the choice of rejecting the extension, but I would like to present the user with this choice, rather than relying on him/her to try and enable the extension later.
[ I realize that editing the Chrome Preferences file in the installation script will install the extension without any user intervention, but I don't want to do that.]
It's possible to trigger an install from a webpage. Have your installer open chrome with a small webpage that brings up this dialog to the user.