Author: zbowling
Date: 2006-05-18 18:39:01 -0400 (Thu, 18 May 2006)
New Revision: 60844

Modified:
   trunk/mozembed/src/EmbedContentListener.cpp
   trunk/mozembed/src/EmbedEventListener.h
   trunk/mozembed/src/EmbedPrivate.cpp
   trunk/mozembed/src/EmbedPrivate.h
   trunk/mozembed/src/EmbedProgress.cpp
   trunk/mozembed/src/EmbedWindow.cpp
   trunk/mozembed/src/EmbedWindowCreator.h
   trunk/mozembed/src/Makefile.am
   trunk/mozembed/src/embedutils.cpp
   trunk/mozembed/src/embedutils.h
   trunk/mozembed/src/mozembed-config.h.in
   trunk/mozembed/src/mozembed.cpp
   trunk/mozembed/src/mozembed.h
Log:
Oh boy, oh boy, oh boysvn diffsvn diff

Modified: trunk/mozembed/src/EmbedContentListener.cpp
===================================================================
--- trunk/mozembed/src/EmbedContentListener.cpp 2006-05-18 21:51:16 UTC (rev 
60843)
+++ trunk/mozembed/src/EmbedContentListener.cpp 2006-05-18 22:39:01 UTC (rev 
60844)
@@ -50,7 +50,7 @@
 {
   nsresult rv;
 
-  nsCAutoString specString;
+  nsEmbedCString specString;
   rv = aURI->GetSpec(specString);
 
   if (NS_FAILED(rv))
@@ -97,15 +97,18 @@
       PRUint32 canHandle;
       nsresult rv =
        webNavInfo->IsTypeSupported(nsDependentCString(aContentType),
-                                   mOwner ? mOwner->mNavigation.get() : nsnull,
+               
+                   mOwner ? mOwner->mNavigation.get() : nsnull,
                                    &canHandle);
       NS_ENSURE_SUCCESS(rv, rv);
       *_retval = (canHandle != nsIWebNavigationInfo::UNSUPPORTED);
     }
   }
+  
   return NS_OK;
 }
 
+
 NS_IMETHODIMP
 EmbedContentListener::GetLoadCookie(nsISupports **aLoadCookie)
 {
@@ -129,4 +132,3 @@
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
-

Modified: trunk/mozembed/src/EmbedEventListener.h
===================================================================
--- trunk/mozembed/src/EmbedEventListener.h     2006-05-18 21:51:16 UTC (rev 
60843)
+++ trunk/mozembed/src/EmbedEventListener.h     2006-05-18 22:39:01 UTC (rev 
60844)
@@ -12,8 +12,7 @@
  * Portions created by Christopher Blizzard are Copyright (C) Christopher 
Blizzard.  All Rights Reserved.
  */
 
-#ifndef __EmbedEventListener_h
-#define __EmbedEventListener_h
+
 #define MOZILLA_INTERNAL_API
 #include <nsIDOMKeyListener.h>
 #include <nsIDOMMouseListener.h>
@@ -21,6 +20,10 @@
 #include <nsIDOMUIListener.h>
 #endif
 #undef MOZILLA_INTERNAL_API
+
+#ifndef __EmbedEventListener_h
+#define __EmbedEventListener_h
+
 class EmbedPrivate;
 
 class EmbedEventListener : public nsIDOMKeyListener,

Modified: trunk/mozembed/src/EmbedPrivate.cpp
===================================================================
--- trunk/mozembed/src/EmbedPrivate.cpp 2006-05-18 21:51:16 UTC (rev 60843)
+++ trunk/mozembed/src/EmbedPrivate.cpp 2006-05-18 22:39:01 UTC (rev 60844)
@@ -12,24 +12,26 @@
  * Portions created by Christopher Blizzard are Copyright (C) Christopher 
Blizzard.  All Rights Reserved.
  */
 
+#include "stdio.h"
 #include "EmbedPrivate.h"
 #include "EmbedWindow.h"
 #include "EmbedProgress.h"
 #include "EmbedContentListener.h"
 #include "EmbedEventListener.h"
 #include "EmbedWindowCreator.h"
-#include "embedutils.h"
+//#include "embedutils.h"
 
 /* Unsafe includes */
-#define MOZILLA_INTERNAL_API
-#include <nsNetUtil.h>
+//#define MOZILLA_INTERNAL_API
+//#include <nsNetUtil.h>
+#include <nsEmbedAPI.h>
 #include <nsProfileDirServiceProvider.h>
 #ifdef FIREFOX_1_5
 #include <nsIWebBrowserStream.h>
 #endif
-#undef MOZILLA_INTERNAL_API
+//#undef MOZILLA_INTERNAL_API
 
-
+#include <nsIIOService.h>
 #include <nsIDocShell.h>
 #include <nsIWebProgress.h>
 #include <nsIWidget.h>
@@ -85,7 +87,6 @@
 PRUint32     EmbedPrivate::sWidgetCount = 0;
 char        *EmbedPrivate::sCompPath    = nsnull;
 nsIAppShell *EmbedPrivate::sAppShell    = nsnull;
-nsVoidArray *EmbedPrivate::sWindowList  = nsnull;
 char        *EmbedPrivate::sProfileDir  = nsnull;
 char        *EmbedPrivate::sProfileName = nsnull;
 nsIPref     *EmbedPrivate::sPrefs       = nsnull;
@@ -116,15 +117,10 @@
   mStream           = nsnull;
 #endif
   PushStartup();
-  if (!sWindowList) {
-    sWindowList = new nsVoidArray();
-  }
-  sWindowList->AppendElement(this);
 }
 
 EmbedPrivate::~EmbedPrivate()
 {
-  sWindowList->RemoveElement(this);
   PopStartup();
 }
 
