Chrome C++ Extension

1,696 views
Skip to first unread message

salila

unread,
Feb 6, 2012, 5:34:11 AM2/6/12
to Chromium-extensions
I have created a FireFox extension using c++, XPCOM, on launch of the
FireFox Browser, gets loaded by Browser . My DLL extension has a list
of websites/URLs [basically read from a file on load of dll], on each
page load, it checks the loaded URL in the website list, if found, dll
fills few value to the input elements and submits the page
automatically [page details are known to DLL].

I would like to implement the similar functionality for Chrome also.
It would be a great help if one can guide me in this regard.

With Warm Regards,
Salila

Chris Hughes

unread,
Feb 6, 2012, 10:14:28 PM2/6/12
to salila, Chromium-extensions
You dont need to use such a big hammer to do this, simple "content
scripts" can do this using only javascript.
But if using something like C++ is needed, you can use "NaCL" Google's
(Native Client) to create an way to do that. Get the latest build of
chrome canary and try the NaCL example application.

-chris

> --
> 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.
>

--
sig ver 2.4
twitter: @chews (drunk tweet me)
blog: http://spazout.com
iPhone: 310.933.4533

salila

unread,
Feb 7, 2012, 7:09:24 AM2/7/12
to Chromium-extensions
Hi Chris,

Sorry to bother you again. I will be really greatful to you if you
could spend few minutes for me.

I have gone through the "NaCL" link "http://www.chromium.org/
nativeclient/getting-started/getting-started-background-and-basics#TOC-
Native-Client-NaCl-" and other reference links, downloaded the SDK and
compiled the code also. I was able to see all the examples working.
What I observed is, all those example are for Plug-in, that means, it
needs some embedded code/tag in HTML file, which will invoke the
Native Client dll.

My requirement is some thing like
1. My Extension Dll gets loaded automatically when Chrome browser
launches, during which I do some initialization[say url list loading
from a file]
2. On any web page load completes in any of the tab, I must be able to
track the page load complete event, say document complete event [there
will not be any embed tag / mime setup to invoke the plug-in and no
JavaScript code interaction ]
3. On document/Page load complete, check the presence of browser
loaded url  in my url list, if present do some custom operations, like
filling the values to input elements of HTML or submit the form, or
redirect to some other url etc.

Basically I am enhancing the user experience for my custom flow.


Thanks for your precious time.

With Warm Regards
Salila

On Feb 7, 8:14 am, Chris Hughes <christopher.hug...@gmail.com> wrote:
> You dont need to use such a big hammer to do this, simple "content
> scripts" can do this using only javascript.
> But if using something like C++ is needed, you can use "NaCL" Google's
> (Native Client) to create an way to do that. Get the latest build of
> chrome canary and try the NaCL example application.
>
> -chris
>
>
>
>
>
>
>
>
>
> On Mon, Feb 6, 2012 at 2:34 AM, salila <sali...@gmail.com> wrote:
> > I have created a FireFox extension using c++, XPCOM, on launch of the
> > FireFox Browser, gets loaded by Browser . My DLL extension has a list
> > of websites/URLs [basically read from a file on load of dll], on each
> > page load, it checks the loaded URL in the website list, if found, dll
> > fills few value to the input elements and submits the page
> > automatically [page details are known to DLL].
>
> > I would like to implement the similar functionality for Chrome also.
> > It would be a great help if one can guide me in this regard.
>
> > With Warm Regards,
> > Salila
>
> > --
> > 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...@chromium.org.
> > To unsubscribe from this group, send email to chromium-extensions+unsubscr...@chromium.org.
> > For more options, visit this group athttp://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.

Mohamed Mansour

unread,
Feb 7, 2012, 10:07:18 PM2/7/12
to salila, Chromium-extensions
Hi Salia, comments inlined:

On Tue, Feb 7, 2012 at 7:09 AM, salila <sal...@gmail.com> wrote:
Hi Chris,

Sorry to bother you again. I will be really greatful to you if you
could spend few minutes for me.

I have gone through the "NaCL" link "http://www.chromium.org/
nativeclient/getting-started/getting-started-background-and-basics#TOC-
Native-Client-NaCl-" and other reference links, downloaded the SDK and
compiled the code also. I was able to see all the examples working.
What I observed is, all those example are for Plug-in, that means, it
needs some embedded code/tag in HTML file, which will invoke the
Native Client dll.

You would have to do the same thing, you need to reference the .nexes through the <embed> tag. I would highly recommend placing the NaCL plugin in the background page.

My requirement is some thing like
1. My Extension Dll gets loaded automatically when Chrome browser
launches, during which I do some initialization[say url list loading
from a file]

You place it within the Background page so it will be a single initialization.
 
2. On any web page load completes in any of the tab, I must be able to
track the page load complete event, say document complete event [there
will not be any embed tag / mime setup to invoke the plug-in and no
JavaScript code interaction ]

You would use Message Passing (http://code.google.com/chrome/extensions/messaging.html) to let your Content Script (http://code.google.com/chrome/extensions/content_scripts.html) communicate to your Background Page. Then your background page would invoke methods on your NaCL plugin.
 
3. On document/Page load complete, check the presence of browser
loaded url  in my url list, if present do some custom operations, like
filling the values to input elements of HTML or submit the form, or
redirect to some other url etc.

Once you get your response back from NaCL, you send a message back to the content script through message passing.
 

I hope that helps you a bit :) Good luck!

Kind regards,
Mohamed Mansour

To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.

chanz

unread,
Feb 7, 2012, 6:09:49 PM2/7/12
to Chromium-extensions
Why don't you use NPAPI plugin...?
um.. Are you trying to control browser window?
(like..get url address from address bar of browser)
Reply all
Reply to author
Forward
0 new messages