On Tue, Jan 5, 2010 at 4:21 PM, Aris <alexey.s.shish...@gmail.com> wrote:
> Finnur, thank you again for your feedback!
>
> I’m going to use approach with accessing user’s preferences file, but
> some questions still worry me.
>
> I’ll describe briefly what is my extension. It’s NPAPI extension
> (plugin) with content script. I use a content script to
> programmatically insert my plugin (scriptable object) into web pages.
> I need access to window’s DOM during initialization of plugin. Later
> on plugin is used to modify DOM.
>
> Now about accessing user’s preferences file. This approach assumes
> that extension (my NPAPI dll) is always loaded (then I can read
> preferences file during NP_Shutdown(…)) right after user launches
> Chrome. So I can not use content script to programmatically insert my
> plugin into web page, but instead I have to embed it into background
> page:
>
> <embed type="application/x-my-extension" id="pluginId">
>
> But I’m not sure if I can access window object from background page.
> For example, I need access to window, document,
> window.addEventListener to initialize plugin. Can I access these
> objects from background page?
>
> Thank you in advance!

You can use message passing to communicate between the background page
and content script [1] in order to get access to these things.
Alternatively, you could have two bits of NPAPI, one which sits in the
content script and does your page modifications, and one which sits in
your background page and does cleanup.  Or you could register two
MIME-types to your plugin so that the background page embed behaves
differently.

1: http://code.google.com/chrome/extensions/messaging.html
-- 
You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to chromium-extensi...@googlegroups.com.
To unsubscribe from this group, send email to 
chromium-extensions+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en.


Reply via email to