Author: andreia
Date: 2007-11-08 10:52:17 -0500 (Thu, 08 Nov 2007)
New Revision: 89199

Modified:
   trunk/gluezilla/src/BrowserWindow.cpp
   trunk/gluezilla/src/ChangeLog
   trunk/gluezilla/src/Widget.cpp
   trunk/gluezilla/src/Widget.h
   trunk/gluezilla/src/gluezilla.cpp
   trunk/gluezilla/src/gluezilla.h
   trunk/gluezilla/src/interfaces.h
Log:
* BrowserWindow.cpp: When loading, invoke events on the managed side
so it can track progress and url changes.
* gluezilla.h, Widget.h: remove unneeded events, fix parameters.
* interfaces.h: add nsIURI interface, OnLocationChanged needs it
* Widget.cpp: add StateChange and LocationChange implementations to
call up to the managed side.

2007-11-08 Andreia Gaita <[EMAIL PROTECTED]>

Modified: trunk/gluezilla/src/BrowserWindow.cpp
===================================================================
--- trunk/gluezilla/src/BrowserWindow.cpp       2007-11-08 15:40:03 UTC (rev 
89198)
+++ trunk/gluezilla/src/BrowserWindow.cpp       2007-11-08 15:52:17 UTC (rev 
89199)
@@ -497,11 +497,14 @@
 /* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, 
in unsigned long aStateFlags, in nsresult aStatus); */
 NS_IMETHODIMP 
 BrowserWindow::OnStateChange(nsIWebProgress* progress, nsIRequest* request,
-                                                                               
   PRUint32 progressStateFlags, nsresult status)
-{
-       bool netstop = ( progressStateFlags & STATE_STOP ) && ( 
progressStateFlags & STATE_IS_NETWORK ) && ( status == NS_OK );
-       bool windowstop = ( progressStateFlags & STATE_STOP ) && ( 
progressStateFlags & STATE_IS_WINDOW ) && ( status == NS_OK );
+                                                                               
   PRUint32 state, nsresult status)
+{      
+
+       owner->EventStateChange(status, state);
        
+       bool netstop = ( state & STATE_STOP ) && ( state & STATE_IS_NETWORK ) 
&& ( status == NS_OK );
+       bool windowstop = ( state & STATE_STOP ) && ( state & STATE_IS_WINDOW ) 
&& ( status == NS_OK );
+       
        if (netstop)
        {
                PRBool visibility;
@@ -650,9 +653,12 @@
 
 /* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest 
aRequest, in nsIURI aLocation); */
 NS_IMETHODIMP 
-BrowserWindow::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest 
*aRequest, nsIURI *aLocation)
+BrowserWindow::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest 
*aRequest, nsIURI *location)
 {
-    return NS_ERROR_NOT_IMPLEMENTED;
+       nsCString url;
+       location->GetSpec (url);
+    owner->EventLocationChanged(url.BeginReading ());
+       return NS_OK;
 }
 
 /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest 
aRequest, in nsresult aStatus, in wstring aMessage); */

Modified: trunk/gluezilla/src/ChangeLog
===================================================================
--- trunk/gluezilla/src/ChangeLog       2007-11-08 15:40:03 UTC (rev 89198)
+++ trunk/gluezilla/src/ChangeLog       2007-11-08 15:52:17 UTC (rev 89199)
@@ -1,3 +1,12 @@
+2007-11-08  Andreia Gaita <[EMAIL PROTECTED]>
+
+       * BrowserWindow.cpp: When loading, invoke events on the managed side
+       so it can track progress and url changes.
+       * gluezilla.h, Widget.h: remove unneeded events, fix parameters.
+       * interfaces.h: add nsIURI interface, OnLocationChanged needs it
+       * Widget.cpp: add StateChange and LocationChange implementations to
+       call up to the managed side.
+
 2007-11-06  Andreia Gaita <[EMAIL PROTECTED]>
 
        * windows.mak: windows makefile for command line building with nmake

Modified: trunk/gluezilla/src/Widget.cpp
===================================================================
--- trunk/gluezilla/src/Widget.cpp      2007-11-08 15:40:03 UTC (rev 89198)
+++ trunk/gluezilla/src/Widget.cpp      2007-11-08 15:52:17 UTC (rev 89199)
@@ -456,6 +456,19 @@
        return events->OnCreateNewWindow ();
 }
 