@@ -192,12 +188,10 @@
 nsresult
 EmbedPrivate::Realize()
 {
-
-
   // Get the nsIWebBrowser object for our embedded window.
   nsCOMPtr<nsIWebBrowser> webBrowser;
   mWindow->GetWebBrowser(getter_AddRefs(webBrowser));
-
+  printf("GetWebBrowser\n");
   // get a handle on the navigation object
   mNavigation = do_QueryInterface(webBrowser);
 
@@ -418,7 +412,7 @@
        return;
     }
 
-    rv = mozembed_util_InitEmbedding(binDir, sAppFileLocProvider);
+    rv = NS_InitEmbedding(binDir, sAppFileLocProvider);
     if (NS_FAILED(rv))
       return;
 
@@ -473,7 +467,7 @@
     }
 
     // shut down XPCOM/Embedding
-    mozembed_util_TermEmbedding();
+    NS_TermEmbedding();
   }
 }
 
@@ -540,9 +534,13 @@
 
   nsCOMPtr<nsIWebBrowserStream> wbStream = do_QueryInterface(webBrowser);
   if (!wbStream) return NS_ERROR_FAILURE;
-
+  
+  nsCOMPtr<nsIIOService> ioservice = 
do_GetService("@mozilla.org/network/io-service;1"); 
+  
   nsCOMPtr<nsIURI> uri;
-  nsresult rv = NS_NewURI(getter_AddRefs(uri), aBaseURI);
+  nsresult rv;
+  rv = 
ioservice->NewURI((nsACString&)aBaseURI,nsnull,nsnull,(nsIURI**)getter_AddRefs(uri));
+  //rv  = NS_NewURI(getter_AddRefs(uri), aBaseURI);
   if (NS_FAILED(rv))
     return rv;
 
@@ -611,31 +609,7 @@
 #endif
 }
 
-/* static */
-EmbedPrivate *
-EmbedPrivate::FindPrivateForBrowser(nsIWebBrowserChrome *aBrowser)
-{
-  if (!sWindowList)
-    return nsnull;
 
-  // Get the number of browser windows.
-  PRInt32 count = sWindowList->Count();
-  // This function doesn't get called very often at all ( only when
-  // creating a new window ) so it's OK to walk the list of open
-  // windows.
-  for (int i = 0; i < count; i++) {
-    EmbedPrivate *tmpPrivate = NS_STATIC_CAST(EmbedPrivate *,
-                                             sWindowList->ElementAt(i));
-    // get the browser object for that window
-    nsIWebBrowserChrome *chrome = NS_STATIC_CAST(nsIWebBrowserChrome *,
-                                                tmpPrivate->mWindow);
-    if (chrome == aBrowser)
-      return tmpPrivate;
-  }
-
-  return nsnull;
-}
-
 void
 EmbedPrivate::ContentStateChange(void)
 {

Modified: trunk/mozembed/src/EmbedPrivate.h
===================================================================
--- trunk/mozembed/src/EmbedPrivate.h   2006-05-18 21:51:16 UTC (rev 60843)
+++ trunk/mozembed/src/EmbedPrivate.h   2006-05-18 22:39:01 UTC (rev 60844)
@@ -12,18 +12,20 @@
  * Portions created by Christopher Blizzard are Copyright (C) Christopher 
Blizzard.  All Rights Reserved.
  */
 
-#include "config.h"
-
-#define MOZILLA_INTERNAL_API
-#include <nsString.h>
-#include <nscore.h>
+#define FIREFOX_1_5
+#include "mozembed-config.h"
+#include "mozembed.h"
+#include <nsComponentManagerUtils.h>
+//#define MOZILLA_INTERNAL_API
 #include <nsIServiceManager.h>
-#undef MOZILLA_INTERNAL_API
-
-#include <nsVoidArray.h>
+//#include <nsVoidArray.h>
+//#undef MOZILLA_INTERNAL_API
+#include <nsEmbedString.h>
 #include <nsCOMPtr.h>
 #include <nsIWebNavigation.h>
 #include <nsISHistory.h>
+#include <nsEmbedAPI.h>
+
 // for our one function that gets the EmbedPrivate via the chrome
 // object.
 #include <nsIWebBrowserChrome.h>
@@ -35,10 +37,11 @@
 #include <nsIGenericFactory.h>
 #include <nsIComponentRegistrar.h>
 
-#include "mozembed.h"
+#include <vector>
+using namespace std;
 
-#ifndef _EmbedPrivate_h_
-#define _EmbedPrivate_h_
+#ifndef __EmbedPrivate_h
+#define __EmbedPrivate_h
 
 class EmbedProgress;
 class EmbedWindow;
@@ -60,96 +63,107 @@
   EmbedPrivate();
   ~EmbedPrivate();
 
-  nsresult    Init             (Handle *aOwningWidget);
-  nsresult Realize             ();
-  void Unrealize                       (void);
-  void Show                            (void);
-  void Hide                            (void);
-  void Resize                          (PRUint32 aWidth, PRUint32 aHeight);
-  void Destroy                         (void);
-  void SetURI                          (const char *aURI);
-  void LoadCurrentURI                  (void);
-  void Reload                          (PRUint32 reloadFlags);
+  nsresult Init                        (Handle *aOwningWidget);
+  nsresult Realize                     (void);
+  void Unrealize                               (void);
+  void Show                                    (void);
+  void Hide                                    (void);
+  void Resize                                  (PRUint32 aWidth, PRUint32 
aHeight);
+  void Destroy                                 (void);
+  void SetURI                                  (const char *aURI);
+  void LoadCurrentURI                          (void);
+  void Reload                                  (PRUint32 reloadFlags);
         
-  void SetChromeMask                   (PRUint32 chromeMask);
-  void ApplyChromeMask                 (void);
+  void SetChromeMask                           (PRUint32 chromeMask);
+  void ApplyChromeMask                         (void);
   
     
   // CALLBACKS TO MANAGED CODE
-  void QueryControlSize                (void);
-  void EventJSStatus           (void);
-  void EventLinkStatus         (void);  
-  void EventDestoryBrowser     (void);
-  void EventSizeTo             (PRInt32 aCX, PRInt32 aCY);
-  void EventFocusNext          (void);
-  void EventFocusPrev          (void);
-  void EventTitleChanged       (void);
+  void QueryControlSize                        (void);
+  void EventJSStatus                   (void);
+  void EventLinkStatus                 (void);  
+  void EventDestoryBrowser             (void);
+  void EventSizeTo                             (PRInt32 aCX, PRInt32 aCY);
+  void EventFocusNext                  (void);
+  void EventFocusPrev                  (void);
+  void EventTitleChanged               (void);
   void EventShowTooltipWindow  (PRInt32 aXCoords, PRInt32 aYCoords,
-                                const char *aTipText);
+                                                                               
                        const char *aTipText);
   void EventHideTooltipWindow  (void);
