How can OS interact with a chrome extension?

68 views
Skip to first unread message

Rots

unread,
Jul 1, 2010, 6:50:18 AM7/1/10
to Chromium-extensions
I also posted the question to the help forum at
http://www.google.com/support/forum/p/Chrome/thread?tid=5dfc7bf86ce9c8c5&hl=en
I'm hoping to get a faster response here.

What are the possible ways for an Operating System (Windows) to
interact with an extension (to pass any parameters or data)?
Since accessing the file system from an extension is not allowed, I
can only think of opening an extension (options) page with the passed
parameters in the URL (i.e. open a new tab/window at chrome-
extension://kkmbodalobogbnejmcdghkfimhodifol/options.html?param1=value&p2=b&data=ccc;aaa;ddd;bbb)

Is there a better way of doing it?

The available message passing methods and content scripts run inside
the browser sandbox, but I need to pass a message (programmatically,
not by user input) from OS to extension. More specifically, I have
simple text data in a file and want to pass it to the extension. I
guess one way of doing it could be using plugins, but i don't want to
make things so complicated since I'm not familiar with NPAPI and
dll's. I can run scripts on the machine though...
Ideally a simple extension is enough. Again, the only way I see it
doable is by running a simple script in Windows that reads the file
and opens the "listener" extension page and passes the contents of the
file through the URL.

Rots

Rots

unread,
Jul 5, 2010, 4:55:04 PM7/5/10
to Chromium-extensions
I think I found a possible way...
copying the needed file(s) to the unpacked extension folder at
%chrome user data%\Default\Extensions\extension_id\1.0_0
and reading (or polling, if needed) for new/changed files with
Javascript and HttpRequest from inside the extension. I guess it may
violate some "good practices", but right now to me it seems a
reasonable thing to do. And from the security perspective, I assume
the files to be safe, because if the attacker already has access to
the file system, there's a whole lot of other things to worry about.

Any thoughts on this approach?

Rots


On Jul 1, 1:50 pm, Rots <rot...@gmail.com> wrote:
> I also posted the question to the help forum athttp://www.google.com/support/forum/p/Chrome/thread?tid=5dfc7bf86ce9c...
> I'm hoping to get a faster response here.
>
> What are the possible ways for an Operating System (Windows) to
> interact with an extension (to pass any parameters or data)?
> Since accessing the file system from an extension is not allowed, I
> can only think of opening an extension (options) page with the passed
> parameters in the URL (i.e. open a new tab/window at chrome-
> extension://kkmbodalobogbnejmcdghkfimhodifol/options.html?param1=value&p2=b &data=ccc;aaa;ddd;bbb)

Arne Roomann-Kurrik

unread,
Jul 7, 2010, 1:55:27 PM7/7/10
to Rots, Chromium-extensions
Probably not the ideal approach, but if you're the only user of the extension and you don't want to go the NPAPI route, it's probably not bad.  I don't see how you would distribute this though - asking users to run a windows executable doesn't seem right to me.

~Arne


--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.


Rots

unread,
Jul 7, 2010, 5:14:22 PM7/7/10
to Chromium-extensions
Thanks for the encouragement,
I found out that the other program that I have in mind, that is the
source of those files has a setting for the path to save files to. Now
there's no need for an extra executable. The only concern is to have
the user change this path setting in the 3rd party program from one
version of the extension to the next. But since I don't expect the
extension to change after reaching to a certain acceptable state, this
is not a big deal.

Rots
> > To post to this group, send email to chromium-extensi...@chromium.org.
> > To unsubscribe from this group, send email to
> > chromium-extensions+unsubscr...@chromium.org<chromium-extensions%2Bunsubscr...@chromium.org>
> > .
Reply all
Reply to author
Forward
0 new messages