+void 
+Widget::EventStateChange (PRUint32 state, PRInt32 status)
+{
+       events->OnStateChange (state, status);
+}
+
+void 
+Widget::EventLocationChanged (const char * uri)
+{
+       events->OnLocationChanged (uri);
+}
+
+
 void
 Widget::EventGeneric (nsString type)
 {

Modified: trunk/gluezilla/src/Widget.h
===================================================================
--- trunk/gluezilla/src/Widget.h        2007-11-08 15:40:03 UTC (rev 89198)
+++ trunk/gluezilla/src/Widget.h        2007-11-08 15:52:17 UTC (rev 89199)
@@ -124,6 +124,7 @@
                nsresult Reload (Params * params) {
                        return this->Reload (params->option);
                }
+
                // end of generic targets for delegation
 
                // Initialization and Shutdown
@@ -156,7 +157,6 @@
                // Events
                void EventOnWidgetLoaded        ();
 
-               void GetControlSize                     (SizeInfo *sz);
                void EventJSStatus                      (void);
                void EventLinkStatus            (void);
                void EventDestroyBrowser        (void);
@@ -169,10 +169,10 @@
                void EventStateNetStart         (void);
                void EventStateNetStop          (void);
                void EventStateSpecial          (PRUint32 stateFlags, PRInt32 
status);
-               void EventStateChange           (const char *uriString, 
PRUint32 stateFlags, PRInt32 status);
+               void EventStateChange           (PRUint32 stateFlags, PRInt32 
status);
                void EventProgress                      (PRInt32 
curTotalProgress, PRInt32 maxTotalProgress);
                void EventProgressAll           (const char *uriString, PRInt32 
curTotalProgress, PRInt32 maxTotalProgress);
-               void EventLocationChanged       (void);
+               void EventLocationChanged       (const char * url);
                void EventStatusChange          (PRInt32 status, const char 
*message);
                void EventSecurityChange        (PRUint32 state);
                void EventVisibility            (PRBool val);
@@ -215,6 +215,8 @@
                CallbackBin     *events;
 
                BrowserWindow *browserWindow;
+               nsIDOMHTMLDocument * document;
+               nsIWebNavigation * webNav;
        private:
                nsresult GRE_Startup ();
                

Modified: trunk/gluezilla/src/gluezilla.cpp
===================================================================
--- trunk/gluezilla/src/gluezilla.cpp   2007-11-08 15:40:03 UTC (rev 89198)
+++ trunk/gluezilla/src/gluezilla.cpp   2007-11-08 15:52:17 UTC (rev 89199)
@@ -266,15 +266,17 @@
        widget->browserWindow->webBrowser->GetContentDOMWindow( getter_AddRefs 
(domWindow) );
        nsCOMPtr<nsIDOMDocument> domDoc;
        domWindow->GetDocument (getter_AddRefs(domDoc));
-       nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface( domDoc );
+       nsCOMPtr<nsIDOMHTMLDocument> htmlDoc (do_QueryInterface( domDoc ));
        return htmlDoc; 
+
 }
 
 NS_METHOD_(void*)
 gluezilla_getWebNavigation (Handle *instance)
 {
        Widget *widget = reinterpret_cast<Widget *> (instance);
-       return widget->browserWindow->getWebNavigation ();
+       nsCOMPtr<nsIWebNavigation> webNav (do_QueryInterface 
(widget->browserWindow->webBrowser));
+       return webNav;
 }
 
 NS_METHOD_(void)

Modified: trunk/gluezilla/src/gluezilla.h
===================================================================
--- trunk/gluezilla/src/gluezilla.h     2007-11-08 15:40:03 UTC (rev 89198)
+++ trunk/gluezilla/src/gluezilla.h     2007-11-08 15:52:17 UTC (rev 89199)
@@ -130,7 +130,6 @@
        {
                void (STDCALL *OnWidgetLoaded)          ();
 
-               void (STDCALL *GetControlSize)          (SizeInfo *sz);
                void (STDCALL *OnJSStatus)                      (void);
                void (STDCALL *OnLinkStatus)            (void);
                void (STDCALL *OnDestroyBrowser)        (void);
@@ -143,10 +142,10 @@
                void (STDCALL *OnStateNetStart)         (void);
                void (STDCALL *OnStateNetStop)          (void);
                void (STDCALL *OnStateSpecial)          (PRUint32 stateFlags, 
PRInt32 status);
-               void (STDCALL *OnStateChange)           (const char *uriString, 
PRInt32 status, PRUint32 stateFlags);
+               void (STDCALL *OnStateChange)           (PRInt32 status, 
PRUint32 stateFlags);
                void (STDCALL *OnProgress)                      (PRInt32 
curTotalProgress, PRInt32 maxTotalProgress);
                void (STDCALL *OnProgressAll)           (const char *uriString, 
PRInt32 curTotalProgress, PRInt32 maxTotalProgress);
-               void (STDCALL *OnLocationChanged)       (void);
+               void (STDCALL *OnLocationChanged)       (const char * url);
                void (STDCALL *OnStatusChange)          (const char *message, 
PRInt32 status);
                void (STDCALL *OnSecurityChange)        (PRUint32 state);
                void (STDCALL *OnVisibility)            (PRBool val);

Modified: trunk/gluezilla/src/interfaces.h
===================================================================
--- trunk/gluezilla/src/interfaces.h    2007-11-08 15:40:03 UTC (rev 89198)
+++ trunk/gluezilla/src/interfaces.h    2007-11-08 15:52:17 UTC (rev 89199)
@@ -76,6 +76,7 @@
 // dom
 #include "nsIDOMHTMLDocument.h"
 #include "nsIDOMDocument.h"
+#include <nsIURI.h>
 
 /* XRE API */
 //#include "xulapp/nsXULAppAPI.h" 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to