-  void EventStateNetStart      (void);
-  void EventStateNetStop       (void);
-  void EventStateSpecial       (PRUint32 aStateFlags, PRInt32 aStatus);
-  void EventStateChange                (const char *aUriString, PRUint32 
aStateFlags, PRInt32 aStatus);
-  void EventProgress           (PRInt32 aCurTotalProgress, PRInt32 
aMaxTotalProgress);
-  void EventProgressAll                (const char *aUriString, PRInt32 
aCurTotalProgress, PRInt32 aMaxTotalProgress);
-  void EventLocationChanged    (void);
-  void EventStatusChange       (PRInt32 aStatus, const char *aMessage);
-  void EventSecurityChange     (PRUint32 aState);
-  void EventVisibility                 (PRBool val);
+  void EventStateNetStart              (void);
+  void EventStateNetStop               (void);
+  void EventStateSpecial               (PRUint32 aStateFlags, PRInt32 aStatus);
+  void EventStateChange                        (const char *aUriString, 
PRUint32 aStateFlags, 
+                                                                               
                        PRInt32 aStatus);
+  void EventProgress                   (PRInt32 aCurTotalProgress, 
+                                                                               
                        PRInt32 aMaxTotalProgress);
+  void EventProgressAll                        (const char* aUriString, 
+                                                                               
                        PRInt32 aCurTotalProgress, 
+                                                                               
                        PRInt32 aMaxTotalProgress);
+  void EventLocationChanged            (void);
+  void EventStatusChange               (PRInt32 aStatus, const char *aMessage);
+  void EventSecurityChange             (PRUint32 aState);
+  void EventVisibility                         (PRBool val);
   
   //return true to abort/consume
-  PRBool EventDomKeyDown       (ModifierKeys aModKey, KeyInfo aKeyInfo);
-  PRBool EventDomKeyUp         (ModifierKeys aModKey, KeyInfo aKeyInfo);
-  PRBool EventDomKeyPress      (ModifierKeys aModKey, KeyInfo aKeyInfo);
-  PRBool EventMouseDown                (ModifierKeys aModKey, MouseInfo 
aMouseInfo);
-  PRBool EventMouseUp          (ModifierKeys aModKey, MouseInfo aMouseInfo);  
-  PRBool EventMouseClick       (ModifierKeys aModKey, MouseInfo aMouseInfo);
+  PRBool EventDomKeyDown               (ModifierKeys aModKey, KeyInfo 
aKeyInfo);
+  PRBool EventDomKeyUp                 (ModifierKeys aModKey, KeyInfo 
aKeyInfo);
+  PRBool EventDomKeyPress              (ModifierKeys aModKey, KeyInfo 
aKeyInfo);
+  PRBool EventMouseDown                        (ModifierKeys aModKey, 
MouseInfo aMouseInfo);
+  PRBool EventMouseUp                  (ModifierKeys aModKey, MouseInfo 
aMouseInfo);  
+  PRBool EventMouseClick               (ModifierKeys aModKey, MouseInfo 
aMouseInfo);
   PRBool EventMouseDoubleClick (ModifierKeys aModKey, MouseInfo aMouseInfo);  
-  PRBool EventMouseOver                (ModifierKeys aModKey, MouseInfo 
aMouseInfo);   
-  PRBool EventMouseOut         (ModifierKeys aModKey, MouseInfo aMouseInfo);  
-  PRBool EventActivate         (PRInt32 detail);
-  PRBool EventFocusIn          (PRInt32 detail);
-  PRBool EventFocusOut         (PRInt32 detail);
+  PRBool EventMouseOver                        (ModifierKeys aModKey, 
MouseInfo aMouseInfo);   
+  PRBool EventMouseOut                 (ModifierKeys aModKey, MouseInfo 
aMouseInfo);  
+  PRBool EventActivate                 (PRInt32 detail);
+  PRBool EventFocusIn                  (PRInt32 detail);
+  PRBool EventFocusOut                 (PRInt32 detail);
 
