Hi Jud,
Thanks for replying. Let me explain what I'm trying to do here.
I have a plugin that is used as a document editor. When someone
clicks on the "Back" or "Forward" menus or toolbar buttons, I want
to first throw a dialog box asking the user whether he indeed
wishes to quit the plugin, and if the user chooses cancel to
cancel the new page load and bring the user back to the plugin.
I figured the best way to do this was to have my plugin implement
the nsIWebProgressListener interface and listen in on page load
starts. Then I could throw a dialog box on a start load and if the
user chose cancel, cancel the load by calling nsIRequest->Cancel().
However, without getting access to the specific nsIWebBrowser of
the plugin window, this does not fly. Any suggestions from you
would be greatly appreciated.
thnx much
_Ashu
>User-Agent: Mozilla/5.0 (X11; U; Linux 2.4.2-2 i686; en-US; rv:0.9+)
Gecko/20010507 Netscape6/6.5b0
>X-Accept-Language: en
>MIME-Version: 1.0
>To: [EMAIL PROTECTED]
>CC: [EMAIL PROTECTED]
>Subject: Re: How to get a nsIWebBrowser from a nsIDocShell
>Content-Transfer-Encoding: 7bit
>
>[EMAIL PROTECTED] wrote:
>
>>I have a plugin that I need to register as a nsIWebProgressListener on the
>>nsIWebBrowser that is displaying the plugin. I can use the WindowMediator
>>service to get the nsIXULWindow to which the plugin belongs and then get the
>>nsIDocShell of the PrimaryContentShell of this XULWindow.
>>
>neither nsIXULWindow or nsIDocShell are public; they are private.
>
>> However, inorder to
>>be able to register the listener, I need access to the particular
>>nsIWebBrowser. How do I do this.
>>
>the embedding api's assume that you update the window mediator w/ the
>window hierarchy as it changes. this assumes that you own the window
>model and hierarchy (which would give you ther nsIWebBrowser for free).
>if you're trying to do this from a plugin, I'm not sure how it would be
>done.
>
>>I dont want to set the listener on the nsIWebProgress as i understand this is
>>a Service and will notify me when a load happens in any open window of the
>>browser.
>>
>nsIWebProgress is currently private as well, and yes, you would get
>global notifications.
>
>Jud
>
Ashutosh Kulkarni
Sun Microsystems Inc.
408 343 1871