Can a Chrome extension launch new Chrome windows under different user profiles? - google-chrome-extension

Is there an API for a Chrome extension to launch and control new Chrome windows under different user profiles?
My understanding is that while an extension may be run under multiple user profiles simultaneously, these instances are isolated; they cannot communicate directly and an extension in one profile cannot access the windows/tabs/processes/etc of another profile. Is this the case?
It seems like the best way to launch and control Chrome windows under multiple profiles is to use an approach based on the Remote Debugger API such as the ChromeDriver project.
For context, I'm interested in writing a tool to manage and launch predefined "bundles" of multiple Chrome windows, each with different URLs and screen positions, and each under a different profiles. The attached screenshot shows an example desired state: three browsers, each in a separate profile, each at a different URL, with different devtools states, organized in a specific screen layout. It is conceptually similar to tmuxinator.
If I wanted to provide a Chrome-based UI for designing and managing these presaved layouts, it seems that I would need to provide a native shim that invokes new Chromes via chromedriver, and communicate with them via native messaging. Is there a more direct API that I am missing?
It seems that the proposed Profile Extension API would do exactly what I'm interested in, but I don't see any discussion on the apps-dev#chromium.org list.

If chrome allowed this it would be a huge security hole.
Chrome extensions are installed per user account so they shouldnt be able to see anything from other accounts.

Related

Is there a way to register a desktop application as a handler for a custom URL protocol, such that all browsers will honour it?

It looks like Chrome uses xdg-open, so it's sufficient to create a .desktop file for you application and register it via mimeapps.list.
Firefox doesn't appear to honour this. I also tried registering via gconftool as suggested at http://kb.mozillazine.org/Register_protocol#All_Firefox_versions, but Firefox still doesn't seem to recognise the protocol, and entering "myprotocol://foo" just triggers a search rather than launching my application.
Is there a foolproof way to do this on all Linux versions which supports all browsers? Or at least a list of common bases to cover which will work for the majority of distro/browser combinations?
Note: this must be do-able programmatically - I want the application to register itself

Is there a solution to get desktop active application name from a chrome extension?

I would need the list of currently opened desktop apps (+ files opened in it) from a Chrome Extension, or at least the active application name (With current focus on the desktop).
Use case : Imagine a chrome extension that would get the list of tabs with URLS (I solved it with Chrome.tabs) and in addition would give the name of the current active app when Chrome loose the focus (idle) : exemple => powerpoint.app / documentname.ppt.
I'm looking for any option, ideally without having to implement a Desktop App that would exchange messages with the Extension. But if this is the only way, any example/experience to do so with Electron (http://electron.atom.io/) or Node-WebKit?
This may be possible in an electron app, but I don't think so as Electron is more multiplatform-oriented and this is a platform-oriented feature. You only will have access to methods that the developers chose to expose to you, and I doubt that they exposed a way to have this kind of information. (I have very little knowledge in the tech since I used it only once, so I might be wrong).
The only solution I see is the one you talked about in your question, a real desktop app messaging with the chrome extension.

Do I need to create both an extension & packaged app if I want chrome.socket and Context Menus?

I am developing a chrome extension/app that requires
communicate with Intranet services in UDP binary protocol using chrome.socket APIs
need to extract DOM content from non-app web pages. This could be done using bookmarklet, Browser Actions, page actions, or chrome context menus.
There are two chrome.contextMenus APIs
http://developer.chrome.com/apps/contextMenus.html
http://developer.chrome.com/extensions/contextMenus.html
One for Packaged App, another for Extensions. The former only insert contextMenus to Packages Apps, not normal web pages.
If I need both chrome.socket & invoking from normal webpage capability, do I need to create both an extension as well as an app? That would be very confusing to end users.
Yes, you need both the app and the extension. Apps are intentionally devoid of APIs that modify web pages. That's where extensions come in.
I ran into the same problem and had to make two separate apps for exactly the same reasons. (JSTorrent contextmenu extension && JSTorrent).
I believe there are ways to trigger the install dialog from one to the other, but I have not tried to do this yet. If somebody had examples for how to do this, that would be great to add here!
Consider using <webview> in an app. You'll be able to display web content there, and you can more easily communicate between the app and the content. It will result in a single installable item.

Tabs/Windows in Chrome apps

It appears that chrome apps are unable to render as tabs in the browser... I happen to like the chrome tabbing interface and it would be a shame to have to try and re-implement it in html/css/js. Is there really no way to do tab management at the chrome application level? Must all new windows be shell/panel level windows?
I can imagine scenarios for applications where they would want to contribute extension related features to the browser... why are you making it more confusing for users (who now have to install an app and an extension) in order to get the full feature set?
Is there really no room for middle-ground here?
Chrome apps are separate from the browser. This is a very deliberate approach, which is unlikely to change.
For apps to be seen as apps, as opposed to websites, which are always available regardless of connectivity, they need to be seen as separate to a browser. We have found having apps launched and run outside the browser very important for users to conceptualize them as apps.
There are also security reasons to keep apps out of the browser. They have access to APIs that websites and extensions do not have access to, but to make this possible they are also individually sandboxed and have no access to the browser.
Extensions and apps can communicate via messages. It is less than ideal that a user may need to install both an app and an extension; we have been looking at some form of bundling to make this simpler.

App for Google Chrome

I have created an App for google chrome which just opens a web page. I am new in the topic
of Apps. I was thinking if it is possible to execute some linux command by using an App
in google chrome. For instance, an App which can open a terminal or open a program
installed in my machine like Gimp, Kate, Libre Office ...
From the instructions in the web page of google I saw that the only actions for an App
are limited to open a web address but I dont know if it is possible to extend the capabilities
of the Apps,
Regards.
Aren't apps sandboxed into the Google Chrome Process to ensure they can't affect other processes and for other security reasons. If so, you won't be able to execute programs/commands or view the User's Files unless you use some workaround such as Google's Native Client.
Google has locked down capabilities to stop malicious Web Apps from executing code and bringing malware and exploits.
You can write a NPAPI Plugin or a custom URI scheme associated to Unix terminal.

Resources