-  PRBool EventBeforeURIOpen    (const char *aURL);
-  
+  PRBool EventBeforeURIOpen            (const char *aURL);
 
   static void PushStartup      (void);
+  
   static void PopStartup       (void);
+  
   static void SetCompPath      (const char *aPath);
+  
   static void SetAppComponents         (const nsModuleComponentInfo* aComps,
-                                 int aNumComponents);
+                                                                               
  int aNumComponents);
+                                                                               
                                  
   static void SetProfilePath   (const char *aDir, const char *aName);
-  static void SetDirectoryServiceProvider (nsIDirectoryServiceProvider * 
appFileLocProvider);
   
+  static void SetDirectoryServiceProvider (nsIDirectoryServiceProvider* 
+                                                                               
                                  appFileLocProvider);
   
-  nsresult OpenStream          (const char *aBaseURI, const char 
*aContentType);
+  
+  nsresult OpenStream          (const char *aBaseURI, const char*
+                                                                               
                                  aContentType);
   nsresult AppendToStream      (const PRUint8 *aData, PRUint32 aLen);
-  nsresult CloseStream         (void);
+  nsresult CloseStream                 (void);
 
   // This function will find the specific EmbedPrivate object for a
   // given nsIWebBrowserChrome.
-  static EmbedPrivate *FindPrivateForBrowser(nsIWebBrowserChrome *aBrowser);
+  static EmbedPrivate                  
*FindPrivateForBrowser(nsIWebBrowserChrome
+                                                                               
                                  *aBrowser);
 
   // This is an upcall that will come from the progress listener
   // whenever there is a content state change.  We need this so we can
   // attach event listeners.
-  void        ContentStateChange    (void);
+  void                                         ContentStateChange    (void);
 
   // This is an upcall from the progress listener when content is
   // finished loading.  We have this so that if it's chrome content
   // that we can size to content properly and show ourselves if
   // visibility is set.
-  void        ContentFinishedLoading(void);
+  void                                         ContentFinishedLoading(void);
 
   // these are when the widget itself gets focus in and focus out
   // events
-  void        FocusIn (void);
-  void        FocusOut(void);
+  void                                         FocusIn (void);
+  void                                         FocusOut(void);
 
 #ifdef MOZ_ACCESSIBILITY_ATK
-  void *GetAtkObjectForCurrentDocument();
+  void                                                         
*GetAtkObjectForCurrentDocument();
 #endif
 
   Handle                        *mOwningWidget;
@@ -176,21 +190,19 @@
   nsCOMPtr<nsIDOMEventReceiver> mEventReceiver;
 
   // the currently loaded uri
-  nsString                      mURI;
+  nsEmbedString                 mURI;
   
-  PRUint32                     mHeight;
-  PRUint32                     mWidth;
+  PRUint32                                             mHeight;
+  PRUint32                                             mWidth;
   // the number of widgets that have been created
   static PRUint32               sWidgetCount;
   // the path to components
   static char                   *sCompPath;
   // the list of application-specific components to register
   static const nsModuleComponentInfo  *sAppComps;
-  static int                    sNumAppComps;
+  static PRInt32                 sNumAppComps;
   // the appshell we have created
   static nsIAppShell            *sAppShell;
-  // the list of all open windows
-  static nsVoidArray            *sWindowList;
   // what is our profile path?
   static char                   *sProfileDir;
   static char                   *sProfileName;
@@ -207,30 +219,30 @@
   // has the chrome finished loading?
   PRBool                        mChromeLoaded;
   // saved window ID for reparenting later
-  Handle                       *mMozWindow;
+  Handle                               *mMozWindow;
   // has someone called Destroy() on us?
   PRBool                        mIsDestroyed;
 
-  CallbackBin                  *events;
+  CallbackBin                                  *events;
  private:
 
   // is the chrome listener attached yet?
   PRBool                        mListenersAttached;
 
-  void                 GetListener     (void);
-  void                 AttachListeners (void);
-  void                 DetachListeners (void);
+  void                 GetListener             (void);
+  void                 AttachListeners         (void);
+  void                 DetachListeners         (void);
 
   // this will get the PIDOMWindow for this widget
-  nsresult     GetPIDOMWindow  (nsPIDOMWindow **aPIWin);
+  nsresult     GetPIDOMWindow          (nsPIDOMWindow **aPIWin);
   
-  static       nsresult        StartupProfile (void);
-  static       void            ShutdownProfile(void);
+  static nsresult StartupProfile(void);
+  static void ShutdownProfile  (void);
 
-  static       nsresult        RegisterAppComponents();
+  static nsresult RegisterAppComponents();
 
 };
 
 
 
-#endif /*_EmbedPrivate_h_*/
+#endif /*__EmbedPrivate_h*/

Modified: trunk/mozembed/src/EmbedProgress.cpp
===================================================================
--- trunk/mozembed/src/EmbedProgress.cpp        2006-05-18 21:51:16 UTC (rev 
60843)
+++ trunk/mozembed/src/EmbedProgress.cpp        2006-05-18 22:39:01 UTC (rev 
60844)
@@ -12,10 +12,10 @@
  * Portions created by Christopher Blizzard are Copyright (C) Christopher 
Blizzard.  All Rights Reserved.
  */
 
-#define MOZILLA_INTERNAL_API
-#include <nsString.h>
-#include <nsXPIDLString.h>
-#undef MOZILLA_INTERNAL_API
+//#define MOZILLA_INTERNAL_API
+//#include <nsString.h>
+//#include <nsXPIDLString.h>
+//#undef MOZILLA_INTERNAL_API
 #include "EmbedProgress.h"
 
 #include <nsIChannel.h>
@@ -61,10 +61,10 @@
   }
 
   // get the uri for this request
-  nsXPIDLCString uriString;
+  nsEmbedCString uriString;
   RequestToURIString(aRequest, getter_Copies(uriString));
   nsString tmpString;
-  CopyUTF8toUTF16(uriString, tmpString);
+  tmpString = NS_ConvertUTF8toUTF16(uriString);
 
   // is it the same as the current URI?
   if (mOwner->mURI.Equals(tmpString))
@@ -72,7 +72,7 @@
     // for people who know what they are doing
     mOwner->EventStateSpecial((PRInt32)aStateFlags, (PRInt32)aStatus);
   }
-  mOwner->EventStateChange((const char *)uriString, (PRInt32)aStateFlags, 
(PRInt32)aStatus);
+  mOwner->EventStateChange((const char *)uriString.get(), 
(PRInt32)aStateFlags, (PRInt32)aStatus);
   // and for stop, too
   if ((aStateFlags & EMBED_FLAG_IS_NETWORK) && 
       (aStateFlags & EMBED_FLAG_STOP))
@@ -94,18 +94,19 @@
                                PRInt32         aMaxTotalProgress)
 {
 
-  nsXPIDLCString uriString;
+  nsEmbedCString uriString;
   RequestToURIString(aRequest, getter_Copies(uriString));
   
   nsString tmpString;
-  CopyUTF8toUTF16(uriString, tmpString);
+  tmpString = NS_ConvertUTF8toUTF16(uriString);
+  //CopyUTF8toUTF16(uriString, tmpString);
 
   // is it the same as the current uri?
   if (mOwner->mURI.Equals(tmpString)) {
     mOwner->EventProgress(aCurTotalProgress, aMaxTotalProgress);
   }
 
-  mOwner->EventProgressAll((const char *)uriString, aCurTotalProgress, 
aMaxTotalProgress);
+  mOwner->EventProgressAll((const char *)uriString.get(), aCurTotalProgress, 
aMaxTotalProgress);
   return NS_OK;
 }
 
@@ -114,7 +115,7 @@
                                nsIRequest     *aRequest,
                                nsIURI         *aLocation)
 {
-  nsCAutoString newURI;
+  nsEmbedCString newURI;
   NS_ENSURE_ARG_POINTER(aLocation);
   aLocation->GetSpec(newURI);
 
@@ -183,7 +184,7 @@
   if (!uri)
     return;
   
-  nsCAutoString uriString;
+  nsEmbedCString uriString;
   uri->GetSpec(uriString);
 
   *aString = strdup(uriString.get());

Modified: trunk/mozembed/src/EmbedWindow.cpp
===================================================================
--- trunk/mozembed/src/EmbedWindow.cpp  2006-05-18 21:51:16 UTC (rev 60843)
+++ trunk/mozembed/src/EmbedWindow.cpp  2006-05-18 22:39:01 UTC (rev 60844)
@@ -15,13 +15,14 @@
 
 #include <nsCWebBrowser.h>
 #include <nsIDocShellTreeItem.h>
+//#include <nsIComponentManager.h>
 #include <nsIWidget.h>
-
-#define MOZILLA_INTERNAL_API
+#include <nsMemory.h>
+//#define MOZILLA_INTERNAL_API
 #include <nscore.h>
 #include <nsIComponentManager.h>
-#include <nsReadableUtils.h>
-#undef MOZILLA_INTERNAL_API
+//#include <nsReadableUtils.h>
+//#undef MOZILLA_INTERNAL_API
 #include "EmbedWindow.h"
 #include "EmbedPrivate.h"
 //include "EmbedPrompter.h"
@@ -286,7 +287,8 @@
 NS_IMETHODIMP
 EmbedWindow::GetTitle(PRUnichar **aTitle)
 {
-  *aTitle = ToNewUnicode(mTitle);
+  NS_StringSetData(mTitle,(const PRUnichar *)&aTitle);
+  // = NS_ConvertUTF16toUTF8(NS_CStringToUTF16(mTitle));
   return NS_OK;
 }
 
@@ -338,10 +340,11 @@
 EmbedWindow::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords,
                           const PRUnichar *aTipText)
 {
-  nsAutoString tipText ( aTipText );
-
-  const char* tipString = ToNewCString(tipText);
-
+  //ACString tipText ( aTipText );
+  nsEmbedCString sText = NS_LossyConvertUTF16toASCII(aTipText);
+  
+  const char* tipString = sText.get(); 
+  
   mOwner->EventShowTooltipWindow(aXCoords, aYCoords, tipString);
     
   nsMemory::Free( (void*)tipString );

Modified: trunk/mozembed/src/EmbedWindowCreator.h
===================================================================
--- trunk/mozembed/src/EmbedWindowCreator.h     2006-05-18 21:51:16 UTC (rev 
60843)
+++ trunk/mozembed/src/EmbedWindowCreator.h     2006-05-18 22:39:01 UTC (rev 
60844)
@@ -12,11 +12,11 @@
  * Portions created by Christopher Blizzard are Copyright (C) Christopher 
Blizzard.  All Rights Reserved.
  */
 
+#include <nsIWindowCreator.h>
+
 #ifndef __EmbedWindowCreator_h
 #define __EmbedWindowCreator_h
 
-#include <nsIWindowCreator.h>
-
 class EmbedWindowCreator : public nsIWindowCreator
 {
  public:

Modified: trunk/mozembed/src/Makefile.am
===================================================================
--- trunk/mozembed/src/Makefile.am      2006-05-18 21:51:16 UTC (rev 60843)
+++ trunk/mozembed/src/Makefile.am      2006-05-18 22:39:01 UTC (rev 60844)
@@ -6,14 +6,14 @@
        EmbedPrivate.cpp \
        EmbedWindowCreator.cpp \
        EmbedWindow.cpp \
-    EmbedContentListener.cpp \
+       EmbedContentListener.cpp \
        EmbedProgress.cpp \
        EmbedEventListener.cpp \
        EmbedStream.cpp 
 
 libmozembedcliincdir = $(includedir)/libmozembedcli-0/mozembed
 libmozembedcliinc_HEADERS = \
-    mozembed.h \
+       mozembed.h \
        embedutils.h 
        
 noinst_HEADERS = \
@@ -28,12 +28,17 @@
 EXTRA_DIST = \
     mozembed-config.h.in
 
-AM_CPPFLAGS = \
+AM_CPPFLAGS = -fno-exceptions -fno-rtti \
     -I$(top_srcdir)    \
     -I../      \
     $(MOZILLA_CFLAGS) 
 
 libmozembedcli_la_LIBADD = \
-    $(MOZILLA_LIBS)            
+       $(MOZILLA_LIBS) \
+       -lnspr4 \
+       -lxpcomglue \
+       -lplds4 \
+       -lplc4 \
+       -lembed_base_s 
 
-libmozembedcli_la_LDFLAGS = -version-info 0:0:0 -export-dynamic
+libmozembedcli_la_LDFLAGS = -version-info 0:0:0 -export-dynamic -fno-rtti 
-fno-exceptions

Modified: trunk/mozembed/src/embedutils.cpp
===================================================================
--- trunk/mozembed/src/embedutils.cpp   2006-05-18 21:51:16 UTC (rev 60843)
+++ trunk/mozembed/src/embedutils.cpp   2006-05-18 22:39:01 UTC (rev 60844)
@@ -12,13 +12,16 @@
  * Portions created by Christopher Blizzard are Copyright (C) Christopher 
Blizzard.  All Rights Reserved.
  */
 
+#define MOZILLA_INTERNAL_API
+#include <nscore.h>
+#include <nsXPCOM.h>
+#undef MOZILLA_INTERNAL_API
 
 #include <nsIServiceManager.h>
 #include <nsIComponentManager.h>
 #include <nsIComponentRegistrar.h>
-#include <nsIAppStartupNotifier.h>
-#include <nsIStringBundle.h>
-
+//#include <nsIAppStartupNotifier.h>
+//#include <nsIStringBundle.h>
 #include <nsIDirectoryService.h>
 #include <nsDirectoryServiceDefs.h>
 #include <nsXPCOM.h>
@@ -28,13 +31,9 @@
 #define INLINEBUILD
 
 static nsIServiceManager *sServiceManager = nsnull;
-static PRBool             sRegistryInitializedFlag = PR_FALSE;
+static PRUint32           sRegistryInitialized = PR_FALSE;
 static PRUint32           sInitCounter = 0;
 
-
-
-
-
 nsresult
 mozembed_util_InitEmbedding(nsILocalFile *mozBinDirectory,
                  nsIDirectoryServiceProvider *appFileLocProvider,
@@ -54,17 +53,20 @@
     sInitCounter++;
     if (sInitCounter > 1)
         return NS_OK;
-
+    else
+    {
       // Initialise XPCOM
       // Initialise XPCOM
       rv = NS_InitXPCOM3(&sServiceManager, mozBinDirectory, appFileLocProvider,
                        aStaticComponents, aStaticComponentCount);
-      NS_ENSURE_SUCCESS(rv, rv);
+      //NS _ENSURE_SUCCESS(rv, rv);
                 
     }
+    
     // Register components
-    if (!sRegistryInitializedFlag)
+    if (! (sRegistryInitialized == PR_TRUE))
     {
+
 #ifdef DEBUG
         nsIComponentRegistrar *registrar;
         rv = sServiceManager->QueryInterface(NS_GET_IID(nsIComponentRegistrar),
@@ -108,7 +110,7 @@
         if (NS_FAILED(rv))
             return rv;
 #endif
-        sRegistryInitializedFlag = PR_TRUE;
+        sRegistryInitialized = PR_TRUE;
     }
 
     nsIComponentManager *compMgr;
@@ -137,7 +139,7 @@
 mozembed_util_TermEmbedding()
 {
 #ifdef INLINEBUILD
-    NS_TermEmbedding()
+    NS_TermEmbedding();
 #else
     // Reentrant calls to this method do nothing except decrement a counter
     if (sInitCounter > 1)

Modified: trunk/mozembed/src/embedutils.h
===================================================================
--- trunk/mozembed/src/embedutils.h     2006-05-18 21:51:16 UTC (rev 60843)
+++ trunk/mozembed/src/embedutils.h     2006-05-18 22:39:01 UTC (rev 60844)
@@ -16,14 +16,16 @@
 //Functions for wrapping native embedding functions when compiled against 
debug/exposed embedding api
 //Or to try and provide our own ourself. 
 
-#ifndef EMBEDUTILS_H
-#define EMBEDUTILS_H
 
 #include <nscore.h>
 #include <nsXPCOM.h>
 #include <nsILocalFile.h>
 #include <nsIDirectoryService.h>
 
+#ifndef __EMBEDUTILS_H
+#define __EMBEDUTILS_H
+
+
 nsresult
 mozembed_util_InitEmbedding    (nsILocalFile *aMozBinDirectory,
                                 nsIDirectoryServiceProvider 
*aAppFileLocProvider,

Modified: trunk/mozembed/src/mozembed-config.h.in
===================================================================
--- trunk/mozembed/src/mozembed-config.h.in     2006-05-18 21:51:16 UTC (rev 
60843)
+++ trunk/mozembed/src/mozembed-config.h.in     2006-05-18 22:39:01 UTC (rev 
60844)
@@ -9,18 +9,25 @@
 * Portions Copyright (C) Zac Bowling 2006. All Rights Reserved.
 *  
 */
-
+#define XPCOM_GLUE 1
+#define MOZILLA_STRICT_API 1
+#include <nspr.h>
+#include <nscore.h>
 #ifndef __MOZEMBED_CONFIG_H__
 #define __MOZEMBED_CONFIG_H__
 
+
 #define @GTKMOZEMBED_VERSION@
 
-#ifdef GTKMOZEMBED_VERSION_1_0
-#include "nsString.h"
-#define nsEmbedString nsAutoString
-#elif defined GTKMOZEMBED_VERSION_1_1
+//#ifdef GTKMOZEMBED_VERSION_1_0
+//#define MOZILLA_INTERNAL_API
+//#include "nsString.h"
+#include "nsEmbedString.h"
+//#define nsEmbedString nsAutoString
+//#undef MOZILLA_INTERNAL_API
+//#elif defined GTKMOZEMBED_VERSION_1_1
 #include "nsStringAPI.h"
-#include "nsEmbedString.h"
-#endif
 
+//#endif
+
 #endif /* __MOZEMBED_CONFIG_H__ */

Modified: trunk/mozembed/src/mozembed.cpp
===================================================================
--- trunk/mozembed/src/mozembed.cpp     2006-05-18 21:51:16 UTC (rev 60843)
+++ trunk/mozembed/src/mozembed.cpp     2006-05-18 22:39:01 UTC (rev 60844)
@@ -14,7 +14,7 @@
 
 #include "mozembed.h"
 #include "EmbedPrivate.h"
-#include "EmbedWindow.h"
+//#include "EmbedWindow.h"
 
 // so we can do our get_nsIWebBrowser later...
 #include <nsIWebBrowser.h>

Modified: trunk/mozembed/src/mozembed.h
===================================================================
--- trunk/mozembed/src/mozembed.h       2006-05-18 21:51:16 UTC (rev 60843)
+++ trunk/mozembed/src/mozembed.h       2006-05-18 22:39:01 UTC (rev 60844)
@@ -10,13 +10,13 @@
 *  
 */
 
-#include "mozembed-config.h"
-#include <nspr.h>
-#define NS_EXPORT(s) s
-
 #ifndef __MOZEMBED_H
 #define __MOZEMBED_H
 
+#include "mozembed-config.h"
+
+#define MZ_EXPORT_(s) s
+
 #ifdef __cplusplus
 extern "C"
 {
@@ -32,63 +32,63 @@
 typedef struct _CallbackBin CallbackBin;
 
 // Static Functions
-NS_EXPORT_(void) mozembed_set_profile_path (const char* aDir, const char* 
aName);
-NS_EXPORT_(void) mozembed_set_comp_path (const char* aPath);
+MZ_EXPORT_(void) mozembed_set_profile_path (const char* aDir, const char* 
aName);
+MZ_EXPORT_(void) mozembed_set_comp_path (const char* aPath);
 
 // Create/Init/Destory
-NS_EXPORT_(Handle*) mozembed_create (CallbackBin *events);
-NS_EXPORT_(void) mozembed_init (Handle *control, Handle *nativeWindow);
-NS_EXPORT_(void) mozembed_destroy (Handle *control);
+MZ_EXPORT_(Handle*) mozembed_create (CallbackBin *events);
+MZ_EXPORT_(void) mozembed_init (Handle *control, Handle *nativeWindow);
+MZ_EXPORT_(void) mozembed_destroy (Handle *control);
 
-NS_EXPORT_(void) mozembed_set_chrome_mask (Handle *control, PRUint32 
chromeMask);
-NS_EXPORT_(void) mozembed_apply_chrome_mask (Handle *control);
+MZ_EXPORT_(void) mozembed_set_chrome_mask (Handle *control, PRUint32 
chromeMask);
+MZ_EXPORT_(void) mozembed_apply_chrome_mask (Handle *control);
 
 // Visablity/Focus/Size
-NS_EXPORT_(void) mozembed_show (Handle *control);
-NS_EXPORT_(void) mozembed_hide (Handle *control);
-NS_EXPORT_(void) mozembed_resize (Handle *control, PRUint32 aWidth, PRUint32 
aHeight);
-NS_EXPORT_(SizeInfo) mozembed_get_size (Handle *control);
-NS_EXPORT_(void) mozembed_blur (Handle *control);
+MZ_EXPORT_(void) mozembed_show (Handle *control);
+MZ_EXPORT_(void) mozembed_hide (Handle *control);
+MZ_EXPORT_(void) mozembed_resize (Handle *control, PRUint32 aWidth, PRUint32 
aHeight);
+MZ_EXPORT_(SizeInfo) mozembed_get_size (Handle *control);
+MZ_EXPORT_(void) mozembed_blur (Handle *control);
 
 // Browser Actions
-NS_EXPORT_(void) mozembed_back (Handle *control);
-NS_EXPORT_(void) mozembed_forward (Handle *control);
-NS_EXPORT_(void) mozembed_reload (Handle *control, PRInt32 flags);
+MZ_EXPORT_(void) mozembed_back (Handle *control);
+MZ_EXPORT_(void) mozembed_forward (Handle *control);
+MZ_EXPORT_(void) mozembed_reload (Handle *control, PRInt32 flags);
 
 // Location
-NS_EXPORT_(void) mozembed_get_uri (Handle *control, char* aURI);
-NS_EXPORT_(void) mozembed_set_uri (Handle *control, const char* aURI);
-NS_EXPORT_(void) mozembed_load_current_uri (Handle *control);
+MZ_EXPORT_(void) mozembed_get_uri (Handle *control, char* aURI);
+MZ_EXPORT_(void) mozembed_set_uri (Handle *control, const char* aURI);
+MZ_EXPORT_(void) mozembed_load_current_uri (Handle *control);
 
 // Messages/Status Text
-NS_EXPORT_(void) mozembed_get_link_message (Handle *control, char* message);
-NS_EXPORT_(void) mozembed_get_u_link_message (Handle *control, PRUnichar 
*message);
-NS_EXPORT_(void) mozembed_get_js_status (Handle *control, char *status);
-NS_EXPORT_(void) mozembed_get_u_js_status (Handle *control, PRUnichar *status);
-NS_EXPORT_(void) mozembed_get_title (Handle *control, char* title);
-NS_EXPORT_(void) mozembed_get_u_title (Handle *control, PRUnichar *title);
+MZ_EXPORT_(void) mozembed_get_link_message (Handle *control, char* message);
+MZ_EXPORT_(void) mozembed_get_u_link_message (Handle *control, PRUnichar 
*message);
+MZ_EXPORT_(void) mozembed_get_js_status (Handle *control, char *status);
+MZ_EXPORT_(void) mozembed_get_u_js_status (Handle *control, PRUnichar *status);
+MZ_EXPORT_(void) mozembed_get_title (Handle *control, char* title);
+MZ_EXPORT_(void) mozembed_get_u_title (Handle *control, PRUnichar *title);
 
 // Conditions
-NS_EXPORT_(PRBool) mozembed_can_go_back (Handle *control);
-NS_EXPORT_(PRBool) mozembed_can_go_forward (Handle *control);
+MZ_EXPORT_(PRBool) mozembed_can_go_back (Handle *control);
+MZ_EXPORT_(PRBool) mozembed_can_go_forward (Handle *control);
 
 // Data/Stream
-NS_EXPORT_(void) mozembed_render_data (Handle *control, const char* data, 
+MZ_EXPORT_(void) mozembed_render_data (Handle *control, const char* data, 
                         PRUint32 len, const char* base_uri, 
                         const char* mime_type);
-NS_EXPORT_(void) mozembed_open_stream (Handle *control, const char* aBaseURI, 
+MZ_EXPORT_(void) mozembed_open_stream (Handle *control, const char* aBaseURI, 
                         const char* aContentType);
-NS_EXPORT_(void) mozembed_append_stream (Handle *control, const char* aData, 
+MZ_EXPORT_(void) mozembed_append_stream (Handle *control, const char* aData, 
                         PRUint32 aLen);
-NS_EXPORT_(void) mozembed_close_stream (Handle *control);
+MZ_EXPORT_(void) mozembed_close_stream (Handle *control);
 
 // Special Options
-NS_EXPORT_(void) mozembed_set_allow_frames (Handle *control, PRBool val);
-NS_EXPORT_(void) mozembed_set_allow_images (Handle *control, PRBool val);
-NS_EXPORT_(void) mozembed_set_allow_meta_redirects (Handle *control, PRBool 
val);
-NS_EXPORT_(void) mozembed_set_allow_javascript (Handle *control, PRBool val);
-NS_EXPORT_(void) mozembed_set_allow_plugins (Handle *control, PRBool val);
-NS_EXPORT_(void) mozembed_use_global_history (Handle *control, PRBool val);
+MZ_EXPORT_(void) mozembed_set_allow_frames (Handle *control, PRBool val);
+MZ_EXPORT_(void) mozembed_set_allow_images (Handle *control, PRBool val);
+MZ_EXPORT_(void) mozembed_set_allow_meta_redirects (Handle *control, PRBool 
val);
+MZ_EXPORT_(void) mozembed_set_allow_javascript (Handle *control, PRBool val);
+MZ_EXPORT_(void) mozembed_set_allow_plugins (Handle *control, PRBool val);
+MZ_EXPORT_(void) mozembed_use_global_history (Handle *control, PRBool val);
 
 
 typedef enum

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

Reply via email to