diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2006-05-11 02:07:03 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2006-05-11 02:07:03 +0800 |
commit | 24b71aa8ac7de8dd140092705bb7cc439f6b3309 (patch) | |
tree | 65631a3c5c3b28414788e1f9ef060962b95de9a1 /embed | |
parent | c3a7867c638dd105405fa2078b2de828a318b909 (diff) | |
download | gsoc2013-epiphany-24b71aa8ac7de8dd140092705bb7cc439f6b3309.tar gsoc2013-epiphany-24b71aa8ac7de8dd140092705bb7cc439f6b3309.tar.gz gsoc2013-epiphany-24b71aa8ac7de8dd140092705bb7cc439f6b3309.tar.bz2 gsoc2013-epiphany-24b71aa8ac7de8dd140092705bb7cc439f6b3309.tar.lz gsoc2013-epiphany-24b71aa8ac7de8dd140092705bb7cc439f6b3309.tar.xz gsoc2013-epiphany-24b71aa8ac7de8dd140092705bb7cc439f6b3309.tar.zst gsoc2013-epiphany-24b71aa8ac7de8dd140092705bb7cc439f6b3309.zip |
Drop support for gecko 1.7.
2006-05-10 Christian Persch <chpe@cvs.gnome.org>
* configure.ac:
* data/glade/prefs-dialog.glade:
* embed/ephy-favicon-cache.c: (ephy_favicon_cache_get):
* embed/mozilla/AutoJSContextStack.cpp:
* embed/mozilla/ContentHandler.cpp:
* embed/mozilla/ContentHandler.h:
* embed/mozilla/EphyAboutModule.cpp:
* embed/mozilla/EphyAboutModule.h:
* embed/mozilla/EphyBrowser.cpp:
* embed/mozilla/EphyBrowser.h:
* embed/mozilla/EphyContentPolicy.cpp:
* embed/mozilla/EphyContentPolicy.h:
* embed/mozilla/EphyDirectoryProvider.cpp:
* embed/mozilla/EphyFind.cpp:
* embed/mozilla/EphyFind.h:
* embed/mozilla/EphyHeaderSniffer.cpp:
* embed/mozilla/EphyHeaderSniffer.h:
* embed/mozilla/EphyHistoryListener.cpp:
* embed/mozilla/EphyHistoryListener.h:
* embed/mozilla/EphyPromptService.cpp:
* embed/mozilla/EphySidebar.cpp:
* embed/mozilla/EphySidebar.h:
* embed/mozilla/EphySingle.cpp:
* embed/mozilla/EphySingle.h:
* embed/mozilla/EphyUtils.cpp:
* embed/mozilla/EphyUtils.h:
* embed/mozilla/EventContext.cpp:
* embed/mozilla/EventContext.h:
* embed/mozilla/FilePicker.cpp:
* embed/mozilla/FilePicker.h:
* embed/mozilla/GlobalHistory.cpp:
* embed/mozilla/GlobalHistory.h:
* embed/mozilla/GtkNSSClientAuthDialogs.cpp:
* embed/mozilla/GtkNSSDialogs.cpp:
* embed/mozilla/GtkNSSKeyPairDialogs.cpp:
* embed/mozilla/GtkNSSSecurityWarningDialogs.cpp:
* embed/mozilla/GtkNSSSecurityWarningDialogs.h:
* embed/mozilla/Makefile.am:
* embed/mozilla/MozDownload.cpp:
* embed/mozilla/MozDownload.h:
* embed/mozilla/MozRegisterComponents.cpp:
* embed/mozilla/MozRegisterComponents.h:
* embed/mozilla/MozillaPrivate.cpp:
* embed/mozilla/MozillaPrivate.h:
* embed/mozilla/PrintingPromptService.cpp:
* embed/mozilla/PrintingPromptService.h:
* embed/mozilla/mozilla-download.cpp:
* embed/mozilla/mozilla-download.h:
* embed/mozilla/mozilla-embed-event.cpp:
* embed/mozilla/mozilla-embed-event.h:
* embed/mozilla/mozilla-embed-find.cpp:
* embed/mozilla/mozilla-embed-find.h:
* embed/mozilla/mozilla-embed-persist.cpp:
* embed/mozilla/mozilla-embed-persist.h:
* embed/mozilla/mozilla-embed-single.cpp:
* embed/mozilla/mozilla-embed.cpp:
* embed/mozilla/mozilla-embed.h:
* embed/mozilla/mozilla-notifiers.cpp:
* embed/mozilla/mozilla-notifiers.h:
* embed/mozilla/mozilla-x509-cert.cpp:
* embed/mozilla/mozilla-x509-cert.h:
* lib/ephy-gui.c:
* lib/ephy-gui.h:
* lib/ephy-langs.c:
* m4/gecko.m4:
* src/ephy-window.c: (sync_tab_security):
* src/prefs-dialog.c: (prefs_dialog_init):
Drop support for gecko 1.7.
Diffstat (limited to 'embed')
59 files changed, 1043 insertions, 2473 deletions
diff --git a/embed/ephy-favicon-cache.c b/embed/ephy-favicon-cache.c index 25cc0e11b..9c9e81bf2 100644 --- a/embed/ephy-favicon-cache.c +++ b/embed/ephy-favicon-cache.c @@ -596,12 +596,8 @@ ephy_favicon_cache_get (EphyFaviconCache *cache, if (url == NULL) return NULL; -#ifdef HAVE_GECKO_1_8 if (!g_str_has_prefix (url, "http://") && !g_str_has_prefix (url, "https://")) return NULL; -#else - if (!g_str_has_prefix (url, "http://")) return NULL; -#endif priv->requests += 1; diff --git a/embed/mozilla/AutoJSContextStack.cpp b/embed/mozilla/AutoJSContextStack.cpp index 6d61a30d5..ef9ba8f9e 100644 --- a/embed/mozilla/AutoJSContextStack.cpp +++ b/embed/mozilla/AutoJSContextStack.cpp @@ -21,9 +21,9 @@ #include "mozilla-config.h" #include "config.h" -#include "AutoJSContextStack.h" +#include <nsServiceManagerUtils.h> -#include <nsIServiceManager.h> +#include "AutoJSContextStack.h" AutoJSContextStack::~AutoJSContextStack() { diff --git a/embed/mozilla/ContentHandler.cpp b/embed/mozilla/ContentHandler.cpp index 6c3acd696..5d28268d6 100644 --- a/embed/mozilla/ContentHandler.cpp +++ b/embed/mozilla/ContentHandler.cpp @@ -22,93 +22,69 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "ContentHandler.h" -#include "AutoJSContextStack.h" - +#include <glib/gi18n.h> +#include <gtk/gtkbutton.h> #include <gtk/gtkdialog.h> -#include <gtk/gtkmessagedialog.h> -#include <gtk/gtkstock.h> #include <gtk/gtkimage.h> -#include <gtk/gtkbutton.h> #include <gtk/gtkmain.h> +#include <gtk/gtkmessagedialog.h> +#include <gtk/gtkstock.h> #include <libgnomevfs/gnome-vfs-mime.h> #include <libgnomevfs/gnome-vfs-utils.h> -#include <glib/gi18n.h> -#include <nsMemory.h> -#include <nsIURL.h> -#include <nsILocalFile.h> -#include <nsIMIMEInfo.h> -#include <nsIInterfaceRequestorUtils.h> +#include <nsStringAPI.h> + #include <nsCExternalHandlerService.h> +#include <nsComponentManagerUtils.h> #include <nsIDOMWindow.h> +#include <nsIInterfaceRequestorUtils.h> +#include <nsILocalFile.h> +#include <nsIMIMEInfo.h> +#include <nsIURL.h> +#include <nsMemory.h> #include <nsNetError.h> +#include <nsServiceManagerUtils.h> -#ifdef ALLOW_PRIVATE_API -#include <nsIServiceManager.h> -#endif - -#include "ephy-prefs.h" -#include "ephy-embed-single.h" +#include "eel-gconf-extensions.h" +#include "ephy-debug.h" #include "ephy-embed-shell.h" +#include "ephy-embed-single.h" #include "ephy-file-chooser.h" #include "ephy-file-helpers.h" -#include "ephy-stock-icons.h" #include "ephy-gui.h" -#include "ephy-debug.h" -#include "eel-gconf-extensions.h" +#include "ephy-prefs.h" +#include "ephy-stock-icons.h" -#include "MozDownload.h" #include "EphyUtils.h" +#include "MozDownload.h" + +#include "AutoJSContextStack.h" + +#include "ContentHandler.h" /* FIXME: we don't generally have a timestamp for the user action which initiated this * content handler. */ -#ifdef HAVE_GECKO_1_8 GContentHandler::GContentHandler() : mUserTime(0) { LOG ("GContentHandler ctor (%p)", this); } -#else -GContentHandler::GContentHandler() -: mMimeType(nsnull) -, mUserTime(0) -{ - LOG ("GContentHandler ctor (%p)", this); -} -#endif GContentHandler::~GContentHandler() { LOG ("GContentHandler dtor (%p)", this); - -#ifndef HAVE_GECKO_1_8 - if (mMimeType) - { - nsMemory::Free (mMimeType); - } -#endif } NS_IMPL_ISUPPORTS1(GContentHandler, nsIHelperAppLauncherDialog) -#ifdef HAVE_GECKO_1_8 /* void show (in nsIHelperAppLauncher aLauncher, in nsISupports aContext, in unsigned long aReason); */ NS_IMETHODIMP GContentHandler::Show (nsIHelperAppLauncher *aLauncher, nsISupports *aContext, PRUint32 aReason) -#else -/* void show (in nsIHelperAppLauncher aLauncher, in nsISupports aContext); */ -NS_IMETHODIMP -GContentHandler::Show (nsIHelperAppLauncher *aLauncher, - nsISupports *aContext, - PRBool aForced) -#endif { nsresult rv; EphyEmbedSingle *single; @@ -122,13 +98,8 @@ GContentHandler::Show (nsIHelperAppLauncher *aLauncher, NS_ENSURE_SUCCESS (rv, rv); single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (embed_shell)); -#ifdef HAVE_GECKO_1_8 g_signal_emit_by_name (single, "handle_content", mMimeType.get(), mUrl.get(), &handled); -#else - g_signal_emit_by_name (single, "handle_content", mMimeType, - mUrl.get(), &handled); -#endif if (!handled) { @@ -136,11 +107,7 @@ GContentHandler::Show (nsIHelperAppLauncher *aLauncher, } else { -#ifdef HAVE_GECKO_1_8 mLauncher->Cancel (NS_BINDING_ABORTED); -#else - mLauncher->Cancel (); -#endif } return NS_OK; @@ -157,9 +124,9 @@ NS_IMETHODIMP GContentHandler::PromptForSaveToFile( EphyFileChooser *dialog; int response; char *filename = NULL; - nsEmbedCString defaultFile; + nsCString defaultFile; - NS_UTF16ToCString (nsEmbedString (aDefaultFile), + NS_UTF16ToCString (nsString (aDefaultFile), NS_CSTRING_ENCODING_UTF8, defaultFile); if (mAction != CONTENT_ACTION_SAVEAS) @@ -205,7 +172,7 @@ NS_IMETHODIMP GContentHandler::PromptForSaveToFile( nsCOMPtr <nsILocalFile> destFile (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID)); NS_ENSURE_TRUE (destFile, NS_ERROR_FAILURE); - destFile->InitWithNativePath (nsEmbedCString (filename)); + destFile->InitWithNativePath (nsCString (filename)); g_free (filename); NS_IF_ADDREF (*_retval = destFile); @@ -233,11 +200,7 @@ NS_METHOD GContentHandler::Init () mLauncher->GetMIMEInfo (getter_AddRefs(MIMEInfo)); NS_ENSURE_TRUE (MIMEInfo, NS_ERROR_FAILURE); -#ifdef HAVE_GECKO_1_8 rv = MIMEInfo->GetMIMEType (mMimeType); -#else - rv = MIMEInfo->GetMIMEType (&mMimeType); -#endif nsCOMPtr<nsIURI> uri; mLauncher->GetSource (getter_AddRefs(uri)); @@ -278,7 +241,7 @@ NS_METHOD GContentHandler::MIMEConfirmAction () GtkWidget *dialog, *button, *image; const char *action_label; const char *mime_description; - nsEmbedCString file_name; + nsCString file_name; nsCOMPtr<nsIDOMWindow> parentDOMWindow = do_GetInterface (mContext); GtkWindow *parentWindow = GTK_WINDOW (EphyUtils::FindGtkParent(parentDOMWindow)); @@ -287,11 +250,7 @@ NS_METHOD GContentHandler::MIMEConfirmAction () (mAction == CONTENT_ACTION_OPEN_TMP) ? GTK_STOCK_OPEN : EPHY_STOCK_DOWNLOAD; -#ifdef HAVE_GECKO_1_8 mime_description = gnome_vfs_mime_get_description (mMimeType.get()); -#else - mime_description = gnome_vfs_mime_get_description (mMimeType); -#endif if (mime_description == NULL) { /* Translators: The text before the "|" is context to help you decide on @@ -301,30 +260,11 @@ NS_METHOD GContentHandler::MIMEConfirmAction () /* We have one tiny, minor issue, the filename can be empty (""), is that severe enough to be completely fixed ? */ -#ifdef HAVE_GECKO_1_8 - { - nsEmbedString suggested; + nsString suggested; - mLauncher->GetSuggestedFileName (suggested); - NS_UTF16ToCString ( - suggested, - NS_CSTRING_ENCODING_UTF8, file_name); - } -#else - { - PRUnichar *suggested = nsnull; - - mLauncher->GetSuggestedFileName (&suggested); - if (suggested != nsnull) - { - NS_UTF16ToCString ( - nsEmbedString (suggested), - NS_CSTRING_ENCODING_UTF8, file_name); - - nsMemory::Free (suggested); - } - } -#endif + mLauncher->GetSuggestedFileName (suggested); + NS_UTF16ToCString (suggested, + NS_CSTRING_ENCODING_UTF8, file_name); if (mPermission != EPHY_MIME_PERMISSION_SAFE && mHelperApp) { @@ -413,13 +353,8 @@ NS_METHOD GContentHandler::MIMEInitiateAction (void) auto_downloads = eel_gconf_get_boolean (CONF_AUTO_DOWNLOADS); -#ifdef HAVE_GECKO_1_8 mHelperApp = gnome_vfs_mime_get_default_application (mMimeType.get()); mPermission = ephy_file_check_mime (mMimeType.get()); -#else - mHelperApp = gnome_vfs_mime_get_default_application (mMimeType); - mPermission = ephy_file_check_mime (mMimeType); -#endif /* HACK! Check that this 'helper application' isn't Epiphany itself, * see bug #310023. @@ -482,27 +417,19 @@ NS_METHOD GContentHandler::MIMEDoAction (void) char *info; info = g_strdup_printf ("gnome-default:%d:%s", gtk_get_current_event_time(), id); - nsEmbedString desc; - NS_CStringToUTF16 (nsEmbedCString (info), + nsString desc; + NS_CStringToUTF16 (nsCString (info), NS_CSTRING_ENCODING_UTF8, desc); g_free (info); /* HACK we use the application description to ask MozDownload to open the file when download is finished */ -#ifdef HAVE_GECKO_1_8 mimeInfo->SetApplicationDescription (desc); -#else - mimeInfo->SetApplicationDescription (desc.get()); -#endif } else { -#ifdef HAVE_GECKO_1_8 - mimeInfo->SetApplicationDescription (nsEmbedString ()); -#else - mimeInfo->SetApplicationDescription (nsnull); -#endif + mimeInfo->SetApplicationDescription (nsString ()); } if (mAction == CONTENT_ACTION_OPEN) @@ -515,11 +442,7 @@ NS_METHOD GContentHandler::MIMEDoAction (void) } else if (mAction == CONTENT_ACTION_NONE) { -#ifdef HAVE_GECKO_1_8 mLauncher->Cancel (NS_BINDING_ABORTED); -#else - mLauncher->Cancel (); -#endif } else { diff --git a/embed/mozilla/ContentHandler.h b/embed/mozilla/ContentHandler.h index 7498a80f0..6b30add9a 100644 --- a/embed/mozilla/ContentHandler.h +++ b/embed/mozilla/ContentHandler.h @@ -22,18 +22,15 @@ #ifndef CONTENT_HANDLER_H #define CONTENT_HANDLER_H -#include "ephy-file-helpers.h" - #include <libgnomevfs/gnome-vfs-mime-handlers.h> -#undef MOZILLA_INTERNAL_API -#include <nsEmbedString.h> -#define MOZILLA_INTERNAL_API 1 #include <nsCOMPtr.h> -#include <nsISupports.h> -#include <nsIURI.h> #include <nsIFile.h> #include <nsIHelperAppLauncherDialog.h> +#include <nsIURI.h> + +#include "ephy-file-helpers.h" + typedef enum { @@ -76,12 +73,8 @@ class GContentHandler : public nsIHelperAppLauncherDialog GnomeVFSMimeApplication *mHelperApp; EphyMimePermission mPermission; - nsEmbedCString mUrl; -#ifdef HAVE_GECKO_1_8 - nsEmbedCString mMimeType; -#else - char *mMimeType; -#endif + nsCString mUrl; + nsCString mMimeType; PRUint32 mUserTime; }; diff --git a/embed/mozilla/EphyAboutModule.cpp b/embed/mozilla/EphyAboutModule.cpp index 822c94f81..6a46b6707 100644 --- a/embed/mozilla/EphyAboutModule.cpp +++ b/embed/mozilla/EphyAboutModule.cpp @@ -22,35 +22,37 @@ */ #include "mozilla-config.h" - #include "config.h" +#include <string.h> + +#include <glib/gi18n.h> +#include <gtk/gtk.h> + +// we need nsEscape which depends on internal strings :((( +#define MOZILLA_INTERNAL_API 1 +#include <nsString.h> + +#include <nsAutoPtr.h> #include <nsCOMPtr.h> -#include <nsIIOService.h> -#include <nsIServiceManager.h> -#include <nsIURI.h> +#include <nsEscape.h> #include <nsIChannel.h> -#include <nsIOutputStream.h> -#include <nsIInputStream.h> -#include <nsIStorageStream.h> #include <nsIInputStreamChannel.h> +#include <nsIInputStream.h> +#include <nsIIOService.h> +#include <nsIOutputStream.h> #include <nsIScriptSecurityManager.h> +#include <nsIStorageStream.h> +#include <nsIURI.h> #include <nsNetCID.h> -#include <nsString.h> -#include <nsEscape.h> -#include <nsAutoPtr.h> #include <nsNetUtil.h> +#include <nsServiceManagerUtils.h> -#include <glib/gi18n.h> -#include <gtk/gtk.h> +#include "ephy-debug.h" -#include "EphyAboutModule.h" #include "EphyRedirectChannel.h" -#include "EphyUtils.h" -#include "ephy-debug.h" - -#include <string.h> +#include "EphyAboutModule.h" EphyAboutModule::EphyAboutModule() { @@ -74,12 +76,10 @@ EphyAboutModule::NewChannel(nsIURI *aURI, nsCAutoString path; aURI->GetPath (path); -#ifdef HAVE_GECKO_1_8 if (strncmp (path.get(), "neterror?", strlen ("neterror?")) == 0) { return CreateErrorPage (aURI, _retval); } -#endif if (strncmp (path.get (), "recover?", strlen ("recover?")) == 0) { @@ -103,16 +103,12 @@ EphyAboutModule::Redirect(const nsACString &aURL, *_retval = nsnull; nsresult rv; - nsCOMPtr<nsIIOService> ioService; - rv = EphyUtils::GetIOService (getter_AddRefs (ioService)); + nsCOMPtr<nsIURI> uri; + rv = NS_NewURI (getter_AddRefs (uri), aURL); NS_ENSURE_SUCCESS (rv, rv); nsCOMPtr<nsIChannel> tempChannel; - rv = ioService->NewChannel(aURL, nsnull, nsnull, getter_AddRefs(tempChannel)); - NS_ENSURE_SUCCESS (rv, rv); - - nsCOMPtr<nsIURI> uri; - rv = ioService->NewURI(aURL, nsnull, nsnull, getter_AddRefs(uri)); + rv = NS_NewChannel (getter_AddRefs (tempChannel), uri); NS_ENSURE_SUCCESS (rv, rv); tempChannel->SetOriginalURI (uri); @@ -185,7 +181,6 @@ EphyAboutModule::ParseURL(const char *aURL, return NS_OK; } -#ifdef HAVE_GECKO_1_8 nsresult EphyAboutModule::GetErrorMessage(nsIURI *aURI, const char *aError, @@ -467,7 +462,7 @@ EphyAboutModule::CreateErrorPage(nsIURI *aErrorURI, if (error.IsEmpty () || rawurl.IsEmpty () || url.IsEmpty()) return NS_ERROR_FAILURE; nsCOMPtr<nsIURI> uri; - rv = EphyUtils::NewURI(getter_AddRefs (uri), url, charset.get()); + rv = NS_NewURI (getter_AddRefs (uri), url, charset.get()); /* FIXME can uri be NULL if the original url was invalid? */ NS_ENSURE_SUCCESS (rv, rv); @@ -505,7 +500,6 @@ EphyAboutModule::CreateErrorPage(nsIURI *aErrorURI, return NS_OK; } -#endif /* HAVE_GECKO_1_8 */ nsresult EphyAboutModule::CreateRecoverPage(nsIURI *aRecoverURI, @@ -525,7 +519,7 @@ EphyAboutModule::CreateRecoverPage(nsIURI *aRecoverURI, if (rawurl.IsEmpty () || url.IsEmpty()) return NS_ERROR_FAILURE; nsCOMPtr<nsIURI> uri; - rv = EphyUtils::NewURI(getter_AddRefs (uri), url, charset.get()); + rv = NS_NewURI(getter_AddRefs (uri), url, charset.get()); NS_ENSURE_SUCCESS (rv, rv); char *secondary = g_strdup_printf diff --git a/embed/mozilla/EphyAboutModule.h b/embed/mozilla/EphyAboutModule.h index 409e2f65b..959fe4e7a 100644 --- a/embed/mozilla/EphyAboutModule.h +++ b/embed/mozilla/EphyAboutModule.h @@ -23,7 +23,6 @@ #ifndef EPHY_ABOUT_MODULE_H #define EPHY_ABOUT_MODULE_H -#include <nsError.h> #include <nsIAboutModule.h> /* a9aea13e-21de-4be8-a07e-a05f11658c55 */ @@ -31,10 +30,8 @@ { 0xa9aea13e, 0x21de, 0x4be8, \ { 0xa0, 0x7e, 0xa0, 0x5f, 0x11, 0x65, 0x8c, 0x55 } } -#ifdef HAVE_GECKO_1_8 #define EPHY_ABOUT_NETERROR_CONTRACTID NS_ABOUT_MODULE_CONTRACTID_PREFIX "neterror" #define EPHY_ABOUT_NETERROR_CLASSNAME "Epiphany about:neterror module" -#endif #define EPHY_ABOUT_EPIPHANY_CONTRACTID NS_ABOUT_MODULE_CONTRACTID_PREFIX "epiphany" #define EPHY_ABOUT_EPIPHANY_CLASSNAME "Epiphany about:epiphany module" @@ -58,10 +55,8 @@ class EphyAboutModule : public nsIAboutModule private: nsresult Redirect(const nsACString&, nsIChannel**); nsresult ParseURL(const char*, nsACString&, nsACString&, nsACString&, nsACString&, nsACString&); -#ifdef HAVE_GECKO_1_8 nsresult GetErrorMessage(nsIURI*, const char*, char**, char**, char**, char**, char**, char**); nsresult CreateErrorPage(nsIURI*, nsIChannel**); -#endif nsresult CreateRecoverPage(nsIURI*, nsIChannel**); nsresult WritePage(nsIURI*, nsIURI*, nsIURI*, const nsACString&, const char*, const char*, const char*, const char*, const char*, const char*, nsIChannel**); nsresult Write(nsIOutputStream*, const char*); diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp index 6be7da0d4..afcc2b175 100644 --- a/embed/mozilla/EphyBrowser.cpp +++ b/embed/mozilla/EphyBrowser.cpp @@ -20,109 +20,94 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "EphyBrowser.h" -#include "EphyUtils.h" -#include "EventContext.h" -#include "ephy-embed.h" -#include "ephy-string.h" -#include "ephy-zoom.h" -#include "ephy-debug.h" -#include "print-dialog.h" -#include "mozilla-embed.h" -#include "mozilla-embed-event.h" - -#include <gtkmozembed_internal.h> #include <unistd.h> -#include "nsIInterfaceRequestorUtils.h" -#include "nsIURI.h" -#include "nsISimpleEnumerator.h" - -#include "nsIContentViewer.h" -#include "nsIWebBrowserFocus.h" -#include "nsICommandManager.h" -#include "nsIWebBrowserPrint.h" -#include "nsIDocCharset.h" -#include "nsIDocShellTreeItem.h" -#include "nsIDocShellTreeNode.h" -#include "nsIDocShellTreeOwner.h" -#include "nsIWebPageDescriptor.h" -#include "nsISHistory.h" -#include "nsISHistoryInternal.h" -#include "nsISHEntry.h" -#include "nsIHistoryEntry.h" -#include "nsIDOMHTMLDocument.h" -#include "nsIDOMHTMLCollection.h" -#include "nsIDOMHTMLElement.h" -#include "nsIDOMHTMLFormElement.h" -#include "nsIDOMHTMLInputElement.h" -#include "nsIDOMHTMLTextAreaElement.h" -#include "nsIDOMDocument.h" -#include "nsIDOM3Document.h" -#include "nsIDOMEvent.h" -#include "nsIDOMKeyEvent.h" -#include "nsIDOMMouseEvent.h" -#include "nsIDOMNSEvent.h" -#include "nsIDOMEventTarget.h" -#include "nsIDOMNSEventTarget.h" -#include "nsIDOMPopupBlockedEvent.h" -#include "nsIDOMNode.h" -#include "nsIDOMElement.h" -#include "nsIDOMWindow2.h" -#include "nsIDOMDocumentView.h" -#include "nsIDOMAbstractView.h" -#undef MOZILLA_INTERNAL_API -#include "nsEmbedString.h" -#define MOZILLA_INTERNAL_API 1 -#include "nsMemory.h" -#include "nsIChannel.h" -#include "nsIScriptSecurityManager.h" -#include "nsIServiceManager.h" -#include "nsIInterfaceRequestor.h" -#include "nsIDOMHTMLDocument.h" -#include "nsIDOMXMLDocument.h" +#include <nsStringAPI.h> + +#include <gtkmozembed.h> +#include <gtkmozembed_internal.h> +#include <nsIChannel.h> +#include <nsICommandManager.h> +#include <nsIContentViewer.h> +#include <nsIDocCharset.h> +#include <nsIDocShellTreeItem.h> +#include <nsIDocShellTreeNode.h> +#include <nsIDocShellTreeOwner.h> +#include <nsIDOM3Document.h> +#include <nsIDOMAbstractView.h> +#include <nsIDOMAbstractView.h> +#include <nsIDOMCSSPrimitiveValue.h> #include <nsIDOMCSSStyleDeclaration.h> #include <nsIDOMCSSStyleDeclaration.h> -#include <nsIDOMCSSPrimitiveValue.h> #include <nsIDOMCSSValue.h> -#include <nsIDOMViewCSS.h> +#include <nsIDOMDocument.h> #include <nsIDOMDocumentView.h> -#include <nsIDOMAbstractView.h> +#include <nsIDOMDocumentView.h> +#include <nsIDOMElement.h> +#include <nsIDOMEvent.h> +#include <nsIDOMEventTarget.h> +#include <nsIDOMHTMLCollection.h> +#include <nsIDOMHTMLDocument.h> +#include <nsIDOMHTMLDocument.h> +#include <nsIDOMHTMLElement.h> +#include <nsIDOMHTMLFormElement.h> +#include <nsIDOMHTMLInputElement.h> +#include <nsIDOMHTMLTextAreaElement.h> +#include <nsIDOMKeyEvent.h> +#include <nsIDOMMouseEvent.h> +#include <nsIDOMNode.h> +#include <nsIDOMNSEvent.h> +#include <nsIDOMNSEventTarget.h> +#include <nsIDOMPopupBlockedEvent.h> +#include <nsIDOMViewCSS.h> +#include <nsIDOMWindow2.h> +#include <nsIDOMXMLDocument.h> +#include <nsIHistoryEntry.h> +#include <nsIInterfaceRequestor.h> +#include <nsIInterfaceRequestorUtils.h> +#include <nsIScriptSecurityManager.h> +#include <nsIServiceManager.h> +#include <nsISHEntry.h> +#include <nsISHistory.h> +#include <nsISHistoryInternal.h> +#include <nsISimpleEnumerator.h> +#include <nsIURI.h> +#include <nsIWebBrowserFocus.h> +#include <nsIWebBrowserPrint.h> +#include <nsIWebPageDescriptor.h> +#include <nsMemory.h> +#include <nsServiceManagerUtils.h> -#ifdef ALLOW_PRIVATE_API -#include "nsIImageDocument.h" -/* not frozen yet */ -#include "nsIContentPolicy.h" -/* will never be frozen */ -#include "nsIDocShell.h" -#include "nsIMarkupDocumentViewer.h" -#include <nsIDOMWindowInternal.h> #ifdef HAVE_MOZILLA_PSM -/* not sure about this one: */ -#include <nsITransportSecurityInfo.h> -/* these are in pipnss/, are they really private? */ +#include <nsICertificateDialogs.h> #include <nsISSLStatus.h> #include <nsISSLStatusProvider.h> +#include <nsITransportSecurityInfo.h> #include <nsIX509Cert.h> -#include <nsICertificateDialogs.h> #endif + +#ifdef ALLOW_PRIVATE_API +#include <nsIContentPolicy.h> +#include <nsIDocShell.h> +#include <nsIDOMWindowInternal.h> +#include <nsIImageDocument.h> +#include <nsIMarkupDocumentViewer.h> #endif -const static PRUnichar kDOMLinkAdded[] = { 'D', 'O', 'M', 'L', 'i', 'n', 'k', 'A', 'd', 'd', 'e', 'd', '\0' }; -const static PRUnichar kDOMContentLoaded[] = { 'D', 'O', 'M', 'C', 'o', 'n', 't', 'e', 'n', 't', 'L', 'o', 'a', 'd', 'e', 'd', '\0' }; -const static PRUnichar kContextMenu[] = { 'c', 'o', 'n', 't', 'e', 'x', 't', 'm', 'e', 'n', 'u', '\0' }; -const static PRUnichar kDOMMouseScroll[] = { 'D', 'O', 'M', 'M', 'o', 'u', 's', 'e', 'S', 'c', 'r', 'o', 'l', 'l', '\0' }; -const static PRUnichar kDOMPopupBlocked[] = { 'D', 'O', 'M', 'P', 'o', 'p', 'u', 'p', 'B', 'l', 'o', 'c', 'k', 'e', 'd', '\0' }; -const static PRUnichar kDOMWillOpenModalDialog[] = { 'D', 'O', 'M', 'W', 'i', 'l', 'l', 'O', 'p', 'e', 'n', 'M', 'o', 'd', 'a', 'l', 'D', 'i', 'a', 'l', 'o', 'g', '\0' }; -const static PRUnichar kDOMModalDialogClosed[] = { 'D', 'O', 'M', 'M', 'o', 'd', 'a', 'l', 'D', 'i', 'a', 'l', 'o', 'g', 'C', 'l', 'o', 's', 'e', 'd', '\0' }; -const static PRUnichar kDOMWindowClose[] = { 'D', 'O', 'M', 'W', 'i', 'n', 'd', 'o', 'w', 'C', 'l', 'o', 's', 'e', '\0' }; -const static PRUnichar kHrefAttr[] = { 'h', 'r', 'e', 'f', '\0' }; -const static PRUnichar kTypeAttr[] = { 't', 'y', 'p', 'e', '\0' }; -const static PRUnichar kTitleAttr[] = { 't', 'i', 't', 'l', 'e', '\0' }; -const static PRUnichar kRelAttr[] = { 'r', 'e', 'l', '\0' }; +#include "ephy-debug.h" +#include "ephy-embed.h" +#include "ephy-string.h" +#include "ephy-zoom.h" +#include "mozilla-embed-event.h" +#include "mozilla-embed.h" +#include "print-dialog.h" + +#include "EphyUtils.h" +#include "EventContext.h" + +#include "EphyBrowser.h" NS_IMPL_ISUPPORTS1(EphyEventListener, nsIDOMEventListener) @@ -136,11 +121,11 @@ EphyDOMLinkEventListener::HandleEvent (nsIDOMEvent* aDOMEvent) if (!linkElement) return NS_ERROR_FAILURE; nsresult rv; - nsEmbedString value; - rv = linkElement->GetAttribute (nsEmbedString(kRelAttr), value); + nsString value; + rv = linkElement->GetAttribute (NS_LITERAL_STRING ("rel"), value); if (NS_FAILED (rv)) return NS_ERROR_FAILURE; - nsEmbedCString rel; + nsCString rel; NS_UTF16ToCString (value, NS_CSTRING_ENCODING_UTF8, rel); if (g_ascii_strcasecmp (rel.get(), "SHORTCUT ICON") == 0 || @@ -171,13 +156,13 @@ EphyDOMLinkEventListener::HandleEvent (nsIDOMEvent* aDOMEvent) rv = GetDocURI (linkElement, getter_AddRefs (docUri)); NS_ENSURE_TRUE (NS_SUCCEEDED (rv) && docUri, NS_ERROR_FAILURE); - rv = linkElement->GetAttribute (nsEmbedString (kHrefAttr), value); + rv = linkElement->GetAttribute (NS_LITERAL_STRING ("href"), value); if (NS_FAILED (rv) || !value.Length()) return NS_ERROR_FAILURE; - nsEmbedCString cLink; + nsCString cLink; NS_UTF16ToCString (value, NS_CSTRING_ENCODING_UTF8, cLink); - nsEmbedCString faviconUrl; + nsCString faviconUrl; rv = docUri->Resolve (cLink, faviconUrl); NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); @@ -186,15 +171,10 @@ EphyDOMLinkEventListener::HandleEvent (nsIDOMEvent* aDOMEvent) NS_ENSURE_TRUE (favUri, NS_ERROR_FAILURE); /* Only proceed for http favicons. Bug #312291 */ - PRBool isHttp = PR_FALSE; + PRBool isHttp = PR_FALSE, isHttps = PR_FALSE; favUri->SchemeIs ("http", &isHttp); -#ifdef HAVE_GECKO_1_8 - PRBool isHttps = PR_FALSE; favUri->SchemeIs ("https", &isHttps); if (!isHttp && !isHttps) return NS_OK; -#else - if (!isHttp) return NS_OK; -#endif /* check if load is allowed */ nsCOMPtr<nsIScriptSecurityManager> secMan @@ -213,10 +193,9 @@ EphyDOMLinkEventListener::HandleEvent (nsIDOMEvent* aDOMEvent) /* refuse if we can't check */ NS_ENSURE_TRUE (policy, NS_OK); -#if MOZ_NSICONTENTPOLICY_VARIANT == 2 - linkElement->GetAttribute (nsEmbedString (kTypeAttr), value); + linkElement->GetAttribute (NS_LITERAL_STRING ("type"), value); - nsEmbedCString cTypeVal; + nsCString cTypeVal; NS_UTF16ToCString (value, NS_CSTRING_ENCODING_UTF8, cTypeVal); PRInt16 decision = 0; @@ -226,22 +205,13 @@ EphyDOMLinkEventListener::HandleEvent (nsIDOMEvent* aDOMEvent) &decision); NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); if (decision != nsIContentPolicy::ACCEPT) return NS_OK; -#else - PRBool shouldLoad = PR_FALSE; - rv = policy->ShouldLoad (nsIContentPolicy::IMAGE, - favUri, eventTarget, - domWin, - &shouldLoad); - NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); - if (!shouldLoad) return NS_OK; -#endif /* Hide password part */ - nsEmbedCString user; + nsCString user; favUri->GetUsername (user); favUri->SetUserPass (user); - nsEmbedCString spec; + nsCString spec; favUri->GetSpec (spec); /* ok, we accept this as a valid favicon for this site */ @@ -249,18 +219,18 @@ EphyDOMLinkEventListener::HandleEvent (nsIDOMEvent* aDOMEvent) } else if (g_ascii_strcasecmp (rel.get (), "alternate") == 0) { - linkElement->GetAttribute (nsEmbedString (kTypeAttr), value); + linkElement->GetAttribute (NS_LITERAL_STRING ("type"), value); - nsEmbedCString cTypeVal; + nsCString cTypeVal; NS_UTF16ToCString (value, NS_CSTRING_ENCODING_UTF8, cTypeVal); if (g_ascii_strcasecmp (cTypeVal.get (), "application/rss+xml") == 0 || g_ascii_strcasecmp (cTypeVal.get (), "application/atom+xml") == 0) { - rv = linkElement->GetAttribute (nsEmbedString (kHrefAttr), value); + rv = linkElement->GetAttribute (NS_LITERAL_STRING ("href"), value); if (NS_FAILED (rv) || !value.Length()) return NS_ERROR_FAILURE; - nsEmbedCString cLink; + nsCString cLink; NS_UTF16ToCString (value, NS_CSTRING_ENCODING_UTF8, cLink); nsCOMPtr<nsIURI> docUri; @@ -268,17 +238,17 @@ EphyDOMLinkEventListener::HandleEvent (nsIDOMEvent* aDOMEvent) NS_ENSURE_TRUE (NS_SUCCEEDED (rv) && docUri, NS_ERROR_FAILURE); /* Hide password part */ - nsEmbedCString user; + nsCString user; docUri->GetUsername (user); docUri->SetUserPass (user); - nsEmbedCString resolvedLink; + nsCString resolvedLink; rv = docUri->Resolve (cLink, resolvedLink); NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); - linkElement->GetAttribute (nsEmbedString (kTitleAttr), value); + linkElement->GetAttribute (NS_LITERAL_STRING ("title"), value); - nsEmbedCString cTitle; + nsCString cTitle; NS_UTF16ToCString (value, NS_CSTRING_ENCODING_UTF8, cTitle); g_signal_emit_by_name (mOwner->mEmbed, "ge_feed_link", @@ -300,11 +270,11 @@ EphyMiscDOMEventsListener::HandleEvent (nsIDOMEvent* aDOMEvent) if (!isTrusted) return NS_OK; nsresult rv; - nsEmbedString type; + nsString type; rv = aDOMEvent->GetType (type); NS_ENSURE_SUCCESS (rv, rv); - nsEmbedCString cType; + nsCString cType; NS_UTF16ToCString (type, NS_CSTRING_ENCODING_UTF8, cType); if (g_ascii_strcasecmp (cType.get(), "DOMContentLoaded") == 0) @@ -338,11 +308,11 @@ EphyDOMLinkEventListener::GetDocURI (nsIDOMElement *aElement, NS_ENSURE_TRUE (doc, NS_ERROR_FAILURE); nsresult rv; - nsEmbedString spec; + nsString spec; rv = doc->GetDocumentURI (spec); NS_ENSURE_SUCCESS (rv, rv); - nsEmbedCString encoding; + nsCString encoding; rv = mOwner->GetEncoding (encoding); NS_ENSURE_SUCCESS (rv, rv); @@ -359,7 +329,7 @@ EphyPopupBlockEventListener::HandleEvent (nsIDOMEvent * aDOMEvent) nsCOMPtr<nsIURI> popupWindowURI; popupEvent->GetPopupWindowURI (getter_AddRefs (popupWindowURI)); - nsEmbedCString popupWindowURIString; + nsCString popupWindowURIString; nsresult rv; if (popupWindowURI) @@ -368,18 +338,18 @@ EphyPopupBlockEventListener::HandleEvent (nsIDOMEvent * aDOMEvent) NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); } - nsEmbedString popupWindowFeatures; + nsString popupWindowFeatures; rv = popupEvent->GetPopupWindowFeatures (popupWindowFeatures); NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); - nsEmbedCString popupWindowFeaturesString; + nsCString popupWindowFeaturesString; NS_UTF16ToCString (popupWindowFeatures, NS_CSTRING_ENCODING_UTF8, popupWindowFeaturesString); - nsEmbedCString popupWindowNameString; + nsCString popupWindowNameString; #ifdef HAVE_GECKO_1_9 - nsEmbedString popupWindowName; + nsString popupWindowName; rv = popupEvent->GetPopupWindowName (popupWindowName); NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); @@ -402,11 +372,11 @@ EphyModalAlertEventListener::HandleEvent (nsIDOMEvent * aDOMEvent) NS_ENSURE_TRUE (mOwner, NS_ERROR_FAILURE); nsresult rv; - nsEmbedString type; + nsString type; rv = aDOMEvent->GetType (type); NS_ENSURE_SUCCESS (rv, rv); - nsEmbedCString cType; + nsCString cType; NS_UTF16ToCString (type, NS_CSTRING_ENCODING_UTF8, cType); LOG ("ModalAlertListener event %s", cType.get()); @@ -606,54 +576,15 @@ nsresult EphyBrowser::Init (GtkMozEmbed *mozembed) NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); #ifdef HAVE_MOZILLA_PSM -#ifdef HAVE_GECKO_1_8 nsCOMPtr<nsIDocShell> docShell (do_GetInterface (mWebBrowser, &rv)); NS_ENSURE_SUCCESS (rv, rv); rv = docShell->GetSecurityUI (getter_AddRefs (mSecurityInfo)); - NS_ENSURE_SUCCESS (rv, rv); -#else - /* FIXME: mozilla sucks! nsWebBrowser already has an instance of this, - * but we cannot get to it! - * See https://bugzilla.mozilla.org/show_bug.cgi?id=94974 - */ - /* First try GI */ - mSecurityInfo = do_GetInterface (mWebBrowser); - /* Try to instantiate it under the re-registered contract ID */ - if (!mSecurityInfo) - { - /* This will cause all security warning dialogs to be shown - * twice (once by this instance, and another time by nsWebBrowser's - * instance of nsSecurityBrowserUIImpl), but there appears to be - * no other way :-( - */ - mSecurityInfo = do_CreateInstance("@gnome.org/project/epiphany/hacks/secure-browser-ui;1", &rv); - if (NS_SUCCEEDED (rv) && mSecurityInfo) - { - rv = mSecurityInfo->Init (mDOMWindow); - NS_ENSURE_SUCCESS (rv, rv); - } - } - /* Try the original contract ID */ - if (!mSecurityInfo) - { - /* This will cause all security warning dialogs to be shown - * twice (once by this instance, and another time by nsWebBrowser's - * instance of nsSecurityBrowserUIImpl), but there appears to be - * no other way :-( - */ - mSecurityInfo = do_CreateInstance(NS_SECURE_BROWSER_UI_CONTRACTID, &rv); - if (NS_SUCCEEDED (rv) && mSecurityInfo) - { - rv = mSecurityInfo->Init (mDOMWindow); - NS_ENSURE_SUCCESS (rv, rv); - } - } -#endif /* HAVE_GECKO_1_8 */ if (!mSecurityInfo) { g_warning ("Failed to get nsISecureBrowserUI!\n"); } + NS_ENSURE_SUCCESS (rv, rv); #endif /* HAVE_MOZILLA_PSM */ mInitialized = PR_TRUE; @@ -687,21 +618,21 @@ EphyBrowser::AttachListeners(void) nsCOMPtr<nsIDOMNSEventTarget> target (do_QueryInterface (mEventTarget, &rv)); NS_ENSURE_SUCCESS (rv, rv); - rv = target->AddEventListener(nsEmbedString(kDOMLinkAdded), + rv = target->AddEventListener(NS_LITERAL_STRING ("DOMLinkAdded"), mDOMLinkEventListener, PR_FALSE, PR_FALSE); - rv |= target->AddEventListener(nsEmbedString(kDOMContentLoaded), + rv |= target->AddEventListener(NS_LITERAL_STRING ("DOMContentLoaded"), mMiscDOMEventsListener, PR_FALSE, PR_FALSE); - rv |= target->AddEventListener(nsEmbedString(kDOMWindowClose), + rv |= target->AddEventListener(NS_LITERAL_STRING ("DOMWindowClose"), mMiscDOMEventsListener, PR_FALSE, PR_FALSE); - rv |= target->AddEventListener(nsEmbedString(kDOMMouseScroll), + rv |= target->AddEventListener(NS_LITERAL_STRING ("DOMMouseScroll"), mDOMScrollEventListener, PR_TRUE /* capture */, PR_FALSE); - rv |= target->AddEventListener(nsEmbedString(kDOMPopupBlocked), + rv |= target->AddEventListener(NS_LITERAL_STRING ("DOMPopupBlocked"), mPopupBlockEventListener, PR_FALSE, PR_FALSE); - rv |= target->AddEventListener(nsEmbedString(kDOMWillOpenModalDialog), + rv |= target->AddEventListener(NS_LITERAL_STRING ("DOMWillOpenModalDialog"), mModalAlertListener, PR_TRUE, PR_FALSE); - rv |= target->AddEventListener(nsEmbedString(kDOMModalDialogClosed), + rv |= target->AddEventListener(NS_LITERAL_STRING ("DOMModalDialogClosed"), mModalAlertListener, PR_TRUE, PR_FALSE); - rv |= target->AddEventListener(nsEmbedString(kContextMenu), + rv |= target->AddEventListener(NS_LITERAL_STRING ("contextmenu"), mContextMenuListener, PR_TRUE /* capture */, PR_FALSE); NS_ENSURE_SUCCESS (rv, rv); @@ -714,21 +645,21 @@ EphyBrowser::DetachListeners(void) if (!mEventTarget) return NS_OK; nsresult rv; - rv = mEventTarget->RemoveEventListener(nsEmbedString(kDOMLinkAdded), + rv = mEventTarget->RemoveEventListener(NS_LITERAL_STRING ("DOMLinkAdded"), mDOMLinkEventListener, PR_FALSE); - rv |= mEventTarget->RemoveEventListener(nsEmbedString(kDOMContentLoaded), + rv |= mEventTarget->RemoveEventListener(NS_LITERAL_STRING ("DOMContentLoaded"), mMiscDOMEventsListener, PR_FALSE); - rv |= mEventTarget->RemoveEventListener(nsEmbedString(kDOMWindowClose), + rv |= mEventTarget->RemoveEventListener(NS_LITERAL_STRING ("DOMWindowClose"), mMiscDOMEventsListener, PR_FALSE); - rv |= mEventTarget->RemoveEventListener(nsEmbedString(kDOMMouseScroll), + rv |= mEventTarget->RemoveEventListener(NS_LITERAL_STRING ("DOMMouseScroll"), mDOMScrollEventListener, PR_TRUE); /* capture */ - rv |= mEventTarget->RemoveEventListener(nsEmbedString(kDOMPopupBlocked), + rv |= mEventTarget->RemoveEventListener(NS_LITERAL_STRING ("DOMPopupBlocked"), mPopupBlockEventListener, PR_FALSE); - rv |= mEventTarget->RemoveEventListener(nsEmbedString(kDOMWillOpenModalDialog), + rv |= mEventTarget->RemoveEventListener(NS_LITERAL_STRING ("DOMWillOpenModalDialog"), mModalAlertListener, PR_TRUE); - rv |= mEventTarget->RemoveEventListener(nsEmbedString(kDOMModalDialogClosed), + rv |= mEventTarget->RemoveEventListener(NS_LITERAL_STRING ("DOMModalDialogClosed"), mModalAlertListener, PR_TRUE); - rv |= mEventTarget->RemoveEventListener(nsEmbedString(kContextMenu), + rv |= mEventTarget->RemoveEventListener(NS_LITERAL_STRING ("contextmenu"), mContextMenuListener, PR_TRUE /* capture */); NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); @@ -1145,7 +1076,7 @@ nsresult EphyBrowser::ForceEncoding (const char *encoding) nsCOMPtr<nsIMarkupDocumentViewer> mdv = do_QueryInterface(contentViewer); NS_ENSURE_TRUE (mdv, NS_ERROR_FAILURE); - return mdv->SetForceCharacterSet (nsEmbedCString(encoding)); + return mdv->SetForceCharacterSet (nsCString(encoding)); } nsresult EphyBrowser::GetEncoding (nsACString &encoding) @@ -1263,9 +1194,9 @@ nsresult EphyBrowser::GetDocumentHasModifiedForms (nsIDOMDocument *aDomDoc, PRUi const PRUnichar visibilityLiteral[] = { 'v', 'i', 's', 'i', 'b', 'i', 'l', 'i', 't', 'y', '\0' }; const PRUnichar visibleLiteral[] = { 'v', 'i', 's', 'i', 'b', 'l', 'e', '\0' }; - nsEmbedString visibilityAttr(visibilityLiteral); - nsEmbedString visibleAttr(visibleLiteral); - nsEmbedString EmptyString; + nsString visibilityAttr(visibilityLiteral); + nsString visibleAttr(visibleLiteral); + nsString EmptyString; nsCOMPtr<nsIDOMCSSStyleDeclaration> computedStyle; nsCOMPtr<nsIDOMCSSValue> cssValue; nsCOMPtr<nsIDOMCSSPrimitiveValue> primitiveValue; @@ -1296,7 +1227,7 @@ nsresult EphyBrowser::GetDocumentHasModifiedForms (nsIDOMDocument *aDomDoc, PRUi rv = computedStyle->GetPropertyCSSValue(visibilityAttr, getter_AddRefs (cssValue)); if (NS_SUCCEEDED (rv) && cssValue) { - nsEmbedString value; + nsString value; rv = cssValue->GetCssText (value); if (NS_SUCCEEDED (rv) && value.Length ()) { @@ -1340,7 +1271,7 @@ nsresult EphyBrowser::GetDocumentHasModifiedForms (nsIDOMDocument *aDomDoc, PRUi rv = computedStyle->GetPropertyCSSValue(visibilityAttr, getter_AddRefs (cssValue)); if (NS_SUCCEEDED (rv) && cssValue) { - nsEmbedString value; + nsString value; rv = cssValue->GetCssText (value); if (NS_SUCCEEDED (rv) && value.Length ()) { @@ -1367,7 +1298,7 @@ nsresult EphyBrowser::GetDocumentHasModifiedForms (nsIDOMDocument *aDomDoc, PRUi continue; } - nsEmbedString defaultText, userText; + nsString defaultText, userText; areaElement->GetDefaultValue (defaultText); areaElement->GetValue (userText); @@ -1391,15 +1322,15 @@ nsresult EphyBrowser::GetDocumentHasModifiedForms (nsIDOMDocument *aDomDoc, PRUi continue; } - nsEmbedString type; + nsString type; inputElement->GetType(type); - nsEmbedCString cType; + nsCString cType; NS_UTF16ToCString (type, NS_CSTRING_ENCODING_UTF8, cType); if (g_ascii_strcasecmp (cType.get(), "text") == 0) { - nsEmbedString defaultText, userText; + nsString defaultText, userText; PRInt32 max_length; inputElement->GetDefaultValue (defaultText); inputElement->GetValue (userText); @@ -1486,7 +1417,7 @@ EphyBrowser::GetSecurityInfo (PRUint32 *aState, nsACString &aDescription) rv = mSecurityInfo->GetState (aState); NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); - nsEmbedString tooltip; + nsString tooltip; rv = mSecurityInfo->GetTooltipText (tooltip); NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); @@ -1567,21 +1498,3 @@ EphyBrowser::Close () return domWin->Close(); } - -#ifndef HAVE_GECKO_1_8 -nsresult -EphyBrowser::FocusActivate () -{ - NS_ENSURE_STATE (mWebBrowserFocus); - - return mWebBrowserFocus->Activate(); -} - -nsresult -EphyBrowser::FocusDeactivate () -{ - NS_ENSURE_STATE (mWebBrowserFocus); - - return mWebBrowserFocus->Deactivate(); -} -#endif /* !HAVE_GECKO_1_8 */ diff --git a/embed/mozilla/EphyBrowser.h b/embed/mozilla/EphyBrowser.h index ec605eb10..6a775bf14 100644 --- a/embed/mozilla/EphyBrowser.h +++ b/embed/mozilla/EphyBrowser.h @@ -21,24 +21,22 @@ #ifndef EPHY_BROWSER_H #define EPHY_BROWSER_H -#include "config.h" - #include "ephy-embed.h" #include <gtk/gtkwidget.h> #include <gtkmozembed.h> #include <nsCOMPtr.h> -#include <nsIDOMEventListener.h> #include <nsIDOMContextMenuListener.h> -#include <nsIDOMEventTarget.h> -#include <nsIWebNavigation.h> -#include <nsISHistory.h> -#include <nsIWebBrowser.h> -#include <nsIWebBrowserFocus.h> #include <nsIDOMDocument.h> +#include <nsIDOMEventListener.h> +#include <nsIDOMEventTarget.h> #include <nsIDOMWindow.h> #include <nsIPrintSettings.h> #include <nsIRequest.h> +#include <nsISHistory.h> +#include <nsIWebBrowserFocus.h> +#include <nsIWebBrowser.h> +#include <nsIWebNavigation.h> #ifdef ALLOW_PRIVATE_API #include <nsIContentViewer.h> @@ -188,11 +186,6 @@ public: EphyEmbedDocumentType GetDocumentType (); -#ifndef HAVE_GECKO_1_8 - nsresult FocusActivate (); - nsresult FocusDeactivate (); -#endif /* !HAVE_GECKO_1_8 */ - nsCOMPtr<nsIWebBrowser> mWebBrowser; private: GtkWidget *mEmbed; diff --git a/embed/mozilla/EphyContentPolicy.cpp b/embed/mozilla/EphyContentPolicy.cpp index a78005b85..7c811d3e8 100644 --- a/embed/mozilla/EphyContentPolicy.cpp +++ b/embed/mozilla/EphyContentPolicy.cpp @@ -20,22 +20,11 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "EphyContentPolicy.h" -#include "EphyUtils.h" - -#include "ephy-embed-shell.h" -#include "ephy-embed-single.h" -#include "eel-gconf-extensions.h" -#include "ephy-adblock-manager.h" -#include "ephy-debug.h" +#include <nsStringAPI.h> #include <nsCOMPtr.h> -#undef MOZILLA_INTERNAL_API -#include <nsEmbedString.h> -#define MOZILLA_INTERNAL_API 1 #include <nsIDOMAbstractView.h> #include <nsIDOMDocument.h> #include <nsIDOMDocumentView.h> @@ -43,6 +32,16 @@ #include <nsIDOMWindow.h> #include <nsIURI.h> +#include "eel-gconf-extensions.h" +#include "ephy-adblock-manager.h" +#include "ephy-debug.h" +#include "ephy-embed-shell.h" +#include "ephy-embed-single.h" + +#include "EphyUtils.h" + +#include "EphyContentPolicy.h" + #define CONF_LOCKDOWN_DISABLE_UNSAFE_PROTOCOLS "/apps/epiphany/lockdown/disable_unsafe_protocols" #define CONF_LOCKDOWN_ADDITIONAL_SAFE_PROTOCOLS "/apps/epiphany/lockdown/additional_safe_protocols" @@ -106,7 +105,6 @@ EphyContentPolicy::GetEmbedFromContext (nsISupports *aContext) return embed; } -#if MOZ_NSICONTENTPOLICY_VARIANT == 2 NS_IMETHODIMP EphyContentPolicy::ShouldLoad(PRUint32 aContentType, nsIURI *aContentLocation, @@ -132,7 +130,7 @@ EphyContentPolicy::ShouldLoad(PRUint32 aContentType, if (isHttps) return NS_OK; /* is this url allowed ? */ - nsEmbedCString contentSpec; + nsCString contentSpec; aContentLocation->GetSpec (contentSpec); EphyAdBlockManager *adblock_manager = @@ -174,7 +172,7 @@ EphyContentPolicy::ShouldLoad(PRUint32 aContentType, if (strcmp (contentSpec.get(), "about:blank") == 0) return NS_OK; - nsEmbedCString contentScheme; + nsCString contentScheme; aContentLocation->GetScheme (contentScheme); /* first general lockdown check */ @@ -199,96 +197,3 @@ EphyContentPolicy::ShouldProcess(PRUint32 aContentType, *aDecision = nsIContentPolicy::ACCEPT; return NS_OK; } - -#else - -/* boolean shouldLoad (in PRInt32 contentType, in nsIURI contentLocation, in nsISupports ctxt, in nsIDOMWindow window); */ -NS_IMETHODIMP EphyContentPolicy::ShouldLoad(PRInt32 aContentType, - nsIURI *aContentLocation, - nsISupports *aContext, - nsIDOMWindow *aWindow, - PRBool *_retval) -{ - NS_ENSURE_ARG (aContentLocation); - NS_ENSURE_ARG_POINTER (_retval); - - *_retval = PR_TRUE; - - PRBool isHttps = PR_FALSE; - aContentLocation->SchemeIs ("https", &isHttps); - if (isHttps) return NS_OK; - - /* We have to always allow these, else forms and scrollbars break */ - PRBool isChrome = PR_FALSE, isResource = PR_FALSE; - aContentLocation->SchemeIs ("chrome", &isChrome); - aContentLocation->SchemeIs ("resource", &isResource); - if (isChrome || isResource) return NS_OK; - - nsEmbedCString contentSpec; - aContentLocation->GetSpec (contentSpec); - - EphyAdBlockManager *adblock_manager = - EPHY_ADBLOCK_MANAGER (ephy_embed_shell_get_adblock_manager (embed_shell)); - - /* try to remap 1.7 types to 1.8 */ - static struct {PRBool should_block; PRUint32 remap;} kBlockType[nsIContentPolicy::DOCUMENT + 1] = { - {PR_TRUE /* TYPE_OTHER */, 1}, - {PR_TRUE /* TYPE_SCRIPT */,2}, - {PR_TRUE /* TYPE_IMAGE */, 3}, - {PR_FALSE /* TYPE_STYLESHEET */, 4}, - {PR_TRUE /* TYPE_OBJECT */, 5}, - {PR_TRUE /* TYPE_SUBDOCUMENT */, 7}, - {PR_TRUE /* TYPE_CONTROL_TAG */, 1}, - {PR_TRUE /* TYPE_RAW_URL */, 1}, - {PR_FALSE /* TYPE_DOCUMENT */, 6} - }; - - PRUint32 indexPolicy = aContentType < G_N_ELEMENTS (kBlockType) ? aContentType : 1; - if (kBlockType[indexPolicy].should_block && - !ephy_adblock_manager_should_load (adblock_manager, - contentSpec.get (), - AdUriCheckType (kBlockType[indexPolicy].remap))) - { - *_retval = PR_FALSE; - - GtkWidget *embed = GetEmbedFromContext (aContext); - - if (embed) - { - g_signal_emit_by_name (embed, "content-blocked", contentSpec.get ()); - } - return NS_OK; - } - - PRBool isHttp = PR_FALSE; - aContentLocation->SchemeIs ("http", &isHttp); - if (isHttp) return NS_OK; - - if (strcmp (contentSpec.get(), "about:blank") == 0) return NS_OK; - - nsEmbedCString contentScheme; - aContentLocation->GetScheme (contentScheme); - - /* first general lockdown check */ - if (mLocked && - !g_slist_find_custom (mSafeProtocols, contentScheme.get(), (GCompareFunc) strcmp)) - { - *_retval = PR_FALSE; - } - return NS_OK; -} - -/* boolean shouldProcess (in PRInt32 contentType, in nsIURI documentLocation, in nsISupports ctxt, in nsIDOMWindow window); */ -NS_IMETHODIMP EphyContentPolicy::ShouldProcess(PRInt32 contentType, - nsIURI *documentLocation, - nsISupports *ctxt, - nsIDOMWindow *window, - PRBool *_retval) -{ - /* This is never called. */ - LOG ("ShouldProcess: this is quite unexpected!"); - - *_retval = PR_TRUE; - return NS_OK; -} -#endif /* MOZ_NSICONTENTPOLICY_VARIANT == 2 */ diff --git a/embed/mozilla/EphyContentPolicy.h b/embed/mozilla/EphyContentPolicy.h index 7639a6d00..170140049 100644 --- a/embed/mozilla/EphyContentPolicy.h +++ b/embed/mozilla/EphyContentPolicy.h @@ -25,11 +25,10 @@ #include <glib.h> #include <glib-object.h> -#include "ephy-embed.h" - -#include <nsISupports.h> #include <nsIContentPolicy.h> +#include "ephy-embed.h" + #define EPHY_CONTENT_POLICY_CONTRACTID "@gnome.org/projects/epiphany/epiphany-content-policy;1" #define EPHY_CONTENT_POLICY_CLASSNAME "Epiphany Content Policy Class" diff --git a/embed/mozilla/EphyDirectoryProvider.cpp b/embed/mozilla/EphyDirectoryProvider.cpp index 1c9e30b4d..a2b026385 100644 --- a/embed/mozilla/EphyDirectoryProvider.cpp +++ b/embed/mozilla/EphyDirectoryProvider.cpp @@ -19,22 +19,28 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "EphyDirectoryProvider.h" +#include <string.h> + +#ifndef HAVE_GECKO_1_9 +// for nsNetUtil.h +#define MOZILLA_INTERNAL_API 1 +#endif + +#include <nsStringAPI.h> +#include <nsAppDirectoryServiceDefs.h> #include <nsCOMPtr.h> -#include <nsIIOService.h> -#include <nsNetUtil.h> #include <nsEnumeratorUtils.h> -#include <nsILocalFile.h> -#include <nsAppDirectoryServiceDefs.h> -#include <nsIToolkitChromeRegistry.h> #include <nsIDirectoryService.h> +#include <nsIIOService.h> +#include <nsILocalFile.h> #include <nsISupportsArray.h> +#include <nsIToolkitChromeRegistry.h> +#include <nsNetUtil.h> -#include <string.h> +#include "EphyDirectoryProvider.h" NS_IMPL_ISUPPORTS2 (EphyDirectoryProvider, nsIDirectoryServiceProvider, diff --git a/embed/mozilla/EphyFind.cpp b/embed/mozilla/EphyFind.cpp index c1625cc8c..ba2b653fc 100644 --- a/embed/mozilla/EphyFind.cpp +++ b/embed/mozilla/EphyFind.cpp @@ -19,62 +19,50 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "EphyFind.h" - -#include "ephy-debug.h" +#include <glib.h> -#undef MOZILLA_INTERNAL_API -#include <nsEmbedString.h> -#define MOZILLA_INTERNAL_API 1 +#include <nsStringAPI.h> #include <gtkmozembed.h> #include <gtkmozembed_internal.h> +#include <nsComponentManagerUtils.h> #include <nsCOMPtr.h> -#include <nsIServiceManager.h> -#include <nsIInterfaceRequestorUtils.h> -#include <nsIDOMWindow.h> -#include <nsIWebBrowser.h> -#include <nsIWebBrowserFocus.h> -#include <nsIDOMNode.h> -#include <nsIDOMElement.h> -#include <nsIDOMDocument.h> -#include <nsIDOMDocumentView.h> +#include <nsIDocShell.h> +#include <nsIDocShellTreeItem.h> #include <nsIDOMAbstractView.h> #include <nsIDOMDocumentEvent.h> +#include <nsIDOMDocument.h> +#include <nsIDOMDocumentView.h> +#include <nsIDOMElement.h> #include <nsIDOMEvent.h> -#include <nsIDOMKeyEvent.h> #include <nsIDOMEventTarget.h> #include <nsIDOMHTMLAnchorElement.h> - -#ifdef HAVE_TYPEAHEADFIND +#include <nsIDOMKeyEvent.h> +#include <nsIDOMNode.h> +#include <nsIDOMWindow.h> +#include <nsIInterfaceRequestorUtils.h> +#include <nsISelectionController.h> +#include <nsISelectionDisplay.h> #include <nsISimpleEnumerator.h> -#include <nsIDocShell.h> -#include <nsIDocShellTreeItem.h> #include <nsITypeAheadFind.h> -#include <nsISelectionDisplay.h> -#include <nsISelectionController.h> -#else -#include <nsIWebBrowserFind.h> -#include <nsMemory.h> -#endif +#include <nsIWebBrowserFocus.h> +#include <nsIWebBrowser.h> +#include <nsServiceManagerUtils.h> -#include <glib.h> +#include "ephy-debug.h" + +#include "EphyFind.h" -#ifdef HAVE_TYPEAHEADFIND #define NS_TYPEAHEADFIND_CONTRACTID "@mozilla.org/typeaheadfind;1" -#endif /* HAVE_TYPEAHEADFIND */ static const PRUnichar kKeyEvents[] = { 'K', 'e', 'y', 'E', 'v', 'e', 'n', 't', 's', '\0' }; static const PRUnichar kKeyPress[] = { 'k', 'e', 'y', 'p', 'r', 'e', 's', 's', '\0' }; EphyFind::EphyFind () : mCurrentEmbed(nsnull) -#ifdef HAVE_TYPEAHEADFIND , mAttention(PR_FALSE) -#endif { LOG ("EphyFind ctor [%p]", this); } @@ -100,7 +88,6 @@ EphyFind::SetEmbed (EphyEmbed *aEmbed) getter_AddRefs (mWebBrowser)); NS_ENSURE_TRUE (mWebBrowser, rv); -#ifdef HAVE_TYPEAHEADFIND nsCOMPtr<nsIDocShell> docShell (do_GetInterface (mWebBrowser, &rv)); NS_ENSURE_SUCCESS (rv, rv); @@ -114,22 +101,6 @@ EphyFind::SetEmbed (EphyEmbed *aEmbed) rv = mFinder->SetDocShell (docShell); } NS_ENSURE_SUCCESS (rv, rv); -#else - PRUnichar *string = nsnull; - if (mFinder) { - mFinder->GetSearchString (&string); - } - - mFinder = do_GetInterface (mWebBrowser, &rv); - NS_ENSURE_SUCCESS (rv, rv); - - mFinder->SetWrapFind (PR_TRUE); - - if (string) { - mFinder->SetSearchString (string); - nsMemory::Free (string); - } -#endif /* HAVE_TYPEAHEADFIND */ mCurrentEmbed = aEmbed; @@ -142,24 +113,13 @@ EphyFind::SetFindProperties (const char *aSearchString, { if (!mFinder) return; -#ifdef HAVE_TYPEAHEADFIND mFinder->SetCaseSensitive (aCaseSensitive); /* search string is set on ::Find */ -#else - mFinder->SetMatchCase (aCaseSensitive); - - nsEmbedString uSearchString; - NS_CStringToUTF16 (nsEmbedCString (aSearchString ? aSearchString : ""), - NS_CSTRING_ENCODING_UTF8, uSearchString); - - mFinder->SetSearchString (uSearchString.get ()); -#endif /* TYPEAHEADFIND */ } void EphyFind::SetSelectionAttention (PRBool aAttention) { -#ifdef HAVE_TYPEAHEADFIND if (aAttention == mAttention) return; mAttention = aAttention; @@ -198,7 +158,6 @@ EphyFind::SetSelectionAttention (PRBool aAttention) controller->SetDisplaySelection (display); } -#endif } EphyEmbedFindResult @@ -207,11 +166,10 @@ EphyFind::Find (const char *aSearchString, { if (!mFinder) return EPHY_EMBED_FIND_NOTFOUND; - nsEmbedString uSearchString; - NS_CStringToUTF16 (nsEmbedCString (aSearchString ? aSearchString : ""), + nsString uSearchString; + NS_CStringToUTF16 (nsCString (aSearchString ? aSearchString : ""), NS_CSTRING_ENCODING_UTF8, uSearchString); -#ifdef HAVE_TYPEAHEADFIND SetSelectionAttention (PR_TRUE); nsresult rv; @@ -219,17 +177,6 @@ EphyFind::Find (const char *aSearchString, rv = mFinder->Find (uSearchString, aLinksOnly, &found); return (EphyEmbedFindResult) found; -#else - mFinder->SetSearchString (uSearchString.get ()); - mFinder->SetFindBackwards (PR_FALSE); - - nsresult rv; - PRBool didFind = PR_FALSE; - rv = mFinder->FindNext (&didFind); - - return NS_SUCCEEDED (rv) && didFind ? EPHY_EMBED_FIND_FOUND : - EPHY_EMBED_FIND_NOTFOUND; -#endif /* HAVE_TYPEAHEADFIND */ } EphyEmbedFindResult @@ -237,7 +184,6 @@ EphyFind::FindAgain (PRBool aForward) { if (!mFinder) return EPHY_EMBED_FIND_NOTFOUND; -#ifdef HAVE_TYPEAHEADFIND SetSelectionAttention (PR_TRUE); nsresult rv; @@ -249,16 +195,6 @@ EphyFind::FindAgain (PRBool aForward) } return (EphyEmbedFindResult) found; -#else - mFinder->SetFindBackwards (!aForward); - - nsresult rv; - PRBool didFind = PR_FALSE; - rv = mFinder->FindNext (&didFind); - - return NS_SUCCEEDED (rv) && didFind ? EPHY_EMBED_FIND_FOUND : - EPHY_EMBED_FIND_NOTFOUND; -#endif /* HAVE_TYPEAHEADFIND */ } PRBool @@ -266,21 +202,8 @@ EphyFind::ActivateLink (GdkModifierType aMask) { nsresult rv; nsCOMPtr<nsIDOMElement> link; -#if defined(HAVE_TYPEAHEADFIND) && defined(HAVE_GECKO_1_8) rv = mFinder->GetFoundLink (getter_AddRefs (link)); if (NS_FAILED (rv) || !link) return FALSE; -#else - nsCOMPtr<nsIWebBrowserFocus> focus (do_QueryInterface (mWebBrowser)); - NS_ENSURE_TRUE (focus, FALSE); - - rv = focus->GetFocusedElement (getter_AddRefs (link)); - NS_ENSURE_TRUE (NS_SUCCEEDED (rv) && link, FALSE); - - /* ensure this is really a link so we don't accidentally submit if we're on a button or so! */ - /* FIXME: does that work with xlink links? */ - nsCOMPtr<nsIDOMHTMLAnchorElement> anchor (do_QueryInterface (link)); - if (!anchor) return FALSE; -#endif /* HAVE_TYPEAHEADFIND && HAVE_GECKO_1_8 */ nsCOMPtr<nsIDOMDocument> doc; rv = link->GetOwnerDocument (getter_AddRefs (doc)); @@ -297,13 +220,13 @@ EphyFind::ActivateLink (GdkModifierType aMask) NS_ENSURE_TRUE (docEvent, FALSE); nsCOMPtr<nsIDOMEvent> event; - rv = docEvent->CreateEvent (nsEmbedString(kKeyEvents), getter_AddRefs (event)); + rv = docEvent->CreateEvent (nsString(kKeyEvents), getter_AddRefs (event)); NS_ENSURE_SUCCESS (rv, FALSE); nsCOMPtr<nsIDOMKeyEvent> keyEvent (do_QueryInterface (event)); NS_ENSURE_TRUE (keyEvent, FALSE); - rv = keyEvent->InitKeyEvent (nsEmbedString (kKeyPress), + rv = keyEvent->InitKeyEvent (nsString (kKeyPress), PR_TRUE /* bubble */, PR_TRUE /* cancelable */, abstractView, diff --git a/embed/mozilla/EphyFind.h b/embed/mozilla/EphyFind.h index d2a636df8..b7084d8ff 100644 --- a/embed/mozilla/EphyFind.h +++ b/embed/mozilla/EphyFind.h @@ -21,16 +21,17 @@ #ifndef TYPEAHEADFIND_H #define TYPEAHEADFIND_H -#include "ephy-embed.h" -#include "ephy-embed-find.h" - -#include <nsCOMPtr.h> #include <gdk/gdktypes.h> class nsITypeAheadFind; class nsIWebBrowser; class nsIWebBrowserFind; +#include <nsCOMPtr.h> + +#include "ephy-embed.h" +#include "ephy-embed-find.h" + class EphyFind { public: @@ -51,12 +52,8 @@ class EphyFind nsCOMPtr<nsIWebBrowser> mWebBrowser; -#ifdef HAVE_TYPEAHEADFIND nsCOMPtr<nsITypeAheadFind> mFinder; PRBool mAttention; -#else - nsCOMPtr<nsIWebBrowserFind> mFinder; -#endif }; #endif /* !TYPEAHEADFIND_H */ diff --git a/embed/mozilla/EphyHeaderSniffer.cpp b/embed/mozilla/EphyHeaderSniffer.cpp index de18a5ff4..b0d1ceb88 100644 --- a/embed/mozilla/EphyHeaderSniffer.cpp +++ b/embed/mozilla/EphyHeaderSniffer.cpp @@ -40,35 +40,43 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "MozDownload.h" -#include "EphyHeaderSniffer.h" - -#include "ephy-file-chooser.h" -#include "ephy-prefs.h" -#include "ephy-gui.h" -#include "eel-gconf-extensions.h" -#include "ephy-debug.h" - #include <glib/gi18n.h> #include <libgnomevfs/gnome-vfs-utils.h> +#include <nsStringAPI.h> + +#include <nsComponentManagerUtils.h> #include <nsIChannel.h> -#include <nsIHttpChannel.h> -#include <nsIURL.h> -#include <nsIPrefService.h> -#include <nsIMIMEService.h> -#include <nsIMIMEInfo.h> +#include <nsIDOMDocument.h> #include <nsIDOMHTMLDocument.h> #include <nsIDownload.h> +#include <nsIHttpChannel.h> +#include <nsIInputStream.h> +#include <nsILocalFile.h> #include <nsIMIMEHeaderParam.h> +#include <nsIMIMEInfo.h> +#include <nsIMIMEService.h> +#include <nsIPrefService.h> +#include <nsIPromptService.h> +#include <nsIURI.h> +#include <nsIURL.h> +#include <nsIWebBrowserPersist.h> #include <nsIWindowWatcher.h> +#include <nsServiceManagerUtils.h> +#include <nsXPCOMCID.h> + +#include "eel-gconf-extensions.h" +#include "ephy-debug.h" +#include "ephy-file-chooser.h" +#include "ephy-gui.h" +#include "ephy-prefs.h" -#ifdef HAVE_GECKO_1_8 #include "EphyBadCertRejector.h" -#endif +#include "MozDownload.h" + +#include "EphyHeaderSniffer.h" EphyHeaderSniffer::EphyHeaderSniffer (nsIWebBrowserPersist* aPersist, MozillaEmbedPersist *aEmbedPersist, nsIFile* aFile, nsIURI* aURL, nsIDOMDocument* aDocument, nsIInputStream* aPostData, @@ -105,22 +113,16 @@ EphyHeaderSniffer::~EphyHeaderSniffer() } } -#ifdef HAVE_GECKO_1_8 NS_IMPL_ISUPPORTS3 (EphyHeaderSniffer, nsIWebProgressListener, nsIInterfaceRequestor, nsIAuthPrompt) -#else -NS_IMPL_ISUPPORTS2 (EphyHeaderSniffer, - nsIWebProgressListener, - nsIAuthPrompt) -#endif NS_IMETHODIMP EphyHeaderSniffer::HandleContent () { gboolean handled = FALSE; - nsEmbedCString uriSpec; + nsCString uriSpec; if (mPostData || !mSingle) return NS_ERROR_FAILURE; @@ -154,7 +156,7 @@ EphyHeaderSniffer::OnStateChange (nsIWebProgress *aWebProgress, nsIRequest *aReq nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(channel)); if (httpChannel) { - httpChannel->GetResponseHeader(nsEmbedCString("content-disposition"), + httpChannel->GetResponseHeader(nsCString("content-disposition"), mContentDisposition); } @@ -215,8 +217,6 @@ EphyHeaderSniffer::OnSecurityChange (nsIWebProgress *aWebProgress, nsIRequest *a return NS_OK; } -#ifdef HAVE_GECKO_1_8 - /* void getInterface (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */ NS_IMETHODIMP EphyHeaderSniffer::GetInterface(const nsIID & uuid, void * *result) @@ -243,8 +243,6 @@ EphyHeaderSniffer::GetInterface(const nsIID & uuid, void * *result) return NS_ERROR_NO_INTERFACE; } -#endif /* HAVE_GECKO_1_8 */ - static void filechooser_response_cb (GtkWidget *dialog, gint response, @@ -265,7 +263,7 @@ filechooser_response_cb (GtkWidget *dialog, nsCOMPtr<nsILocalFile> destFile = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID); if (destFile) { - destFile->InitWithNativePath (nsEmbedCString (filename)); + destFile->InitWithNativePath (nsCString (filename)); sniffer->InitiateDownload (destFile); } @@ -289,7 +287,7 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI) flags = ephy_embed_persist_get_flags (EPHY_EMBED_PERSIST (mEmbedPersist)); askDownloadDest = flags & EPHY_EMBED_PERSIST_ASK_DESTINATION; - nsEmbedString defaultFileName; + nsString defaultFileName; if (!defaultFileName.Length() && mContentDisposition.Length()) { @@ -299,13 +297,13 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI) if (mimehdrpar) { - nsEmbedCString fallbackCharset; + nsCString fallbackCharset; if (mURL) { mURL->GetOriginCharset(fallbackCharset); } - nsEmbedString fileName; + nsString fileName; rv = mimehdrpar->GetParameter (mContentDisposition, "filename", fallbackCharset, PR_TRUE, nsnull, @@ -331,7 +329,7 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI) nsCOMPtr<nsIURL> url(do_QueryInterface(mURL)); if (url) { - nsEmbedCString fileNameCString; + nsCString fileNameCString; url->GetFileName(fileNameCString); NS_CStringToUTF16 (fileNameCString, NS_CSTRING_ENCODING_UTF8, defaultFileName); @@ -352,7 +350,7 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI) if (!defaultFileName.Length() && mURL) { /* 4 Use the host. */ - nsEmbedCString hostName; + nsCString hostName; mURL->GetHost(hostName); NS_CStringToUTF16 (hostName, NS_CSTRING_ENCODING_UTF8, defaultFileName); @@ -361,12 +359,12 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI) /* 5 One last case to handle about:blank and other untitled pages. */ if (!defaultFileName.Length()) { - NS_CStringToUTF16 (nsEmbedCString(_("Untitled")), + NS_CStringToUTF16 (nsCString(_("Untitled")), NS_CSTRING_ENCODING_UTF8, defaultFileName); } /* Validate the file name to ensure legality. */ - nsEmbedCString cDefaultFileName; + nsCString cDefaultFileName; NS_UTF16ToCString (defaultFileName, NS_CSTRING_ENCODING_UTF8, cDefaultFileName); char *default_name = g_strdup (cDefaultFileName.get()); diff --git a/embed/mozilla/EphyHeaderSniffer.h b/embed/mozilla/EphyHeaderSniffer.h index 1b8a53979..d0cc9fff9 100644 --- a/embed/mozilla/EphyHeaderSniffer.h +++ b/embed/mozilla/EphyHeaderSniffer.h @@ -39,29 +39,26 @@ * $Id$ */ -#include "mozilla-embed-persist.h" -#include "ephy-embed-single.h" +#ifndef EPHY_HEADER_SNIFFER_H +#define EPHY_HEADER_SNIFFER_H -#include <nsIWebProgressListener.h> -#include <nsIWebBrowserPersist.h> -#include <nsIURI.h> -#include <nsILocalFile.h> -#include <nsIInputStream.h> -#include <nsIDOMDocument.h> -#include <nsIAuthPrompt.h> -#include <nsIPromptService.h> -#undef MOZILLA_INTERNAL_API -#include <nsEmbedString.h> -#define MOZILLA_INTERNAL_API 1 +class nsIDOMDocument; +class nsIFile; +class nsIInputStream; +class nsILocalFile; +class nsIURI; +class nsIWebBrowserPersist; -#ifdef HAVE_GECKO_1_8 +#include <nsCOMPtr.h> +#include <nsIAuthPrompt.h> #include <nsIInterfaceRequestor.h> -#endif +#include <nsIWebProgressListener.h> + +#include "mozilla-embed-persist.h" +#include "ephy-embed-single.h" class EphyHeaderSniffer : public nsIWebProgressListener, -#ifdef HAVE_GECKO_1_8 public nsIInterfaceRequestor, -#endif public nsIAuthPrompt { public: @@ -73,9 +70,7 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSIWEBPROGRESSLISTENER NS_FORWARD_SAFE_NSIAUTHPROMPT(mAuthPrompt) -#ifdef HAVE_GECKO_1_8 NS_DECL_NSIINTERFACEREQUESTOR -#endif nsresult InitiateDownload (nsILocalFile *aDestFile); @@ -92,8 +87,9 @@ private: nsCOMPtr<nsIURI> mOriginalURI; nsCOMPtr<nsIDOMDocument> mDocument; nsCOMPtr<nsIInputStream> mPostData; - nsEmbedCString mContentType; - nsEmbedCString mContentDisposition; + nsCString mContentType; + nsCString mContentDisposition; nsCOMPtr<nsIAuthPrompt> mAuthPrompt; }; +#endif /* !EPHY_HEADER_SNIFFER_H */ diff --git a/embed/mozilla/EphyHistoryListener.cpp b/embed/mozilla/EphyHistoryListener.cpp index 56f8c32a2..74aa3d8d7 100644 --- a/embed/mozilla/EphyHistoryListener.cpp +++ b/embed/mozilla/EphyHistoryListener.cpp @@ -19,30 +19,29 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "EphyHistoryListener.h" -#include "EphyUtils.h" - -#include "ephy-debug.h" +#include <nsStringAPI.h> -#undef MOZILLA_INTERNAL_API -#include <nsEmbedString.h> -#define MOZILLA_INTERNAL_API 1 #include <nsCOMPtr.h> -#include <nsIServiceManager.h> +#include <nsCURILoader.h> +#include <nsIChannel.h> #include <nsIDocumentLoader.h> -#include <nsIWebProgress.h> +#include <nsIHttpChannel.h> +#include <nsIRequest.h> #include <nsIRequestObserver.h> +#include <nsISupportsUtils.h> #include <nsIURI.h> -#include <nsIRequest.h> -#include <nsIChannel.h> -#include <nsIHttpChannel.h> +#include <nsIWebProgress.h> #include <nsNetCID.h> -#include <nsISupportsUtils.h> -#include <nsCURILoader.h> +#include <nsServiceManagerUtils.h> +#include "EphyUtils.h" + +#include "ephy-debug.h" + +#include "EphyHistoryListener.h" + EphyHistoryListener::EphyHistoryListener () { LOG ("EphyHistoryListener ctor"); @@ -105,9 +104,9 @@ EphyHistoryListener::OnStateChange (nsIWebProgress *aWebProgress, rv = channel->GetURI (getter_AddRefs (fromURI)); NS_ENSURE_TRUE (NS_SUCCEEDED (rv) && fromURI, rv); - nsEmbedCString location; + nsCString location; rv = httpChannel->GetResponseHeader - (nsEmbedCString ("Location"), location); + (nsCString ("Location"), location); NS_ENSURE_TRUE (NS_SUCCEEDED (rv) && location.Length(), rv); nsCOMPtr<nsIURI> toURI; @@ -115,7 +114,7 @@ EphyHistoryListener::OnStateChange (nsIWebProgress *aWebProgress, nsnull /* use origin charset of fromURI */, fromURI); NS_ENSURE_TRUE (NS_SUCCEEDED (rv) && toURI, rv); - nsEmbedCString fromSpec, toSpec; + nsCString fromSpec, toSpec; rv = fromURI->GetSpec (fromSpec); rv |= toURI->GetSpec(toSpec); NS_ENSURE_SUCCESS (rv, rv); diff --git a/embed/mozilla/EphyHistoryListener.h b/embed/mozilla/EphyHistoryListener.h index 38cf9e49f..e149da113 100644 --- a/embed/mozilla/EphyHistoryListener.h +++ b/embed/mozilla/EphyHistoryListener.h @@ -26,15 +26,13 @@ #include <nsIWebProgressListener.h> #include <nsWeakReference.h> -#include <glib-object.h> - /* 6a9533c6-f068-4e63-8225-5feba0b54d6b */ #define EPHY_REDIRECTLISTENER_CID \ { 0x6a9533c6, 0xf068, 0x4e63, { 0x82, 0x25, 0x5f, 0xeb, 0xa0, 0xb5, 0x4d, 0x6b } } #define EPHY_REDIRECTLISTENER_CLASSNAME "Epiphany Redirect Listener Class" class EphyHistoryListener : public nsIWebProgressListener, - public nsSupportsWeakReference + public nsSupportsWeakReference { public: EphyHistoryListener(); diff --git a/embed/mozilla/EphyPromptService.cpp b/embed/mozilla/EphyPromptService.cpp index 4f3d1446c..ceed6e0ab 100644 --- a/embed/mozilla/EphyPromptService.cpp +++ b/embed/mozilla/EphyPromptService.cpp @@ -21,40 +21,25 @@ #include "mozilla-config.h" #include "config.h" -#include "EphyPromptService.h" -#include "AutoJSContextStack.h" - -#include <nsCOMPtr.h> -#include <nsIDOMWindow.h> -#undef MOZILLA_INTERNAL_API -#include <nsEmbedString.h> -#define MOZILLA_INTERNAL_API 1 - -#if 0 -#include <nsIPrincipal.h> -#include <nsIScriptSecurityManager.h> -#include <nsIServiceManager.h> -#endif - -#if 0 -#include "AutoEventQueue.h" -#endif - -#include "EphyUtils.h" - #include <glib.h> #include <glib-object.h> #include <glib/gi18n.h> #include <gtk/gtk.h> +#include <nsStringAPI.h> + +#include <nsCOMPtr.h> +#include <nsIDOMWindow.h> +#include <nsServiceManagerUtils.h> + #include "ephy-embed-shell.h" #include "ephy-gui.h" #include "ephy-debug.h" -#ifndef HAVE_GECKO_1_8 -typedef nsEmbedString nsDependentString; -typedef nsEmbedCString nsDependentCString; -#endif +#include "AutoJSContextStack.h" +#include "EphyUtils.h" + +#include "EphyPromptService.h" #define TIMEOUT 1000 /* ms */ #define TIMEOUT_DATA_KEY "timeout" @@ -377,7 +362,7 @@ Prompter::AddEntry (const char *aLabel, if (aValue) { - nsEmbedCString cValue; + nsCString cValue; NS_UTF16ToCString (nsDependentString(aValue), NS_CSTRING_ENCODING_UTF8, cValue); @@ -402,7 +387,7 @@ Prompter::GetText (PRUint32 aNum, const char *text = gtk_entry_get_text (GTK_ENTRY (mEntries[aNum])); if (!text) return; - nsEmbedString value; + nsString value; NS_CStringToUTF16 (nsDependentCString (text), NS_CSTRING_ENCODING_UTF8, value); @@ -421,7 +406,7 @@ Prompter::AddSelect (PRUint32 aCount, /* FIXME: use "" instead in this case? */ if (!aList[i] || !aList[i][0]) continue; - nsEmbedCString cData; + nsCString cData; NS_UTF16ToCString (nsDependentString(aList[i]), NS_CSTRING_ENCODING_UTF8, cData); gtk_combo_box_append_text (GTK_COMBO_BOX (mCombo), cData.get()); @@ -544,18 +529,24 @@ Prompter::Show () PRBool Prompter::IsCalledFromScript() { - /* FIXME: implement me! */ #if 0 + nsCOMPtr<nsIXPConnect> xpconnect (do_GetService (nsIXPConnect::GetCID())); + NS_ENSURE_TRUE (xpconnect, PR_FALSE); + nsresult rv; - nsCOMPtr<nsIScriptSecurityManager> securityManager = - do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv); + nsCOMPtr<nsIXPCNativeCallContext> ncc; + rv = xpconnect->GetCurrentNativeCallContext (getter_AddRefs (ncc)); NS_ENSURE_SUCCESS (rv, PR_FALSE); - nsCOMPtr<nsIPrincipal> principal; - rv = securityManager->GetSubjectPrincipal (getter_AddRefs (principal)); + if (!ncc) return PR_FALSE; - g_print ("rv=%x mPrincipal=%p\n", rv, (void*)principal.get()); - return NS_SUCCEEDED (rv) && principal.get(); + JSContext *cx = nsnull; + rv = ncc->GetJSContext (&cx); + g_print ("GetJSContext rv=%x, cx=%p\n", rv, cx); + + NS_ENSURE_SUCCESS (rv, PR_FALSE); + + return cx != nsnull; #endif return PR_FALSE; } @@ -563,14 +554,26 @@ Prompter::IsCalledFromScript() void Prompter::PerformScriptAbortion() { - /* FIXME: implement me! */ #if 0 + /* FIXME: can we only stop the calling script, not all scripts in the context? */ + + nsCOMPtr<nsIXPConnect> xpconnect (do_GetService (nsIXPConnect::GetCID())); + NS_ENSURE_TRUE (xpconnect, ); + nsresult rv; - nsCOMPtr<nsIScriptSecurityManager> securityManager = - do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv); + nsCOMPtr<nsIXPCNativeCallContext> ncc; + rv = xpconnect->GetCurrentNativeCallContext (getter_AddRefs (ncc)); + NS_ENSURE_SUCCESS (rv, ); + NS_ENSURE_TRUE (ncc, ); + + JSContext *cx = nsnull; + rv = ncc->GetJSContext (&cx); + g_print ("GetJSContext rv=%x, cx=%p\n", rv, cx); NS_ENSURE_SUCCESS (rv, ); + NS_ENSURE_TRUE (cx, ); - securityManager->DisableCapability ("javascript.enabled"); + g_print ("Would now disable scripts\n"); +// MozillaPrivate::SetScriptsEnabled (cx, PR_FALSE, PR_FALSE); #endif } diff --git a/embed/mozilla/EphySidebar.cpp b/embed/mozilla/EphySidebar.cpp index f1ac09516..dbf205884 100644 --- a/embed/mozilla/EphySidebar.cpp +++ b/embed/mozilla/EphySidebar.cpp @@ -20,25 +20,21 @@ */ #include "mozilla-config.h" - #include "config.h" -#include <nsCOMPtr.h> -#include <nsCRT.h> -#include <nsIProgrammingLanguage.h> +#include <nsStringAPI.h> + +#include <nsMemory.h> #ifdef HAVE_GECKO_1_9 #include <nsIClassInfoImpl.h> #endif -#undef MOZILLA_INTERNAL_API -#include <nsEmbedString.h> -#define MOZILLA_INTERNAL_API 1 - -#include "EphySidebar.h" +#include "ephy-debug.h" #include "ephy-embed-shell.h" #include "ephy-embed-single.h" -#include "ephy-debug.h" + +#include "EphySidebar.h" NS_IMPL_ISUPPORTS1_CI(EphySidebar, nsISidebar) @@ -56,10 +52,13 @@ EphySidebar::AddPanel (const PRUnichar *aTitle, const char *aContentURL, const char *aCustomizeURL) { - nsEmbedCString title; + NS_ENSURE_ARG (aTitle); + NS_ENSURE_ARG (aContentURL); + + nsCString title; EphyEmbedSingle *single; - NS_UTF16ToCString (nsEmbedString(aTitle), + NS_UTF16ToCString (nsDependentString(aTitle), NS_CSTRING_ENCODING_UTF8, title); LOG ("Adding sidebar, url=%s title=%s", aContentURL, title.get()); @@ -90,10 +89,14 @@ EphySidebar::AddSearchEngine (const char *aEngineURL, const PRUnichar *aSuggestedTitle, const PRUnichar *aSuggestedCategory) { - nsEmbedCString title; + NS_ENSURE_ARG (aSuggestedTitle); + NS_ENSURE_ARG (aIconURL); + NS_ENSURE_ARG (aEngineURL); + + nsCString title; EphyEmbedSingle *single; - NS_UTF16ToCString (nsEmbedString(aSuggestedTitle), + NS_UTF16ToCString (nsDependentString(aSuggestedTitle), NS_CSTRING_ENCODING_UTF8, title); LOG ("Adding search engine, engineurl=%s iconurl=%s title=%s", aEngineURL, aIconURL, title.get()); diff --git a/embed/mozilla/EphySidebar.h b/embed/mozilla/EphySidebar.h index 0d7219e03..b9d2f5ace 100644 --- a/embed/mozilla/EphySidebar.h +++ b/embed/mozilla/EphySidebar.h @@ -23,8 +23,6 @@ #define EPHY_SIDEBAR_H #include <nsISidebar.h> -#include <nsIClassInfo.h> -#include <nsError.h> #define EPHY_SIDEBAR_CLASSNAME \ "Epiphany's Sidebar Implementation" diff --git a/embed/mozilla/EphySingle.cpp b/embed/mozilla/EphySingle.cpp index 3a3948de0..e6e82a4f6 100644 --- a/embed/mozilla/EphySingle.cpp +++ b/embed/mozilla/EphySingle.cpp @@ -20,27 +20,28 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "EphySingle.h" - -#include "ephy-debug.h" +#include <nsStringAPI.h> -#undef MOZILLA_INTERNAL_API -#include <nsEmbedString.h> -#define MOZILLA_INTERNAL_API 1 -#include <nsIURI.h> -#include <nsIPermissionManager.h> -#include <nsICookieManager.h> -#include <nsIServiceManager.h> +#include <nsICookie.h> #include <nsICookie2.h> -#include <nsIServiceManager.h> +#include <nsICookieManager.h> +#include <nsIObserverService.h> +#include <nsIPermission.h> +#include <nsIPermissionManager.h> +#include <nsIURI.h> +#include <nsServiceManagerUtils.h> +#include <nsWeakReference.h> #ifdef ALLOW_PRIVATE_API #include <nsIIDNService.h> #endif +#include "ephy-debug.h" + +#include "EphySingle.h" + NS_IMPL_ISUPPORTS1(EphySingle, nsIObserver) EphySingle::EphySingle() @@ -183,7 +184,7 @@ NS_IMETHODIMP EphySingle::Observe(nsISupports *aSubject, nsCOMPtr<nsIURI> uri = do_QueryInterface (aSubject); if (uri) { - nsEmbedCString spec; + nsCString spec; uri->GetSpec (spec); g_signal_emit_by_name (EPHY_COOKIE_MANAGER (mOwner), "cookie-rejected", spec.get()); @@ -254,7 +255,7 @@ mozilla_cookie_to_ephy_cookie (nsICookie *cookie) { EphyCookie *info; - nsEmbedCString transfer; + nsCString transfer; cookie->GetHost (transfer); @@ -262,7 +263,7 @@ mozilla_cookie_to_ephy_cookie (nsICookie *cookie) (do_GetService ("@mozilla.org/network/idn-service;1")); NS_ENSURE_TRUE (idnService, nsnull); - nsEmbedCString decoded; + nsCString decoded; /* ToUTF8 never fails, no need to check return value */ idnService->ConvertACEtoUTF8 (transfer, decoded); @@ -305,7 +306,7 @@ EphyPermissionInfo * mozilla_permission_to_ephy_permission (nsIPermission *perm) { nsresult rv; - nsEmbedCString type; + nsCString type; rv = perm->GetType(type); NS_ENSURE_SUCCESS (rv, NULL); @@ -326,14 +327,14 @@ mozilla_permission_to_ephy_permission (nsIPermission *perm) break; } - nsEmbedCString host; + nsCString host; perm->GetHost(host); nsCOMPtr<nsIIDNService> idnService (do_GetService ("@mozilla.org/network/idn-service;1")); NS_ENSURE_TRUE (idnService, nsnull); - nsEmbedCString decodedHost; + nsCString decodedHost; idnService->ConvertACEtoUTF8 (host, decodedHost); return ephy_permission_info_new (decodedHost.get(), type.get(), permission); diff --git a/embed/mozilla/EphySingle.h b/embed/mozilla/EphySingle.h index 9bbc3f863..c5dcaca53 100644 --- a/embed/mozilla/EphySingle.h +++ b/embed/mozilla/EphySingle.h @@ -22,16 +22,16 @@ #ifndef EPHY_SINGLE_H #define EPHY_SINGLE_H -#include "ephy-embed-single.h" -#include "ephy-cookie-manager.h" -#include "ephy-permission-manager.h" - #include <nsCOMPtr.h> #include <nsIObserver.h> #include <nsIObserverService.h> -#include <nsWeakReference.h> -#include <nsICookie.h> -#include <nsIPermission.h> + +#include "ephy-cookie-manager.h" +#include "ephy-embed-single.h" +#include "ephy-permission-manager.h" + +class nsICookie; +class nsIPermission; class EphySingle : public nsIObserver { diff --git a/embed/mozilla/EphyUtils.cpp b/embed/mozilla/EphyUtils.cpp index a043b7e66..28286990a 100644 --- a/embed/mozilla/EphyUtils.cpp +++ b/embed/mozilla/EphyUtils.cpp @@ -19,28 +19,29 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "EphyUtils.h" +#include <gtkmozembed.h> +#include <nsCOMPtr.h> +#include <nsIDOMWindow.h> +#include <nsIEmbeddingSiteWindow.h> +#include <nsIFile.h> +#include <nsIIOService.h> +#include <nsIPrintSettings.h> +#include <nsIServiceManager.h> +#include <nsIURI.h> +#include <nsIWebBrowserChrome.h> +#include <nsIWindowWatcher.h> +#include <nsServiceManagerUtils.h> +#include <nsStringAPI.h> +#include <nsXPCOM.h> + #include "ephy-embed-shell.h" #include "ephy-embed-single.h" -#include "print-dialog.h" #include "ephy-file-helpers.h" +#include "print-dialog.h" -#include <nsIIOService.h> -#include <nsIURI.h> -#include <nsIFile.h> -#include <nsIDOMWindow.h> -#include <nsIServiceManager.h> -#undef MOZILLA_INTERNAL_API -#include <nsEmbedString.h> -#define MOZILLA_INTERNAL_API 1 -#include <nsIWindowWatcher.h> -#include <nsIEmbeddingSiteWindow.h> -#include <nsIWebBrowserChrome.h> -#include <gtkmozembed.h> -#include <nsIPrintSettings.h> +#include "EphyUtils.h" nsresult EphyUtils::GetIOService (nsIIOService **ioService) @@ -63,7 +64,7 @@ EphyUtils::NewURI (nsIURI **result, const char *charset, nsIURI *baseURI) { - nsEmbedCString cSpec; + nsCString cSpec; NS_UTF16ToCString (spec, NS_CSTRING_ENCODING_UTF8, cSpec); return NewURI (result, cSpec, charset, baseURI); @@ -147,7 +148,7 @@ EphyUtils::CollatePrintSettings (EmbedPrintInfo *info, /* FIXME: for CUPS printers, print directly instead of to a tmp file? */ const static PRUnichar pName[] = { 'P', 'o', 's', 't', 'S', 'c', 'r', 'i', 'p', 't', '/', 'd', 'e', 'f', 'a', 'u', 'l', 't', '\0' }; - options->SetPrinterName(nsEmbedString(pName).get()); + options->SetPrinterName(nsString(pName).get()); const static int frame_types[] = { nsIPrintSettings::kFramesAsIs, @@ -216,29 +217,29 @@ EphyUtils::CollatePrintSettings (EmbedPrintInfo *info, } - nsEmbedString tmp; + nsString tmp; - NS_CStringToUTF16 (nsEmbedCString(info->header_left_string), + NS_CStringToUTF16 (nsCString(info->header_left_string), NS_CSTRING_ENCODING_UTF8, tmp); options->SetHeaderStrLeft (tmp.get()); - NS_CStringToUTF16 (nsEmbedCString(info->header_center_string), + NS_CStringToUTF16 (nsCString(info->header_center_string), NS_CSTRING_ENCODING_UTF8, tmp); options->SetHeaderStrCenter (tmp.get()); - NS_CStringToUTF16 (nsEmbedCString(info->header_right_string), + NS_CStringToUTF16 (nsCString(info->header_right_string), NS_CSTRING_ENCODING_UTF8, tmp); options->SetHeaderStrRight (tmp.get()); - NS_CStringToUTF16 (nsEmbedCString(info->footer_left_string), + NS_CStringToUTF16 (nsCString(info->footer_left_string), NS_CSTRING_ENCODING_UTF8, tmp); options->SetFooterStrLeft (tmp.get()); - NS_CStringToUTF16 (nsEmbedCString(info->footer_center_string), + NS_CStringToUTF16 (nsCString(info->footer_center_string), NS_CSTRING_ENCODING_UTF8, tmp); options->SetFooterStrCenter(tmp.get()); - NS_CStringToUTF16 (nsEmbedCString(info->footer_right_string), + NS_CStringToUTF16 (nsCString(info->footer_right_string), NS_CSTRING_ENCODING_UTF8, tmp); options->SetFooterStrRight(tmp.get()); @@ -260,7 +261,7 @@ EphyUtils::CollatePrintSettings (EmbedPrintInfo *info, if (info->tempfile == NULL) return NS_ERROR_FAILURE; - NS_CStringToUTF16 (nsEmbedCString(info->tempfile), + NS_CStringToUTF16 (nsCString(info->tempfile), NS_CSTRING_ENCODING_UTF8, tmp); options->SetPrintToFile (PR_TRUE); options->SetToFileName (tmp.get()); @@ -321,7 +322,7 @@ EphyUtils::CollatePrintSettings (EmbedPrintInfo *info, } #endif /* !HAVE_GECKO_1_9 */ - NS_CStringToUTF16 (nsEmbedCString(paper), + NS_CStringToUTF16 (nsCString(paper), NS_CSTRING_ENCODING_UTF8, tmp); options->SetPaperName (tmp.get()); g_free (string); diff --git a/embed/mozilla/EphyUtils.h b/embed/mozilla/EphyUtils.h index a9357a3ba..e11280add 100644 --- a/embed/mozilla/EphyUtils.h +++ b/embed/mozilla/EphyUtils.h @@ -21,16 +21,22 @@ #ifndef EPHY_UTILS_H #define EPHY_UTILS_H -#include <nsError.h> +// cannot include EphyUtils with internal strings! +#ifdef MOZILLA_INTERNAL_API +#error Cannot use EphyUtils with MOZILLA_INTERNAL_API +#endif + +#include <nscore.h> + #include <gtk/gtkwidget.h> -class nsAString; class nsACString; +class nsAString; class nsIDOMWindow; +class nsIFile; class nsIIOService; class nsIPrintSettings; class nsIURI; -class nsIFile; struct _EmbedPrintInfo; namespace EphyUtils diff --git a/embed/mozilla/EventContext.cpp b/embed/mozilla/EventContext.cpp index 70faf0235..6c16ee047 100644 --- a/embed/mozilla/EventContext.cpp +++ b/embed/mozilla/EventContext.cpp @@ -21,54 +21,66 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "EventContext.h" -#include "EphyUtils.h" -#include "ephy-debug.h" - #include <gdk/gdkkeysyms.h> -#include <nsIInterfaceRequestor.h> -#include <nsIInterfaceRequestorUtils.h> -#include <nsIServiceManager.h> -#undef MOZILLA_INTERNAL_API -#include <nsEmbedString.h> -#define MOZILLA_INTERNAL_API 1 -#include <nsIDOMEventTarget.h> -#include <nsIDOMHTMLInputElement.h> -#include <nsIDOMHTMLObjectElement.h> -#include <nsIDOMHTMLImageElement.h> -#include <nsIDOMElement.h> -#include <nsIURI.h> +#include <nsStringAPI.h> + +#include <nsComponentManagerUtils.h> +#include <nsIDOM3Node.h> +#include <nsIDOMAbstractView.h> #include <nsIDOMCharacterData.h> +#include <nsIDOMCSSPrimitiveValue.h> +#include <nsIDOMCSSStyleDeclaration.h> +#include <nsIDOMDocument.h> +#include <nsIDOMDocumentView.h> +#include <nsIDOMElementCSSInlineStyle.h> +#include <nsIDOMElement.h> +#include <nsIDOMEvent.h> +#include <nsIDOMEventTarget.h> +#include <nsIDOMEventTarget.h> +#include <nsIDOMHTMLAnchorElement.h> #include <nsIDOMHTMLAreaElement.h> +#include <nsIDOMHTMLBodyElement.h> #include <nsIDOMHTMLButtonElement.h> +#include <nsIDOMHTMLImageElement.h> +#include <nsIDOMHTMLInputElement.h> +#include <nsIDOMHTMLIsIndexElement.h> #include <nsIDOMHTMLLabelElement.h> #include <nsIDOMHTMLLegendElement.h> #include <nsIDOMHTMLMapElement.h> +#include <nsIDOMHTMLObjectElement.h> +#include <nsIDOMHTMLSelectElement.h> #include <nsIDOMHTMLTextAreaElement.h> -#include <nsIDOMElementCSSInlineStyle.h> -#include <nsIDOMCSSStyleDeclaration.h> -#include <nsIDOM3Node.h> -#include <nsIDOMCSSPrimitiveValue.h> +#include <nsIDOMKeyEvent.h> +#include <nsIDOMMouseEvent.h> +#include <nsIDOMNode.h> #include <nsIDOMNodeList.h> -#include <nsIDOMDocumentView.h> -#include <nsIDOMAbstractView.h> #include <nsIDOMNSHTMLDocument.h> #include <nsIDOMNSUIEvent.h> -#include <nsIDOMHTMLSelectElement.h> -#include <nsIDOMHTMLIsIndexElement.h> +#include <nsIInterfaceRequestor.h> +#include <nsIInterfaceRequestorUtils.h> +#include <nsIServiceManager.h> +#include <nsIURI.h> #ifdef ALLOW_PRIVATE_API -#include <nsITextToSubURI.h> -#include <nsIDOMXULDocument.h> #include <nsIDOMNSEvent.h> #include <nsIDOMNSHTMLElement.h> #include <nsIDOMViewCSS.h> +#include <nsIDOMViewCSS.h> +#include <nsIDOMXULDocument.h> +#include <nsITextToSubURI.h> #endif +#include "ephy-debug.h" + +#include "EphyBrowser.h" +#include "EphyUtils.h" + +#include "EventContext.h" + + #define KEY_CODE 256 EventContext::EventContext () @@ -91,7 +103,7 @@ nsresult EventContext::Init (EphyBrowser *browser) nsresult EventContext::GatherTextUnder (nsIDOMNode* aNode, nsAString& aResult) { - nsEmbedString text; + nsString text; nsCOMPtr<nsIDOMNode> node; aNode->GetFirstChild(getter_AddRefs(node)); PRUint32 depth = 1; @@ -106,7 +118,7 @@ nsresult EventContext::GatherTextUnder (nsIDOMNode* aNode, nsAString& aResult) { /* Add this text to our collection. */ text += ' '; - nsEmbedString data; + nsString data; charData->GetData(data); text += data; } @@ -115,7 +127,7 @@ nsresult EventContext::GatherTextUnder (nsIDOMNode* aNode, nsAString& aResult) nsCOMPtr<nsIDOMHTMLImageElement> img(do_QueryInterface(node)); if (img) { - nsEmbedString altText; + nsString altText; img->GetAlt(altText); if (altText.Length()) { @@ -170,7 +182,7 @@ nsresult EventContext::GatherTextUnder (nsIDOMNode* aNode, nsAString& aResult) /* FIXME: we should resolve against the element's base, not the document's base */ nsresult EventContext::ResolveBaseURL (const nsAString &relurl, nsACString &url) { - nsEmbedCString cRelURL; + nsCString cRelURL; NS_UTF16ToCString (relurl, NS_CSTRING_ENCODING_UTF8, cRelURL); return mBaseURI->Resolve (cRelURL, url); @@ -185,11 +197,11 @@ nsresult EventContext::Unescape (const nsACString &aEscaped, nsACString &aUnesca NS_ENSURE_TRUE (escaper, NS_ERROR_FAILURE); nsresult rv; - nsEmbedCString encoding; + nsCString encoding; rv = mBrowser->GetEncoding (encoding); NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); - nsEmbedString unescaped; + nsString unescaped; rv = escaper->UnEscapeURIForUI (encoding, aEscaped, unescaped); NS_ENSURE_TRUE (NS_SUCCEEDED (rv) && unescaped.Length(), NS_ERROR_FAILURE); @@ -271,16 +283,16 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, nsCOMPtr<nsIDOMHTMLElement> element = do_QueryInterface(node); if ((nsIDOMNode::ELEMENT_NODE == type) && element) { - nsEmbedString uTag; + nsString uTag; rv = element->GetLocalName(uTag); if (NS_FAILED(rv)) return NS_ERROR_FAILURE; - nsEmbedCString tag; + nsCString tag; NS_UTF16ToCString (uTag, NS_CSTRING_ENCODING_UTF8, tag); if (g_ascii_strcasecmp (tag.get(), "img") == 0) { - nsEmbedString img; + nsString img; nsCOMPtr <nsIDOMHTMLImageElement> image = do_QueryInterface(node, &rv); if (NS_FAILED(rv) || !image) return NS_ERROR_FAILURE; @@ -306,13 +318,13 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, do_QueryInterface(parentNode, &rv); if (NS_FAILED(rv) || !area) return NS_ERROR_FAILURE; - nsEmbedString mapName; + nsString mapName; rv = map->GetName (mapName); if (NS_FAILED(rv)) return NS_ERROR_FAILURE; // Now we are searching for all the images with a usemap attribute nsCOMPtr<nsIDOMNodeList> imgs; - rv = mDOMDocument->GetElementsByTagName (nsEmbedString(imgLiteral), + rv = mDOMDocument->GetElementsByTagName (nsString(imgLiteral), getter_AddRefs (imgs)); if (NS_FAILED(rv)) return NS_ERROR_FAILURE; @@ -330,7 +342,7 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, do_QueryInterface(aNode, &rv); if (NS_FAILED(rv) || !img) continue; - nsEmbedString imgMapName; + nsString imgMapName; rv = img->GetUseMap (imgMapName); if (NS_FAILED (rv)) continue; @@ -340,7 +352,7 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, // Check if the current image is attached to the map we are looking for if (EphyUtils::StringEquals(imgMapName, mapName)) { - nsEmbedString imgSrc; + nsString imgSrc; rv = img->GetSrc (imgSrc); if (NS_FAILED(rv)) continue; @@ -366,21 +378,21 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, object = do_QueryInterface (node); if (!element) return NS_ERROR_FAILURE; - nsEmbedString value; + nsString value; object->GetType(value); - nsEmbedCString cValue; + nsCString cValue; NS_UTF16ToCString (value, NS_CSTRING_ENCODING_UTF8, cValue); // MIME types are always lower case if (g_str_has_prefix (cValue.get(), "image/")) { - nsEmbedString img; + nsString img; rv = object->GetData (img); if (NS_FAILED(rv)) return NS_ERROR_FAILURE; - nsEmbedCString cImg; + nsCString cImg; rv = ResolveBaseURL (img, cImg); if (NS_FAILED (rv)) return NS_ERROR_FAILURE; @@ -400,18 +412,18 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, * look for a background image in the body tag */ nsCOMPtr<nsIDOMNodeList> nodeList; - rv = mDOMDocument->GetElementsByTagName (nsEmbedString(bodyLiteral), + rv = mDOMDocument->GetElementsByTagName (nsString(bodyLiteral), getter_AddRefs (nodeList)); if (NS_SUCCEEDED (rv) && nodeList) { nsCOMPtr<nsIDOMNode> bodyNode; nodeList->Item (0, getter_AddRefs (bodyNode)); - nsEmbedString cssurl; + nsString cssurl; rv = GetCSSBackground (bodyNode, cssurl); if (NS_SUCCEEDED (rv)) { - nsEmbedCString bgimg; + nsCString bgimg; rv = ResolveBaseURL (cssurl, bgimg); if (NS_FAILED (rv)) return NS_ERROR_FAILURE; @@ -435,18 +447,18 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, nsCOMPtr <nsIDOMElement> dom_elem = do_QueryInterface(node); if (dom_elem) { - nsEmbedString value; - dom_elem->GetAttributeNS (nsEmbedString(xlinknsLiteral), - nsEmbedString(typeLiteral), value); + nsString value; + dom_elem->GetAttributeNS (nsString(xlinknsLiteral), + nsString(typeLiteral), value); - nsEmbedCString cValue; + nsCString cValue; NS_UTF16ToCString (value, NS_CSTRING_ENCODING_UTF8, cValue); if (g_ascii_strcasecmp (cValue.get(), "simple") == 0) { info->context |= EPHY_EMBED_CONTEXT_LINK; - dom_elem->GetAttributeNS (nsEmbedString(xlinknsLiteral), - nsEmbedString(hrefLiteral), value); + dom_elem->GetAttributeNS (nsString(xlinknsLiteral), + nsString(hrefLiteral), value); SetURIProperty (node, "link", value); CheckLinkScheme (value); @@ -459,17 +471,17 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, element = do_QueryInterface(node); if ((nsIDOMNode::ELEMENT_NODE == type) && element) { - nsEmbedString uTag; + nsString uTag; rv = element->GetLocalName(uTag); if (NS_FAILED(rv)) return NS_ERROR_FAILURE; - nsEmbedCString tag; + nsCString tag; NS_UTF16ToCString (uTag, NS_CSTRING_ENCODING_UTF8, tag); /* Link */ if (g_ascii_strcasecmp (tag.get(), "a") == 0) { - nsEmbedString tmp; + nsString tmp; rv = GatherTextUnder (node, tmp); if (NS_SUCCEEDED(rv)) @@ -478,7 +490,7 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, nsCOMPtr <nsIDOMHTMLAnchorElement> anchor = do_QueryInterface(node); - nsEmbedCString href; + nsCString href; anchor->GetHref (tmp); NS_UTF16ToCString (tmp, NS_CSTRING_ENCODING_UTF8, href); @@ -490,8 +502,8 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, char *str = g_strdup (href.get()); g_strdelimit (str, "?", '\0'); - nsEmbedCString unescapedHref; - rv = Unescape (nsEmbedCString(str), unescapedHref); + nsCString unescapedHref; + rv = Unescape (nsCString(str), unescapedHref); if (NS_SUCCEEDED (rv) && unescapedHref.Length()) { SetStringProperty ("email", unescapedHref.get()); @@ -525,7 +537,7 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, if (NS_SUCCEEDED(rv)) SetStringProperty ("link_type", tmp); - nsEmbedCString linkType; + nsCString linkType; NS_UTF16ToCString (tmp, NS_CSTRING_ENCODING_UTF8, linkType); if (g_ascii_strcasecmp (linkType.get(), "text/smartbookmark") == 0) @@ -541,7 +553,7 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, if (image) { - nsEmbedString img; + nsString img; rv = image->GetSrc (img); if (!NS_FAILED(rv)) { @@ -569,7 +581,7 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, do_QueryInterface(node, &rv); if (NS_SUCCEEDED(rv) && area) { - nsEmbedString href; + nsString href; rv = area->GetHref (href); if (NS_FAILED(rv)) return NS_ERROR_FAILURE; @@ -589,11 +601,11 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, if (!has_image) { - nsEmbedString cssurl; + nsString cssurl; rv = GetCSSBackground (node, cssurl); if (NS_SUCCEEDED (rv)) { - nsEmbedCString bgimg; + nsCString bgimg; rv = ResolveBaseURL (cssurl, bgimg); if (NS_FAILED (rv)) @@ -626,12 +638,12 @@ nsresult EventContext::GetCSSBackground (nsIDOMNode *node, nsAString& url) NS_ENSURE_TRUE (element, NS_ERROR_FAILURE); nsCOMPtr<nsIDOMCSSStyleDeclaration> decl; - mViewCSS->GetComputedStyle (element, nsEmbedString(), + mViewCSS->GetComputedStyle (element, nsString(), getter_AddRefs (decl)); NS_ENSURE_TRUE (decl, NS_ERROR_FAILURE); nsCOMPtr<nsIDOMCSSValue> CSSValue; - decl->GetPropertyCSSValue (nsEmbedString(bgimage), + decl->GetPropertyCSSValue (nsString(bgimage), getter_AddRefs (CSSValue)); nsCOMPtr<nsIDOMCSSPrimitiveValue> primitiveValue = @@ -694,17 +706,6 @@ nsresult EventContext::GetMouseEventInfo (nsIDOMMouseEvent *aMouseEvent, Mozilla info->button = 3; break; -#ifndef HAVE_GECKO_1_8 - case 1729: - /* This only appears to happen when getting a mouse context menu - * signal, so map it to button 3 (right mouse button) - * http://bugzilla.mozilla.org/show_bug.cgi?id=258193 - * Fixed since 1.8a4 - */ - info->button = 3; - break; -#endif - case (PRUint16) -1: /* when the user submits a form with Return, mozilla synthesises * a _mouse_ click event with btn=65535 (-1). @@ -748,9 +749,9 @@ nsresult EventContext::GetMouseEventInfo (nsIDOMMouseEvent *aMouseEvent, Mozilla nsCOMPtr<nsIDOMNode> OriginalNode = do_QueryInterface(OriginalTarget); if (!OriginalNode) return NS_ERROR_FAILURE; - nsEmbedString nodename; + nsString nodename; OriginalNode->GetNodeName(nodename); - nsEmbedCString cNodeName; + nsCString cNodeName; NS_UTF16ToCString (nodename, NS_CSTRING_ENCODING_UTF8, cNodeName); if (g_ascii_strcasecmp (cNodeName.get(), "xul:scrollbarbutton") == 0 || @@ -877,10 +878,10 @@ nsresult EventContext::CheckInput (nsIDOMNode *aNode) element = do_QueryInterface (aNode); if (!element) return NS_ERROR_FAILURE; - nsEmbedString uValue; - element->GetAttribute (nsEmbedString(typeLiteral), uValue); + nsString uValue; + element->GetAttribute (nsString(typeLiteral), uValue); - nsEmbedCString value; + nsCString value; NS_UTF16ToCString (uValue, NS_CSTRING_ENCODING_UTF8, value); if (g_ascii_strcasecmp (value.get(), "image") == 0) @@ -891,11 +892,11 @@ nsresult EventContext::CheckInput (nsIDOMNode *aNode) if (!input) return NS_ERROR_FAILURE; nsresult rv; - nsEmbedString img; + nsString img; rv = input->GetSrc (img); if (NS_FAILED(rv)) return NS_ERROR_FAILURE; - nsEmbedCString cImg; + nsCString cImg; rv = ResolveBaseURL (img, cImg); if (NS_FAILED(rv)) return NS_ERROR_FAILURE; SetStringProperty ("image", cImg.get()); @@ -925,7 +926,7 @@ nsresult EventContext::CheckLinkScheme (const nsAString &link) if (!uri) return NS_ERROR_FAILURE; nsresult rv; - nsEmbedCString scheme; + nsCString scheme; rv = uri->GetScheme (scheme); if (NS_FAILED (rv)) return NS_ERROR_FAILURE; @@ -973,7 +974,7 @@ nsresult EventContext::SetStringProperty (const char *name, const char *value) nsresult EventContext::SetStringProperty (const char *name, const nsAString &value) { - nsEmbedCString cValue; + nsCString cValue; NS_UTF16ToCString (value, NS_CSTRING_ENCODING_UTF8, cValue); return SetStringProperty (name, cValue.get()); } @@ -986,17 +987,17 @@ nsresult EventContext::SetURIProperty (nsIDOMNode *node, const char *name, const if (NS_SUCCEEDED (rv) && uri) { /* Hide password part */ - nsEmbedCString user; + nsCString user; uri->GetUsername (user); uri->SetUserPass (user); - nsEmbedCString spec; + nsCString spec; uri->GetSpec (spec); rv = SetStringProperty (name, spec.get()); } else { - rv = SetStringProperty (name, nsEmbedCString(value).get()); + rv = SetStringProperty (name, nsCString(value).get()); } return rv; @@ -1004,7 +1005,7 @@ nsresult EventContext::SetURIProperty (nsIDOMNode *node, const char *name, const nsresult EventContext::SetURIProperty (nsIDOMNode *node, const char *name, const nsAString &value) { - nsEmbedCString cValue; + nsCString cValue; NS_UTF16ToCString (value, NS_CSTRING_ENCODING_UTF8, cValue); return SetURIProperty (node, name, cValue); } @@ -1045,10 +1046,10 @@ EventContext::CheckKeyPress (nsIDOMKeyEvent *aEvent) nsCOMPtr<nsIDOMHTMLInputElement> inputElement (do_QueryInterface (target)); if (inputElement) { - nsEmbedString type; + nsString type; inputElement->GetType (type); - nsEmbedCString (cType); + nsCString (cType); NS_UTF16ToCString (type, NS_CSTRING_ENCODING_UTF8, cType); if (g_ascii_strcasecmp (cType.get(), "text") == 0 || @@ -1078,11 +1079,11 @@ EventContext::CheckKeyPress (nsIDOMKeyEvent *aEvent) nsCOMPtr<nsIDOMNSHTMLDocument> htmlDoc (do_QueryInterface (doc)); if (htmlDoc) { - nsEmbedString uDesign; + nsString uDesign; rv = htmlDoc->GetDesignMode (uDesign); NS_ENSURE_SUCCESS (rv, retval); - nsEmbedCString design; + nsCString design; NS_UTF16ToCString (uDesign, NS_CSTRING_ENCODING_UTF8, design); retval = g_ascii_strcasecmp (design.get(), "on") != 0; diff --git a/embed/mozilla/EventContext.h b/embed/mozilla/EventContext.h index 97e190437..0dbef5339 100644 --- a/embed/mozilla/EventContext.h +++ b/embed/mozilla/EventContext.h @@ -21,28 +21,21 @@ #ifndef EVENT_CONTEXT_H #define EVENT_CONTEXT_H -#include "EphyBrowser.h" - #include "ephy-embed.h" #include "mozilla-embed-event.h" -#include <nsIDOMEventTarget.h> -#include <nsIDOMMouseEvent.h> -#include <nsIDOMKeyEvent.h> -#include <nsIDOMEvent.h> -#include <nsIDOMNode.h> -#include <nsIDOMHTMLAnchorElement.h> -#include <nsIDOMHTMLAreaElement.h> -#include <nsIDOMHTMLBodyElement.h> -#include <nsIDOMDocument.h> -#include <nsIURI.h> -#undef MOZILLA_INTERNAL_API -#include <nsEmbedString.h> -#define MOZILLA_INTERNAL_API 1 - -#ifdef ALLOW_PRIVATE_API -#include <nsIDOMViewCSS.h> -#endif +class EphyBrowser; +class nsIDOMDocument; +class nsIDOMEvent; +class nsIDOMEventTarget; +class nsIDOMHTMLAnchorElement; +class nsIDOMHTMLAreaElement; +class nsIDOMHTMLBodyElement; +class nsIDOMKeyEvent; +class nsIDOMMouseEvent; +class nsIDOMNode; +class nsIDOMViewCSS; +class nsIURI; class EventContext { @@ -63,7 +56,7 @@ private: nsCOMPtr<nsIDOMDocument> mDOMDocument; nsCOMPtr<nsIDOMViewCSS> mViewCSS; nsCOMPtr<nsIURI> mBaseURI; - nsEmbedCString mCharset; + nsCString mCharset; nsresult GetTargetCoords (nsIDOMEventTarget *aTarget, PRInt32 *aX, PRInt32 *aY); nsresult GatherTextUnder (nsIDOMNode* aNode, nsAString& aResult); diff --git a/embed/mozilla/FilePicker.cpp b/embed/mozilla/FilePicker.cpp index 43b6b3688..d3445919a 100644 --- a/embed/mozilla/FilePicker.cpp +++ b/embed/mozilla/FilePicker.cpp @@ -20,38 +20,33 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "FilePicker.h" -#include "EphyUtils.h" -#include "AutoJSContextStack.h" +#include <glib/gconvert.h> +#include <glib/gi18n.h> +#include <gtk/gtkfilefilter.h> +#include <gtk/gtkmessagedialog.h> +#include <gtk/gtkstock.h> + +#include <nsStringAPI.h> #include <nsCOMPtr.h> -#undef MOZILLA_INTERNAL_API -#include <nsEmbedString.h> -#define MOZILLA_INTERNAL_API 1 -#include <nsIServiceManager.h> -#include <nsIURI.h> +#include <nsIDOMWindow.h> #include <nsIFileURL.h> #include <nsILocalFile.h> #include <nsIPromptService.h> -#include <nsIDOMWindow.h> +#include <nsIServiceManager.h> +#include <nsIURI.h> #include <nsNetCID.h> -#ifndef MOZ_NSIFILEPICKER_NSASTRING_ -#include <nsIDOMWindowInternal.h> -#endif - -#include "ephy-prefs.h" -#include "ephy-gui.h" #include "ephy-debug.h" +#include "ephy-gui.h" +#include "ephy-prefs.h" -#include <glib/gconvert.h> -#include <gtk/gtkfilefilter.h> -#include <gtk/gtkstock.h> -#include <gtk/gtkmessagedialog.h> -#include <glib/gi18n.h> +#include "AutoJSContextStack.h" +#include "EphyUtils.h" + +#include "FilePicker.h" NS_IMPL_ISUPPORTS1(GFilePicker, nsIFilePicker) @@ -87,11 +82,11 @@ NS_IMETHODIMP GFilePicker::Init(nsIDOMWindowInternal *parent, const PRUnichar *t NS_ENSURE_TRUE (gtkparent, NS_ERROR_FAILURE); #endif - nsEmbedCString cTitle; + nsCString cTitle; #ifdef MOZ_NSIFILEPICKER_NSASTRING_ NS_UTF16ToCString (title, NS_CSTRING_ENCODING_UTF8, cTitle); #else - NS_UTF16ToCString (nsEmbedString(title), NS_CSTRING_ENCODING_UTF8, cTitle); + NS_UTF16ToCString (nsString(title), NS_CSTRING_ENCODING_UTF8, cTitle); #endif mMode = mode; @@ -205,11 +200,11 @@ NS_IMETHODIMP GFilePicker::AppendFilter(const PRUnichar *title, const PRUnichar if (!filter) return NS_ERROR_FAILURE; #endif - nsEmbedCString pattern; + nsCString pattern; #ifdef MOZ_NSIFILEPICKER_NSASTRING_ NS_UTF16ToCString (filter, NS_CSTRING_ENCODING_UTF8, pattern); #else - NS_UTF16ToCString (nsEmbedString(filter), NS_CSTRING_ENCODING_UTF8, pattern); + NS_UTF16ToCString (nsString(filter), NS_CSTRING_ENCODING_UTF8, pattern); #endif char **patterns; @@ -224,11 +219,11 @@ NS_IMETHODIMP GFilePicker::AppendFilter(const PRUnichar *title, const PRUnichar gtk_file_filter_add_pattern (filth, g_strstrip (patterns[i])); } - nsEmbedCString cTitle; + nsCString cTitle; #ifdef MOZ_NSIFILEPICKER_NSASTRING_ NS_UTF16ToCString (title, NS_CSTRING_ENCODING_UTF8, cTitle); #else - NS_UTF16ToCString (nsEmbedString(title), NS_CSTRING_ENCODING_UTF8, cTitle); + NS_UTF16ToCString (nsString(title), NS_CSTRING_ENCODING_UTF8, cTitle); #endif gtk_file_filter_set_name (filth, cTitle.get()); @@ -272,7 +267,7 @@ NS_IMETHODIMP GFilePicker::SetDefaultString(const PRUnichar *aDefaultString) if (mMode == nsIFilePicker::modeSave) { - nsEmbedCString defaultString; + nsCString defaultString; NS_UTF16ToCString (mDefaultString, NS_CSTRING_ENCODING_UTF8, defaultString); @@ -338,7 +333,7 @@ NS_IMETHODIMP GFilePicker::GetDisplayDirectory(nsILocalFile **aDisplayDirectory) if (dir != NULL) { nsCOMPtr<nsILocalFile> file = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID); - file->InitWithNativePath (nsEmbedCString (dir)); + file->InitWithNativePath (nsCString (dir)); NS_IF_ADDREF (*aDisplayDirectory = file); g_free (dir); @@ -351,14 +346,14 @@ NS_IMETHODIMP GFilePicker::SetDisplayDirectory(nsILocalFile *aDisplayDirectory) { NS_ENSURE_TRUE (mDialog, NS_ERROR_FAILURE); - nsEmbedCString dir; + nsCString dir; aDisplayDirectory->GetNativePath (dir); LOG ("GFilePicker::SetDisplayDirectory to %s", dir.get()); if (mDefaultString.Length() && mMode != nsIFilePicker::modeSave) { - nsEmbedCString defaultString; + nsCString defaultString; NS_UTF16ToCString (mDefaultString, NS_CSTRING_ENCODING_NATIVE_FILESYSTEM, defaultString); @@ -390,7 +385,7 @@ NS_IMETHODIMP GFilePicker::GetFile(nsILocalFile **aFile) if (filename != NULL) { nsCOMPtr<nsILocalFile> file = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID); - file->InitWithNativePath (nsEmbedCString (filename)); + file->InitWithNativePath (nsCString (filename)); NS_IF_ADDREF (*aFile = file); g_free (filename); diff --git a/embed/mozilla/FilePicker.h b/embed/mozilla/FilePicker.h index 1c2283255..cdbfd243f 100644 --- a/embed/mozilla/FilePicker.h +++ b/embed/mozilla/FilePicker.h @@ -23,10 +23,6 @@ #define EPHY_FILEPICKER_H #include <nsIFilePicker.h> -#include <nsISupports.h> -#undef MOZILLA_INTERNAL_API -#include <nsEmbedString.h> -#define MOZILLA_INTERNAL_API 1 #include "ephy-file-chooser.h" @@ -57,7 +53,7 @@ public: private: EphyFileChooser *mDialog; PRInt16 mMode; - nsEmbedString mDefaultString; + nsString mDefaultString; }; #endif diff --git a/embed/mozilla/GlobalHistory.cpp b/embed/mozilla/GlobalHistory.cpp index 1cd19c513..6b09f4c92 100644 --- a/embed/mozilla/GlobalHistory.cpp +++ b/embed/mozilla/GlobalHistory.cpp @@ -20,17 +20,16 @@ */ #include "mozilla-config.h" - #include "config.h" +#include <nsStringAPI.h> + +#include <nsIURI.h> + #include "ephy-embed-shell.h" #include "GlobalHistory.h" -#include <nsIURI.h> -#undef MOZILLA_INTERNAL_API -#include <nsEmbedString.h> -#define MOZILLA_INTERNAL_API 1 #define MAX_TITLE_LENGTH 2048 #define MAX_URL_LENGTH 16384 @@ -53,18 +52,11 @@ MozGlobalHistory::~MozGlobalHistory () { } -#ifdef HAVE_GECKO_1_8 /* void addURI (in nsIURI aURI, in boolean aRedirect, in boolean aToplevel, in nsIURI aReferrer); */ NS_IMETHODIMP MozGlobalHistory::AddURI(nsIURI *aURI, PRBool aRedirect, PRBool aToplevel, nsIURI *aReferrer) -#else -/* void addURI (in nsIURI aURI, in boolean aRedirect, in boolean aToplevel); */ -NS_IMETHODIMP MozGlobalHistory::AddURI(nsIURI *aURI, - PRBool aRedirect, - PRBool aToplevel) -#endif { nsresult rv; @@ -101,7 +93,7 @@ NS_IMETHODIMP MozGlobalHistory::AddURI(nsIURI *aURI, } } - nsEmbedCString spec; + nsCString spec; rv = aURI->GetSpec(spec); NS_ENSURE_TRUE (NS_SUCCEEDED(rv) && spec.Length(), rv); @@ -120,7 +112,7 @@ NS_IMETHODIMP MozGlobalHistory::IsVisited(nsIURI *aURI, *_retval = PR_FALSE; - nsEmbedCString spec; + nsCString spec; aURI->GetSpec(spec); if (spec.Length () > MAX_URL_LENGTH) return NS_OK; @@ -136,12 +128,12 @@ NS_IMETHODIMP MozGlobalHistory::SetPageTitle(nsIURI *aURI, { NS_ENSURE_ARG (aURI); - nsEmbedCString spec; + nsCString spec; aURI->GetSpec(spec); if (spec.Length () > MAX_URL_LENGTH) return NS_OK; - nsEmbedString uTitle (aTitle); + nsString uTitle (aTitle); /* This depends on the assumption that * typeof(PRUnichar) == typeof (gunichar2) == uint16, @@ -171,7 +163,7 @@ MozGlobalHistory::GetURIGeckoFlags(nsIURI *aURI, { *aFlags = 0; - nsEmbedCString spec; + nsCString spec; aURI->GetSpec(spec); if (spec.Length () > MAX_URL_LENGTH) return NS_OK; @@ -196,7 +188,7 @@ NS_IMETHODIMP MozGlobalHistory::SetURIGeckoFlags(nsIURI *aURI, PRUint32 aFlags) { - nsEmbedCString spec; + nsCString spec; aURI->GetSpec(spec); if (spec.Length () > MAX_URL_LENGTH) return NS_OK; diff --git a/embed/mozilla/GlobalHistory.h b/embed/mozilla/GlobalHistory.h index edb01db5e..704d42202 100644 --- a/embed/mozilla/GlobalHistory.h +++ b/embed/mozilla/GlobalHistory.h @@ -22,16 +22,16 @@ #ifndef EPHY_GLOBAL_HISTORY_H #define EPHY_GLOBAL_HISTORY_H -#include "ephy-history.h" - #ifdef HAVE_NSIGLOBALHISTORY3_H #include <nsIGlobalHistory3.h> #else #include <nsIGlobalHistory2.h> #endif /* HAVE_NSIGLOBALHISTORY3_H */ -#include <nsCOMPtr.h> #include <nsAutoPtr.h> +#include <nsCOMPtr.h> + +#include "ephy-history.h" #include "EphyHistoryListener.h" diff --git a/embed/mozilla/GtkNSSClientAuthDialogs.cpp b/embed/mozilla/GtkNSSClientAuthDialogs.cpp index b5169823b..60171f345 100644 --- a/embed/mozilla/GtkNSSClientAuthDialogs.cpp +++ b/embed/mozilla/GtkNSSClientAuthDialogs.cpp @@ -21,47 +21,45 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "EphyUtils.h" -#include "AutoJSContextStack.h" - -#include <nsIDOMWindow.h> -#include <nsIServiceManager.h> -#include <nsIInterfaceRequestor.h> -#include <nsIInterfaceRequestorUtils.h> -#undef MOZILLA_INTERNAL_API -#include <nsEmbedString.h> -#define MOZILLA_INTERNAL_API 1 - +#include <glib/gi18n.h> +#include <gtk/gtkcelllayout.h> +#include <gtk/gtkcellrenderer.h> +#include <gtk/gtkcellrenderertext.h> +#include <gtk/gtkcombobox.h> #include <gtk/gtkdialog.h> +#include <gtk/gtkexpander.h> +#include <gtk/gtkhbox.h> #include <gtk/gtkimage.h> -#include <gtk/gtkstock.h> #include <gtk/gtklabel.h> -#include <gtk/gtkhbox.h> -#include <gtk/gtkvbox.h> -#include <gtk/gtktextbuffer.h> -#include <gtk/gtktextview.h> -#include <gtk/gtkprogressbar.h> -#include <gtk/gtkoptionmenu.h> +#include <gtk/gtkliststore.h> #include <gtk/gtkmenuitem.h> +#include <gtk/gtkoptionmenu.h> +#include <gtk/gtkprogressbar.h> #include <gtk/gtkscrolledwindow.h> +#include <gtk/gtkstock.h> +#include <gtk/gtktextbuffer.h> +#include <gtk/gtktextview.h> #include <gtk/gtktogglebutton.h> -#include <gtk/gtkexpander.h> -#include <gtk/gtkliststore.h> #include <gtk/gtktreemodel.h> -#include <gtk/gtkcelllayout.h> -#include <gtk/gtkcellrenderer.h> -#include <gtk/gtkcellrenderertext.h> -#include <gtk/gtkcombobox.h> -#include <glib/gi18n.h> +#include <gtk/gtkvbox.h> -#include "GtkNSSClientAuthDialogs.h" +#include <nsStringAPI.h> +#include <nsIDOMWindow.h> +#include <nsIInterfaceRequestor.h> +#include <nsIInterfaceRequestorUtils.h> +#include <nsIServiceManager.h> + +#include "ephy-debug.h" #include "ephy-gui.h" #include "ephy-state.h" -#include "ephy-debug.h" + +#include "AutoJSContextStack.h" +#include "EphyUtils.h" + +#include "GtkNSSClientAuthDialogs.h" GtkNSSClientAuthDialogs::GtkNSSClientAuthDialogs() { @@ -201,8 +199,8 @@ GtkNSSClientAuthDialogs::ChooseCertificate (nsIInterfaceRequestor *ctx, gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); - nsEmbedCString utf8_cn; - NS_UTF16ToCString (nsEmbedString (cn), + nsCString utf8_cn; + NS_UTF16ToCString (nsString (cn), NS_CSTRING_ENCODING_UTF8, utf8_cn); msg = g_markup_printf_escaped (_("Choose a certificate to present as identification to “%s”."), @@ -218,12 +216,12 @@ GtkNSSClientAuthDialogs::ChooseCertificate (nsIInterfaceRequestor *ctx, store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING); for (i = 0; i < count; i++) { - nsEmbedCString certnick; - nsEmbedCString certdetail; + nsCString certnick; + nsCString certdetail; - NS_UTF16ToCString (nsEmbedString (certNickList[i]), + NS_UTF16ToCString (nsString (certNickList[i]), NS_CSTRING_ENCODING_UTF8, certnick); - NS_UTF16ToCString (nsEmbedString (certDetailsList[i]), + NS_UTF16ToCString (nsString (certDetailsList[i]), NS_CSTRING_ENCODING_UTF8, certdetail); gtk_list_store_append (store, &iter); diff --git a/embed/mozilla/GtkNSSDialogs.cpp b/embed/mozilla/GtkNSSDialogs.cpp index c6489cf06..ea2d95e38 100644 --- a/embed/mozilla/GtkNSSDialogs.cpp +++ b/embed/mozilla/GtkNSSDialogs.cpp @@ -27,65 +27,66 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "EphyUtils.h" -#include "AutoJSContextStack.h" - -#include <nsCOMPtr.h> -#include <nsMemory.h> -#include <nsIServiceManager.h> -#include <nsIInterfaceRequestor.h> -#include <nsIInterfaceRequestorUtils.h> -#include <nsIX509Cert.h> -#include <nsIX509CertValidity.h> -#include <nsIX509CertDB.h> -#include <nsIASN1Object.h> -#include <nsIASN1Sequence.h> -#include <nsICRLInfo.h> -#include <nsISimpleEnumerator.h> -#include <nsIDOMWindow.h> -#include <nsIArray.h> -#ifdef HAVE_NSIMUTABLEARRAY_H -#include <nsIMutableArray.h> -#endif - -#undef MOZILLA_INTERNAL_API -#include <nsEmbedString.h> -#define MOZILLA_INTERNAL_API 1 +#include <time.h> #include <glib/gi18n.h> -#include <gtk/gtkdialog.h> -#include <gtk/gtkstock.h> -#include <gtk/gtkcheckbutton.h> -#include <gtk/gtktogglebutton.h> #include <gtk/gtkalignment.h> #include <gtk/gtkbutton.h> +#include <gtk/gtkcellrenderertext.h> +#include <gtk/gtkcheckbutton.h> +#include <gtk/gtkdialog.h> +#include <gtk/gtkeditable.h> +#include <gtk/gtkentry.h> #include <gtk/gtkhbox.h> -#include <gtk/gtkvbox.h> #include <gtk/gtkimage.h> #include <gtk/gtklabel.h> #include <gtk/gtkmessagedialog.h> -#include <gtk/gtkentry.h> -#include <gtk/gtkeditable.h> +#include <gtk/gtkprogressbar.h> +#include <gtk/gtksizegroup.h> +#include <gtk/gtkstock.h> #include <gtk/gtktable.h> -#include <gtk/gtktreestore.h> -#include <gtk/gtktreeview.h> -#include <gtk/gtkcellrenderertext.h> -#include <gtk/gtktreeselection.h> #include <gtk/gtktextbuffer.h> #include <gtk/gtktextview.h> -#include <gtk/gtkprogressbar.h> -#include <gtk/gtksizegroup.h> -#include <glade/glade-xml.h> +#include <gtk/gtktogglebutton.h> +#include <gtk/gtktreeselection.h> +#include <gtk/gtktreestore.h> +#include <gtk/gtktreeview.h> +#include <gtk/gtkvbox.h> #include <gconf/gconf-client.h> -#include <time.h> +#include <glade/glade-xml.h> + +#include <nsStringAPI.h> + +#include <nsCOMPtr.h> +#include <nsIArray.h> +#include <nsIASN1Object.h> +#include <nsIASN1Sequence.h> +#include <nsICRLInfo.h> +#include <nsIDOMWindow.h> +#include <nsIInterfaceRequestor.h> +#include <nsIInterfaceRequestorUtils.h> +#include <nsIServiceManager.h> +#include <nsISimpleEnumerator.h> +#include <nsIX509CertDB.h> +#include <nsIX509Cert.h> +#include <nsIX509CertValidity.h> +#include <nsMemory.h> +#include <nsServiceManagerUtils.h> + +#ifdef HAVE_NSIMUTABLEARRAY_H +#include <nsIMutableArray.h> +#endif -#include "GtkNSSDialogs.h" #include "ephy-file-helpers.h" #include "ephy-gui.h" +#include "AutoJSContextStack.h" +#include "EphyUtils.h" + +#include "GtkNSSDialogs.h" + NS_DEFINE_CID (kX509CertCID, NS_IX509CERT_IID); NS_DEFINE_CID (kASN1ObjectCID, NS_IASN1OBJECT_IID); @@ -308,14 +309,14 @@ GtkNSSDialogs::ConfirmMismatchDomain (nsIInterfaceRequestor *ctx, char *first, *second, *msg; int res; - nsEmbedString commonName; + nsString commonName; cert->GetCommonName (commonName); - nsEmbedCString cCommonName; + nsCString cCommonName; NS_UTF16ToCString (commonName, NS_CSTRING_ENCODING_UTF8, cCommonName); - nsEmbedCString cTargetUrl (targetURL); + nsCString cTargetUrl (targetURL); first = g_markup_printf_escaped (_("The site “%s” returned security information for " "“%s”. It is possible that someone is intercepting " @@ -351,10 +352,10 @@ GtkNSSDialogs::ConfirmUnknownIssuer (nsIInterfaceRequestor *ctx, char *secondary, *tertiary, *msg; int res; - nsEmbedString commonName; + nsString commonName; cert->GetCommonName (commonName); - nsEmbedCString cCommonName; + nsCString cCommonName; NS_UTF16ToCString (commonName, NS_CSTRING_ENCODING_UTF8, cCommonName); @@ -448,10 +449,10 @@ GtkNSSDialogs::ConfirmCertExpired (nsIInterfaceRequestor *ctx, timeToUse = notBefore; } - nsEmbedString commonName; + nsString commonName; cert->GetCommonName (commonName); - nsEmbedCString cCommonName; + nsCString cCommonName; NS_UTF16ToCString (commonName, NS_CSTRING_ENCODING_UTF8, cCommonName); @@ -505,14 +506,14 @@ GtkNSSDialogs::NotifyCrlNextupdate (nsIInterfaceRequestor *ctx, higgy_setup_dialog (GTK_DIALOG (dialog), GTK_STOCK_DIALOG_ERROR, &label, NULL); - nsEmbedString commonName; + nsString commonName; cert->GetCommonName (commonName); - nsEmbedCString cCommonName; + nsCString cCommonName; NS_UTF16ToCString (commonName, NS_CSTRING_ENCODING_UTF8, cCommonName); - nsEmbedCString cTargetUrl (targetURL); + nsCString cTargetUrl (targetURL); primary = g_markup_printf_escaped (_("Cannot establish connection to “%s”."), cTargetUrl.get()); @@ -577,10 +578,10 @@ GtkNSSDialogs::ConfirmDownloadCACert(nsIInterfaceRequestor *ctx, &label, NULL); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); - nsEmbedString commonName; + nsString commonName; cert->GetCommonName (commonName); - nsEmbedCString cCommonName; + nsCString cCommonName; NS_UTF16ToCString (commonName, NS_CSTRING_ENCODING_UTF8, cCommonName); @@ -872,7 +873,7 @@ GtkNSSDialogs::SetPKCS12FilePassword(nsIInterfaceRequestor *ctx, else { gchar *text = gtk_editable_get_chars (GTK_EDITABLE (entry1), 0, -1); - NS_CStringToUTF16 (nsEmbedCString (text), + NS_CStringToUTF16 (nsCString (text), NS_CSTRING_ENCODING_UTF8, _password); g_free (text); *_retval = PR_TRUE; @@ -945,7 +946,7 @@ GtkNSSDialogs::GetPKCS12FilePassword(nsIInterfaceRequestor *ctx, else { gchar * text = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1); - NS_CStringToUTF16 (nsEmbedCString (text), + NS_CStringToUTF16 (nsCString (text), NS_CSTRING_ENCODING_UTF8, _password); g_free (text); *_retval = PR_TRUE; @@ -1024,7 +1025,7 @@ GtkNSSDialogs::CrlImportStatusDialog(nsIInterfaceRequestor *ctx, nsICRLInfo *crl gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_table_set_col_spacings (GTK_TABLE (table), 12); - nsEmbedString org, orgUnit, nextUpdate; + nsString org, orgUnit, nextUpdate; rv = crl->GetOrganization (org); if (NS_FAILED(rv)) return rv; @@ -1035,15 +1036,15 @@ GtkNSSDialogs::CrlImportStatusDialog(nsIInterfaceRequestor *ctx, nsICRLInfo *crl if (NS_FAILED(rv)) return rv; int row = 0; - nsEmbedCString cOrg; + nsCString cOrg; NS_UTF16ToCString (org, NS_CSTRING_ENCODING_UTF8, cOrg); set_table_row (table, row, _("Organization:"), cOrg.get ()); - nsEmbedCString cOrgUnit; + nsCString cOrgUnit; NS_UTF16ToCString (orgUnit, NS_CSTRING_ENCODING_UTF8, cOrgUnit); set_table_row (table, row, _("Unit:"), cOrgUnit.get ()); - nsEmbedCString cNextUpdate; + nsCString cNextUpdate; NS_UTF16ToCString (nextUpdate, NS_CSTRING_ENCODING_UTF8, cNextUpdate); set_table_row (table, row, _("Next Update:"), cNextUpdate.get ()); @@ -1078,7 +1079,7 @@ set_label_cert_attribute (GladeXML* gxml, const char* label_id, nsAString &value } else { - nsEmbedCString cValue; + nsCString cValue; NS_UTF16ToCString (value, NS_CSTRING_ENCODING_UTF8, cValue); gtk_label_set_use_markup (GTK_LABEL (label), FALSE); gtk_label_set_text (GTK_LABEL (label), cValue.get()); @@ -1111,11 +1112,11 @@ fill_cert_chain_tree (GtkTreeView *treeview, nsIArray *certChain) gtk_tree_store_append (GTK_TREE_STORE (model), &iter, (i == (int)numCerts-1) ? NULL : &parent); - nsEmbedString value; + nsString value; rv = nsCert->GetCommonName (value); if (NS_FAILED(rv)) return FALSE; - nsEmbedCString cValue; + nsCString cValue; NS_UTF16ToCString (value, NS_CSTRING_ENCODING_UTF8, cValue); nsIX509Cert *nsCertP = nsCert; @@ -1157,10 +1158,10 @@ fill_cert_chain_tree (GtkTreeView *treeview, nsIArray *certChain) static void add_asn1_object_to_tree(GtkTreeModel *model, nsIASN1Object *object, GtkTreeIter *parent) { - nsEmbedString dispNameU; + nsString dispNameU; object->GetDisplayName(dispNameU); - nsEmbedCString cDispNameU; + nsCString cDispNameU; NS_UTF16ToCString (dispNameU, NS_CSTRING_ENCODING_UTF8, cDispNameU); GtkTreeIter iter; @@ -1239,10 +1240,10 @@ field_tree_view_selection_changed_cb (GtkTreeSelection *selection, gtk_tree_model_get (model, &iter, 1, &object, -1); - nsEmbedString dispValU; + nsString dispValU; object->GetDisplayValue(dispValU); - nsEmbedCString cDispValU; + nsCString cDispValU; NS_UTF16ToCString (dispValU, NS_CSTRING_ENCODING_UTF8, cDispValU); gtk_text_buffer_set_text (text_buffer, cDispValU.get(), -1); @@ -1337,7 +1338,7 @@ GtkNSSDialogs::ViewCert(nsIInterfaceRequestor *ctx, { GtkWidget *dialog, *widget; GladeXML *gxml; - nsEmbedString value; + nsString value; PRUint32 verifystate, count; PRUnichar ** usage; GtkSizeGroup * sizegroup; @@ -1426,8 +1427,8 @@ GtkNSSDialogs::ViewCert(nsIInterfaceRequestor *ctx, GtkWidget *indent; for (PRUint32 i = 0 ; i < count ; i++) { - nsEmbedCString msg; - NS_UTF16ToCString (nsEmbedString(usage[i]), + nsCString msg; + NS_UTF16ToCString (nsString(usage[i]), NS_CSTRING_ENCODING_UTF8, msg); GtkWidget *label = gtk_label_new(msg.get()); diff --git a/embed/mozilla/GtkNSSKeyPairDialogs.cpp b/embed/mozilla/GtkNSSKeyPairDialogs.cpp index e5f5c35cd..24ec23f25 100644 --- a/embed/mozilla/GtkNSSKeyPairDialogs.cpp +++ b/embed/mozilla/GtkNSSKeyPairDialogs.cpp @@ -36,39 +36,32 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "EphyUtils.h" -#include "AutoJSContextStack.h" +#include <glib/gi18n.h> +#include <gtk/gtkdialog.h> +#include <gtk/gtkhbox.h> +#include <gtk/gtkimage.h> +#include <gtk/gtklabel.h> +#include <gtk/gtkmain.h> +#include <gtk/gtkprogressbar.h> +#include <gtk/gtkstock.h> +#include <gtk/gtkvbox.h> -#include <nsIServiceManager.h> +#include <nsIDOMWindow.h> #include <nsIInterfaceRequestor.h> #include <nsIInterfaceRequestorUtils.h> #include <nsIKeygenThread.h> -#include <nsIDOMWindow.h> - -#ifdef HAVE_GECKO_1_8 #include <nsIObserver.h> -#else /* !HAVE_GECKO_1_8 */ -#ifdef ALLOW_PRIVATE_API -#include <nsIDOMWindowInternal.h> -#endif /* ALLOW_PRIVATE_API */ -#endif /* HAVE_GECKO_1_8 */ +#include <nsIServiceManager.h> -#include <gtk/gtkdialog.h> -#include <gtk/gtkprogressbar.h> -#include <gtk/gtkimage.h> -#include <gtk/gtkstock.h> -#include <gtk/gtklabel.h> -#include <gtk/gtkhbox.h> -#include <gtk/gtkvbox.h> -#include <gtk/gtkmain.h> -#include <glib/gi18n.h> +#include "ephy-debug.h" +#include "ephy-gui.h" + +#include "AutoJSContextStack.h" +#include "EphyUtils.h" #include "GtkNSSKeyPairDialogs.h" -#include "ephy-gui.h" -#include "ephy-debug.h" GtkNSSKeyPairDialogs::GtkNSSKeyPairDialogs () { @@ -83,8 +76,6 @@ GtkNSSKeyPairDialogs::~GtkNSSKeyPairDialogs () NS_IMPL_THREADSAFE_ISUPPORTS1 (GtkNSSKeyPairDialogs, nsIGeneratingKeypairInfoDialogs) -#ifdef HAVE_GECKO_1_8 - class KeyPairObserver : public nsIObserver { public: @@ -106,43 +97,6 @@ NS_IMETHODIMP KeyPairObserver::Observe (nsISupports *aSubject, const char *aTopi return NS_OK; } -#else /* !HAVE_GECKO_1_8 */ - -/* ------------------------------------------------------------ - * A dummy implementation of nsIDomWindowInternal so that - * we can use the correctly get callbacks from the - * nsIKeygenThread */ -class KeyPairHelperWindow : public nsIDOMWindowInternal -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIDOMWINDOWINTERNAL - NS_DECL_NSIDOMWINDOW - NS_DECL_NSIDOMWINDOW2 - - KeyPairHelperWindow(); - virtual ~KeyPairHelperWindow(); - - gboolean close_called; -}; - -NS_IMPL_ISUPPORTS3(KeyPairHelperWindow, nsIDOMWindowInternal, nsIDOMWindow, nsIDOMWindow2) - -KeyPairHelperWindow::KeyPairHelperWindow() -{ - close_called = FALSE; -} - -NS_IMETHODIMP KeyPairHelperWindow::Close() -{ - /* This is called in a different thread, so just set a flag, dont - * call the dialog_response directly */ - close_called = TRUE; - return NS_OK; -} - -#endif /* HAVE_GECKO_1_8 */ - /* ------------------------------------------------------------ */ static void begin_busy (GtkWidget *widget) @@ -168,11 +122,7 @@ struct KeyPairInfo { GtkWidget *progress; GtkWidget *dialog; -#ifdef HAVE_GECKO_1_8 KeyPairObserver *helper; -#else - KeyPairHelperWindow *helper; -#endif /* HAVE_GECKO_1_8 */ }; @@ -243,11 +193,7 @@ GtkNSSKeyPairDialogs::DisplayGeneratingKeypairInfo (nsIInterfaceRequestor *ctx, /* Create a helper class that just waits for close events * from the other thread */ -#ifdef HAVE_GECKO_1_8 nsCOMPtr<KeyPairObserver> helper = new KeyPairObserver; -#else - nsCOMPtr<KeyPairHelperWindow> helper = new KeyPairHelperWindow; -#endif KeyPairInfo callback_data = { progress, dialog, helper }; timeout_id = g_timeout_add (100, (GSourceFunc)generating_timeout_cb, &callback_data); @@ -272,493 +218,3 @@ GtkNSSKeyPairDialogs::DisplayGeneratingKeypairInfo (nsIInterfaceRequestor *ctx, gtk_widget_destroy (dialog); return NS_OK; } - -#ifndef HAVE_GECKO_1_8 - -/************************************************************* - * Misc functions for the nsIDomWindowInternal implementation - * that arn't needed for our purposes - *************************************************************/ - -#define MOZ_NOT_IMPLEMENTED { g_warning ("not implemented: %s", G_STRLOC); \ - return NS_ERROR_NOT_IMPLEMENTED; } - -KeyPairHelperWindow::~KeyPairHelperWindow() -{ -} - -/* readonly attribute nsIDOMWindowInternal window; */ -NS_IMETHODIMP KeyPairHelperWindow::GetWindow(nsIDOMWindowInternal * *aWindow) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute nsIDOMWindowInternal self; */ -NS_IMETHODIMP KeyPairHelperWindow::GetSelf(nsIDOMWindowInternal * *aSelf) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute nsIDOMNavigator navigator; */ -NS_IMETHODIMP KeyPairHelperWindow::GetNavigator(nsIDOMNavigator * *aNavigator) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute nsIDOMScreen screen; */ -NS_IMETHODIMP KeyPairHelperWindow::GetScreen(nsIDOMScreen * *aScreen) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute nsIDOMHistory history; */ -NS_IMETHODIMP KeyPairHelperWindow::GetHistory(nsIDOMHistory * *aHistory) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute nsIDOMWindow content; */ -NS_IMETHODIMP KeyPairHelperWindow::GetContent(nsIDOMWindow * *aContent) -{ - MOZ_NOT_IMPLEMENTED -} - -/* [noscript] readonly attribute nsIPrompt prompter; */ -NS_IMETHODIMP KeyPairHelperWindow::GetPrompter(nsIPrompt * *aPrompter) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute nsIDOMBarProp menubar; */ -NS_IMETHODIMP KeyPairHelperWindow::GetMenubar(nsIDOMBarProp * *aMenubar) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute nsIDOMBarProp toolbar; */ -NS_IMETHODIMP KeyPairHelperWindow::GetToolbar(nsIDOMBarProp * *aToolbar) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute nsIDOMBarProp locationbar; */ -NS_IMETHODIMP KeyPairHelperWindow::GetLocationbar(nsIDOMBarProp * *aLocationbar) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute nsIDOMBarProp personalbar; */ -NS_IMETHODIMP KeyPairHelperWindow::GetPersonalbar(nsIDOMBarProp * *aPersonalbar) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute nsIDOMBarProp statusbar; */ -NS_IMETHODIMP KeyPairHelperWindow::GetStatusbar(nsIDOMBarProp * *aStatusbar) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute nsIDOMBarProp directories; */ -NS_IMETHODIMP KeyPairHelperWindow::GetDirectories(nsIDOMBarProp * *aDirectories) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute boolean closed; */ -NS_IMETHODIMP KeyPairHelperWindow::GetClosed(PRBool *aClosed) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute nsIDOMCrypto crypto; */ -NS_IMETHODIMP KeyPairHelperWindow::GetCrypto(nsIDOMCrypto * *aCrypto) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute nsIDOMPkcs11 pkcs11; */ -NS_IMETHODIMP KeyPairHelperWindow::GetPkcs11(nsIDOMPkcs11 * *aPkcs11) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute nsIControllers controllers; */ -NS_IMETHODIMP KeyPairHelperWindow::GetControllers(nsIControllers * *aControllers) -{ - MOZ_NOT_IMPLEMENTED -} - -/* attribute nsIDOMWindowInternal opener; */ -NS_IMETHODIMP KeyPairHelperWindow::GetOpener(nsIDOMWindowInternal * *aOpener) -{ - MOZ_NOT_IMPLEMENTED -} -NS_IMETHODIMP KeyPairHelperWindow::SetOpener(nsIDOMWindowInternal * aOpener) -{ - MOZ_NOT_IMPLEMENTED -} - -/* attribute DOMString status; */ -NS_IMETHODIMP KeyPairHelperWindow::GetStatus(nsAString & aStatus) -{ - MOZ_NOT_IMPLEMENTED -} -NS_IMETHODIMP KeyPairHelperWindow::SetStatus(const nsAString & aStatus) -{ - MOZ_NOT_IMPLEMENTED -} - -/* attribute DOMString defaultStatus; */ -NS_IMETHODIMP KeyPairHelperWindow::GetDefaultStatus(nsAString & aDefaultStatus) -{ - MOZ_NOT_IMPLEMENTED -} -NS_IMETHODIMP KeyPairHelperWindow::SetDefaultStatus(const nsAString & aDefaultStatus) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute nsIDOMLocation location; */ -NS_IMETHODIMP KeyPairHelperWindow::GetLocation(nsIDOMLocation * *aLocation) -{ - MOZ_NOT_IMPLEMENTED -} - -/* attribute long innerWidth; */ -NS_IMETHODIMP KeyPairHelperWindow::GetInnerWidth(PRInt32 *aInnerWidth) -{ - MOZ_NOT_IMPLEMENTED -} -NS_IMETHODIMP KeyPairHelperWindow::SetInnerWidth(PRInt32 aInnerWidth) -{ - MOZ_NOT_IMPLEMENTED -} - -/* attribute long innerHeight; */ -NS_IMETHODIMP KeyPairHelperWindow::GetInnerHeight(PRInt32 *aInnerHeight) -{ - MOZ_NOT_IMPLEMENTED -} -NS_IMETHODIMP KeyPairHelperWindow::SetInnerHeight(PRInt32 aInnerHeight) -{ - MOZ_NOT_IMPLEMENTED -} - -/* attribute long outerWidth; */ -NS_IMETHODIMP KeyPairHelperWindow::GetOuterWidth(PRInt32 *aOuterWidth) -{ - MOZ_NOT_IMPLEMENTED -} -NS_IMETHODIMP KeyPairHelperWindow::SetOuterWidth(PRInt32 aOuterWidth) -{ - MOZ_NOT_IMPLEMENTED -} - -/* attribute long outerHeight; */ -NS_IMETHODIMP KeyPairHelperWindow::GetOuterHeight(PRInt32 *aOuterHeight) -{ - MOZ_NOT_IMPLEMENTED -} -NS_IMETHODIMP KeyPairHelperWindow::SetOuterHeight(PRInt32 aOuterHeight) -{ - MOZ_NOT_IMPLEMENTED -} - -/* attribute long screenX; */ -NS_IMETHODIMP KeyPairHelperWindow::GetScreenX(PRInt32 *aScreenX) -{ - MOZ_NOT_IMPLEMENTED -} -NS_IMETHODIMP KeyPairHelperWindow::SetScreenX(PRInt32 aScreenX) -{ - MOZ_NOT_IMPLEMENTED -} - -/* attribute long screenY; */ -NS_IMETHODIMP KeyPairHelperWindow::GetScreenY(PRInt32 *aScreenY) -{ - MOZ_NOT_IMPLEMENTED -} -NS_IMETHODIMP KeyPairHelperWindow::SetScreenY(PRInt32 aScreenY) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute long pageXOffset; */ -NS_IMETHODIMP KeyPairHelperWindow::GetPageXOffset(PRInt32 *aPageXOffset) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute long pageYOffset; */ -NS_IMETHODIMP KeyPairHelperWindow::GetPageYOffset(PRInt32 *aPageYOffset) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute long scrollMaxX; */ -NS_IMETHODIMP KeyPairHelperWindow::GetScrollMaxX(PRInt32 *aScrollMaxX) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute long scrollMaxY; */ -NS_IMETHODIMP KeyPairHelperWindow::GetScrollMaxY(PRInt32 *aScrollMaxY) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute unsigned long length; */ -NS_IMETHODIMP KeyPairHelperWindow::GetLength(PRUint32 *aLength) -{ - MOZ_NOT_IMPLEMENTED -} - -/* attribute boolean fullScreen; */ -NS_IMETHODIMP KeyPairHelperWindow::GetFullScreen(PRBool *aFullScreen) -{ - MOZ_NOT_IMPLEMENTED -} -NS_IMETHODIMP KeyPairHelperWindow::SetFullScreen(PRBool aFullScreen) -{ - MOZ_NOT_IMPLEMENTED -} - -/* void alert (in DOMString text); */ -NS_IMETHODIMP KeyPairHelperWindow::Alert(const nsAString & text) -{ - MOZ_NOT_IMPLEMENTED -} - -/* boolean confirm (in DOMString text); */ -NS_IMETHODIMP KeyPairHelperWindow::Confirm(const nsAString & text, PRBool *_retval) -{ - MOZ_NOT_IMPLEMENTED -} - -/* DOMString prompt (in DOMString aMessage, in DOMString aInitial, in DOMString aTitle, in unsigned long aSavePassword); */ -NS_IMETHODIMP KeyPairHelperWindow::Prompt(const nsAString & aMessage, const nsAString & aInitial, const nsAString & aTitle, PRUint32 aSavePassword, nsAString & _retval) -{ - MOZ_NOT_IMPLEMENTED -} - -/* void focus (); */ -NS_IMETHODIMP KeyPairHelperWindow::Focus() -{ - MOZ_NOT_IMPLEMENTED -} - -/* void blur (); */ -NS_IMETHODIMP KeyPairHelperWindow::Blur() -{ - MOZ_NOT_IMPLEMENTED -} - -/* void back (); */ -NS_IMETHODIMP KeyPairHelperWindow::Back() -{ - MOZ_NOT_IMPLEMENTED -} - -/* void forward (); */ -NS_IMETHODIMP KeyPairHelperWindow::Forward() -{ - MOZ_NOT_IMPLEMENTED -} - -/* void home (); */ -NS_IMETHODIMP KeyPairHelperWindow::Home() -{ - MOZ_NOT_IMPLEMENTED -} - -/* void stop (); */ -NS_IMETHODIMP KeyPairHelperWindow::Stop() -{ - MOZ_NOT_IMPLEMENTED -} - -/* void print (); */ -NS_IMETHODIMP KeyPairHelperWindow::Print() -{ - MOZ_NOT_IMPLEMENTED -} - -/* void moveTo (in long xPos, in long yPos); */ -NS_IMETHODIMP KeyPairHelperWindow::MoveTo(PRInt32 xPos, PRInt32 yPos) -{ - MOZ_NOT_IMPLEMENTED -} - -/* void moveBy (in long xDif, in long yDif); */ -NS_IMETHODIMP KeyPairHelperWindow::MoveBy(PRInt32 xDif, PRInt32 yDif) -{ - MOZ_NOT_IMPLEMENTED -} - -/* void resizeTo (in long width, in long height); */ -NS_IMETHODIMP KeyPairHelperWindow::ResizeTo(PRInt32 width, PRInt32 height) -{ - MOZ_NOT_IMPLEMENTED -} - -/* void resizeBy (in long widthDif, in long heightDif); */ -NS_IMETHODIMP KeyPairHelperWindow::ResizeBy(PRInt32 widthDif, PRInt32 heightDif) -{ - MOZ_NOT_IMPLEMENTED -} - -/* void scroll (in long xScroll, in long yScroll); */ -NS_IMETHODIMP KeyPairHelperWindow::Scroll(PRInt32 xScroll, PRInt32 yScroll) -{ - MOZ_NOT_IMPLEMENTED -} - -/* [noscript] nsIDOMWindow open (in DOMString url, in DOMString name, in DOMString options); */ -NS_IMETHODIMP KeyPairHelperWindow::Open(const nsAString & url, const nsAString & name, const nsAString & options, nsIDOMWindow **_retval) -{ - MOZ_NOT_IMPLEMENTED -} - -/* [noscript] nsIDOMWindow openDialog (in DOMString url, in DOMString name, in DOMString options, in nsISupports aExtraArgument); */ -NS_IMETHODIMP KeyPairHelperWindow::OpenDialog(const nsAString & url, const nsAString & name, const nsAString & options, nsISupports *aExtraArgument, nsIDOMWindow **_retval) -{ - MOZ_NOT_IMPLEMENTED -} - -/* void updateCommands (in DOMString action); */ -NS_IMETHODIMP KeyPairHelperWindow::UpdateCommands(const nsAString & action) -{ - MOZ_NOT_IMPLEMENTED -} - -/* [noscript] boolean find (in DOMString str, in boolean caseSensitive, in boolean backwards, in boolean wrapAround, in boolean wholeWord, in boolean searchInFrames, in boolean showDialog); */ -NS_IMETHODIMP KeyPairHelperWindow::Find(const nsAString & str, PRBool caseSensitive, PRBool backwards, PRBool wrapAround, PRBool wholeWord, PRBool searchInFrames, PRBool showDialog, PRBool *_retval) -{ - MOZ_NOT_IMPLEMENTED -} - -/* DOMString atob (in DOMString aAsciiString); */ -NS_IMETHODIMP KeyPairHelperWindow::Atob(const nsAString & aAsciiString, nsAString & _retval) -{ - MOZ_NOT_IMPLEMENTED -} - -/* DOMString btoa (in DOMString aBase64Data); */ -NS_IMETHODIMP KeyPairHelperWindow::Btoa(const nsAString & aBase64Data, nsAString & _retval) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute nsIDOMElement frameElement; */ -NS_IMETHODIMP KeyPairHelperWindow::GetFrameElement(nsIDOMElement * *aFrameElement) -{ - MOZ_NOT_IMPLEMENTED -} - - -/* readonly attribute nsIDOMDocument document; */ -NS_IMETHODIMP KeyPairHelperWindow::GetDocument(nsIDOMDocument * *aDocument) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute nsIDOMWindow parent; */ -NS_IMETHODIMP KeyPairHelperWindow::GetParent(nsIDOMWindow * *aParent) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute nsIDOMWindow top; */ -NS_IMETHODIMP KeyPairHelperWindow::GetTop(nsIDOMWindow * *aTop) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute nsIDOMBarProp scrollbars; */ -NS_IMETHODIMP KeyPairHelperWindow::GetScrollbars(nsIDOMBarProp * *aScrollbars) -{ - MOZ_NOT_IMPLEMENTED -} - -/* [noscript] readonly attribute nsIDOMWindowCollection frames; */ -NS_IMETHODIMP KeyPairHelperWindow::GetFrames(nsIDOMWindowCollection * *aFrames) -{ - MOZ_NOT_IMPLEMENTED -} - -/* attribute DOMString name; */ -NS_IMETHODIMP KeyPairHelperWindow::GetName(nsAString & aName) -{ - MOZ_NOT_IMPLEMENTED -} -NS_IMETHODIMP KeyPairHelperWindow::SetName(const nsAString & aName) -{ - MOZ_NOT_IMPLEMENTED -} - -/* [noscript] attribute float textZoom; */ -NS_IMETHODIMP KeyPairHelperWindow::GetTextZoom(float *aTextZoom) -{ - MOZ_NOT_IMPLEMENTED -} -NS_IMETHODIMP KeyPairHelperWindow::SetTextZoom(float aTextZoom) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute long scrollX; */ -NS_IMETHODIMP KeyPairHelperWindow::GetScrollX(PRInt32 *aScrollX) -{ - MOZ_NOT_IMPLEMENTED -} - -/* readonly attribute long scrollY; */ -NS_IMETHODIMP KeyPairHelperWindow::GetScrollY(PRInt32 *aScrollY) -{ - MOZ_NOT_IMPLEMENTED -} - -/* void scrollTo (in long xScroll, in long yScroll); */ -NS_IMETHODIMP KeyPairHelperWindow::ScrollTo(PRInt32 xScroll, PRInt32 yScroll) -{ - MOZ_NOT_IMPLEMENTED -} - -/* void scrollBy (in long xScrollDif, in long yScrollDif); */ -NS_IMETHODIMP KeyPairHelperWindow::ScrollBy(PRInt32 xScrollDif, PRInt32 yScrollDif) -{ - MOZ_NOT_IMPLEMENTED -} - -/* nsISelection getSelection (); */ -NS_IMETHODIMP KeyPairHelperWindow::GetSelection(nsISelection **_retval) -{ - MOZ_NOT_IMPLEMENTED -} - -/* void scrollByLines (in long numLines); */ -NS_IMETHODIMP KeyPairHelperWindow::ScrollByLines(PRInt32 numLines) -{ - MOZ_NOT_IMPLEMENTED -} - -/* void scrollByPages (in long numPages); */ -NS_IMETHODIMP KeyPairHelperWindow::ScrollByPages(PRInt32 numPages) -{ - MOZ_NOT_IMPLEMENTED -} - -/* void sizeToContent (); */ -NS_IMETHODIMP KeyPairHelperWindow::SizeToContent() -{ - MOZ_NOT_IMPLEMENTED -} - -NS_IMETHODIMP KeyPairHelperWindow::GetWindowRoot(nsIDOMEventTarget * *aWindowRoot) -{ - MOZ_NOT_IMPLEMENTED -} - -#endif /* !HAVE_GECKO_1_8 */ diff --git a/embed/mozilla/GtkNSSSecurityWarningDialogs.cpp b/embed/mozilla/GtkNSSSecurityWarningDialogs.cpp index 72b722aae..02fc23330 100644 --- a/embed/mozilla/GtkNSSSecurityWarningDialogs.cpp +++ b/embed/mozilla/GtkNSSSecurityWarningDialogs.cpp @@ -42,27 +42,28 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "GtkNSSSecurityWarningDialogs.h" -#include "EphyUtils.h" -#include "AutoJSContextStack.h" +#include <glib/gi18n.h> +#include <gtk/gtkbox.h> +#include <gtk/gtkdialog.h> +#include <gtk/gtkhbox.h> +#include <gtk/gtklabel.h> +#include <gtk/gtkvbox.h> #include <nsCOMPtr.h> +#include <nsIDOMWindow.h> +#include <nsIInterfaceRequestor.h> +#include <nsIInterfaceRequestorUtils.h> #include <nsIPrefBranch.h> #include <nsIPrefService.h> #include <nsIServiceManager.h> -#include <nsIInterfaceRequestor.h> -#include <nsIInterfaceRequestorUtils.h> -#include <nsIDOMWindow.h> +#include <nsServiceManagerUtils.h> -#include <glib/gi18n.h> -#include <gtk/gtkdialog.h> -#include <gtk/gtkbox.h> -#include <gtk/gtkhbox.h> -#include <gtk/gtkvbox.h> -#include <gtk/gtklabel.h> +#include "AutoJSContextStack.h" +#include "EphyUtils.h" + +#include "GtkNSSSecurityWarningDialogs.h" NS_IMPL_THREADSAFE_ISUPPORTS1 (GtkNSSSecurityWarningDialogs, nsISecurityWarningDialogs) diff --git a/embed/mozilla/GtkNSSSecurityWarningDialogs.h b/embed/mozilla/GtkNSSSecurityWarningDialogs.h index c60e05509..2eda70262 100644 --- a/embed/mozilla/GtkNSSSecurityWarningDialogs.h +++ b/embed/mozilla/GtkNSSSecurityWarningDialogs.h @@ -44,9 +44,10 @@ #ifndef GTK_NSSSECURITYDIALOGS_H #define GTK_NSSSECURITYDIALOGS_H -#include <nsISecurityWarningDialogs.h> #include <gtk/gtkmessagedialog.h> +#include <nsISecurityWarningDialogs.h> + #define GTK_NSSSECURITYWARNINGDIALOGS_CLASSNAME "Epiphany Security Warning Dialogs Class" #define GTK_NSSSECURITYWARNINGDIALOGS_CID \ { \ diff --git a/embed/mozilla/Makefile.am b/embed/mozilla/Makefile.am index f7285d45e..d89299876 100644 --- a/embed/mozilla/Makefile.am +++ b/embed/mozilla/Makefile.am @@ -7,6 +7,8 @@ libephymozillaembed_la_SOURCES = \ ContentHandler.h \ EphyAboutModule.cpp \ EphyAboutModule.h \ + EphyBadCertRejector.cpp \ + EphyBadCertRejector.h \ EphyContentPolicy.cpp \ EphyContentPolicy.h \ EphyHeaderSniffer.cpp \ @@ -78,20 +80,14 @@ libephymozillaembed_la_SOURCES += \ mozilla-x509-cert.h endif -if HAVE_GECKO_1_8 -libephymozillaembed_la_SOURCES += \ - EphyBadCertRejector.cpp \ - EphyBadCertRejector.h - if HAVE_MOZILLA_TOOLKIT libephymozillaembed_la_SOURCES += \ - EphyDirectoryProvider.cpp \ + EphyDirectoryProvider.cpp \ EphyDirectoryProvider.h endif -endif - mozilla_include_subdirs = \ + . \ caps \ chardet \ chrome \ @@ -103,6 +99,7 @@ mozilla_include_subdirs = \ exthandler \ fastfind \ helperAppDlg \ + find \ gfx \ gtkembedmoz \ history \ @@ -115,6 +112,7 @@ mozilla_include_subdirs = \ passwordmgr \ pipboot \ pipnss \ + pref \ shistory \ sidebar \ uriloader \ @@ -128,17 +126,10 @@ mozilla_include_subdirs = \ xpcom \ xpconnect -# Grr, damn gentoo has a dodgy header layout -# http://bugs.gentoo.org/show_bug.cgi?id=100804 -mozilla_include_subdirs += \ - find \ - pref - libephymozillaembed_la_CPPFLAGS = \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/embed \ -I$(top_srcdir) \ - -I$(MOZILLA_INCLUDE_ROOT) \ $(addprefix -I$(MOZILLA_INCLUDE_ROOT)/,$(mozilla_include_subdirs)) \ -DSHARE_DIR=\"$(pkgdatadir)\" \ -DPLUGINDIR=\"$(libdir)/epiphany/$(EPIPHANY_MAJOR)/plugins\" \ diff --git a/embed/mozilla/MozDownload.cpp b/embed/mozilla/MozDownload.cpp index 8aa2ad334..7a7b115a8 100644 --- a/embed/mozilla/MozDownload.cpp +++ b/embed/mozilla/MozDownload.cpp @@ -42,38 +42,40 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "mozilla-download.h" -#include "eel-gconf-extensions.h" -#include "ephy-prefs.h" -#include "ephy-file-helpers.h" -#include "ephy-debug.h" -#include "MozDownload.h" -#include "EphyUtils.h" +#include <stdlib.h> #include <glib/gi18n.h> -#include <nsIIOService.h> -#include <nsIURI.h> +#include <nsStringAPI.h> + +#include <nsComponentManagerUtils.h> +#include <nsICancelable.h> #include <nsIDOMDocument.h> +#include <nsIFileURL.h> +#include <nsIIOService.h> #include <nsILocalFile.h> -#include <nsIWebBrowserPersist.h> +#include <nsIMIMEInfo.h> #include <nsIObserver.h> #include <nsIRequest.h> -#include <nsIFileURL.h> -#undef MOZILLA_INTERNAL_API -#include <nsEmbedString.h> -#define MOZILLA_INTERNAL_API 1 +#include <nsIURI.h> +#include <nsIURI.h> +#include <nsIWebBrowserPersist.h> #include <nsMemory.h> #include <nsNetError.h> +#include <nsServiceManagerUtils.h> -#include <stdlib.h> - -#ifdef HAVE_GECKO_1_8 #include "EphyBadCertRejector.h" -#endif +#include "EphyUtils.h" + +#include "eel-gconf-extensions.h" +#include "ephy-debug.h" +#include "ephy-file-helpers.h" +#include "ephy-prefs.h" +#include "mozilla-download.h" + +#include "MozDownload.h" const char* const persistContractID = "@mozilla.org/embedding/browser/nsWebBrowserPersist;1"; @@ -95,20 +97,12 @@ MozDownload::~MozDownload() NS_ASSERTION (!mEphyDownload, "MozillaDownload still alive!"); } -#ifdef HAVE_GECKO_1_8 NS_IMPL_ISUPPORTS4 (MozDownload, nsIWebProgressListener, nsIWebProgressListener2, nsITransfer, nsIInterfaceRequestor) -#else -NS_IMPL_ISUPPORTS3 (MozDownload, - nsIWebProgressListener, - nsIDownload, - nsITransfer) -#endif -#ifdef HAVE_GECKO_1_8 nsresult MozDownload::InitForEmbed (nsIURI *aSource, nsIURI *aTarget, const nsAString &aDisplayName, nsIMIMEInfo *aMIMEInfo, PRTime aStartTime, nsILocalFile *aTempFile, @@ -119,19 +113,7 @@ MozDownload::InitForEmbed (nsIURI *aSource, nsIURI *aTarget, const nsAString &aD mMaxSize = aMaxSize; return Init (aSource, aTarget, aDisplayName, aMIMEInfo, aStartTime, aTempFile, aCancelable); } -#else -nsresult -MozDownload::InitForEmbed (nsIURI *aSource, nsIURI *aTarget, const PRUnichar *aDisplayName, - nsIMIMEInfo *aMIMEInfo, PRInt64 startTime, nsIWebBrowserPersist *aPersist, - MozillaEmbedPersist *aEmbedPersist, PRInt64 aMaxSize) -{ - mEmbedPersist = aEmbedPersist; - mMaxSize = aMaxSize; - return Init (aSource, aTarget, aDisplayName, aMIMEInfo, startTime, aPersist); -} -#endif -#ifdef HAVE_GECKO_1_8 /* void init (in nsIURI aSource, in nsIURI aTarget, in AString aDisplayName, in nsIMIMEInfo aMIMEInfo, in PRTime startTime, in nsILocalFile aTempFile, in nsICancelable aCancelable); */ NS_IMETHODIMP MozDownload::Init (nsIURI *aSource, @@ -141,16 +123,6 @@ MozDownload::Init (nsIURI *aSource, PRTime aStartTime, nsILocalFile *aTempFile, nsICancelable *aCancelable) -#else -/* void init (in nsIURI aSource, in nsIURI aTarget, in wstring aDisplayName, in nsIMIMEInfo aMIMEInfo, in long long startTime, in nsIWebBrowserPersist aPersist); */ -NS_IMETHODIMP -MozDownload::Init (nsIURI *aSource, - nsIURI *aTarget, - const PRUnichar *aDisplayName, - nsIMIMEInfo *aMIMEInfo, - PRInt64 aStartTime, - nsIWebBrowserPersist *aPersist) -#endif { PRBool addToView = PR_TRUE; @@ -173,16 +145,8 @@ MozDownload::Init (nsIURI *aSource, mLastUpdate = mStartTime; mMIMEInfo = aMIMEInfo; -#ifdef HAVE_GECKO_1_8 /* This will create a refcount cycle, which needs to be broken in ::OnStateChange */ mCancelable = aCancelable; -#else - if (aPersist) - { - mWebPersist = aPersist; - aPersist->SetProgressListener(this); - } -#endif if (addToView) { @@ -212,17 +176,6 @@ MozDownload::GetSource(nsIURI **aSource) return NS_OK; } -#ifndef HAVE_GECKO_1_8 -NS_IMETHODIMP -MozDownload::GetTarget(nsIURI **aTarget) -{ - NS_ENSURE_ARG_POINTER(aTarget); - NS_IF_ADDREF(*aTarget = mDestination); - - return NS_OK; -} -#endif - NS_IMETHODIMP MozDownload::GetTargetFile (nsILocalFile** aTargetFile) { @@ -238,17 +191,6 @@ MozDownload::GetTargetFile (nsILocalFile** aTargetFile) return rv; } -#ifndef HAVE_GECKO_1_8 -NS_IMETHODIMP -MozDownload::GetPersist(nsIWebBrowserPersist **aPersist) -{ - NS_ENSURE_ARG_POINTER(aPersist); - NS_IF_ADDREF(*aPersist = mWebPersist); - - return NS_OK; -} -#endif - NS_IMETHODIMP MozDownload::GetPercentComplete(PRInt32 *aPercentComplete) { @@ -258,29 +200,6 @@ MozDownload::GetPercentComplete(PRInt32 *aPercentComplete) return NS_OK; } -#ifndef HAVE_GECKO_1_8 -NS_IMETHODIMP -MozDownload::GetStartTime(PRInt64 *aStartTime) -{ - NS_ENSURE_ARG_POINTER(aStartTime); - *aStartTime = mStartTime; - - return NS_OK; -} - -NS_IMETHODIMP -MozDownload::GetDisplayName(PRUnichar * *aDisplayName) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -MozDownload::SetDisplayName(const PRUnichar * aDisplayName) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} -#endif /* !HAVE_GECKO_1_8 */ - NS_IMETHODIMP MozDownload::GetTotalProgress(PRInt64 *aTotalProgress) { @@ -326,39 +245,6 @@ MozDownload::GetMIMEInfo(nsIMIMEInfo **aMIMEInfo) return NS_OK; } -#ifndef HAVE_GECKO_1_8 -NS_IMETHODIMP -MozDownload::GetListener(nsIWebProgressListener **aListener) -{ - NS_ENSURE_ARG_POINTER(aListener); - - return CallQueryInterface (this, aListener); -} - -NS_IMETHODIMP -MozDownload::SetListener(nsIWebProgressListener *aListener) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -MozDownload::GetObserver(nsIObserver **aObserver) -{ - *aObserver = mObserver; - NS_IF_ADDREF (*aObserver); - - return NS_OK; -} - -NS_IMETHODIMP -MozDownload::SetObserver(nsIObserver *aObserver) -{ - mObserver = aObserver; - - return NS_OK; -} -#endif - NS_IMETHODIMP MozDownload::OnStateChange (nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus) @@ -389,7 +275,7 @@ MozDownload::OnStateChange (nsIWebProgress *aWebProgress, nsIRequest *aRequest, */ #ifdef GNOME_ENABLE_DEBUG { - nsEmbedCString spec; + nsCString spec; if (mSource) mSource->GetSpec(spec); LOG ("url %s, status %x, state %x (is-stop:%s, is-network:%s, is-request:%s)", @@ -416,16 +302,8 @@ MozDownload::OnStateChange (nsIWebProgress *aWebProgress, nsIRequest *aRequest, g_signal_emit_by_name (mEphyDownload, "changed"); } -#ifdef HAVE_GECKO_1_8 /* break refcount cycle */ mCancelable = nsnull; -#else - if (mWebPersist) - { - mWebPersist->SetProgressListener(nsnull); - mWebPersist = nsnull; - } -#endif if (mEmbedPersist) { @@ -441,37 +319,15 @@ MozDownload::OnStateChange (nsIWebProgress *aWebProgress, nsIRequest *aRequest, else if (NS_SUCCEEDED (aStatus)) { GnomeVFSMimeApplication *helperApp; - nsEmbedCString mimeType; -#ifdef HAVE_GECKO_1_8 + nsCString mimeType; rv = mMIMEInfo->GetMIMEType (mimeType); NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); - nsEmbedString description; + nsString description; mMIMEInfo->GetApplicationDescription (description); - nsEmbedCString cDesc; + nsCString cDesc; NS_UTF16ToCString (description, NS_CSTRING_ENCODING_UTF8, cDesc); -#else - char *mime = nsnull; - rv = mMIMEInfo->GetMIMEType (&mime); - NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); - - if (mime) - { - mimeType.Assign (mime); - nsMemory::Free (mime); - } - - PRUnichar *description; - mMIMEInfo->GetApplicationDescription (&description); - NS_ENSURE_TRUE (description, NS_ERROR_FAILURE); - - nsEmbedCString cDesc; - NS_UTF16ToCString (nsEmbedString(description), - NS_CSTRING_ENCODING_UTF8, cDesc); - - nsMemory::Free (description); -#endif /* HACK we use the application description to decide if we have to open the saved file */ @@ -487,7 +343,7 @@ MozDownload::OnStateChange (nsIWebProgress *aWebProgress, nsIRequest *aRequest, helperApp = gnome_vfs_mime_application_new_from_desktop_id (str[2]); if (!helperApp) return NS_ERROR_FAILURE; - nsEmbedCString aDest; + nsCString aDest; rv = mDestination->GetSpec (aDest); NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); @@ -502,7 +358,6 @@ MozDownload::OnStateChange (nsIWebProgress *aWebProgress, nsIRequest *aRequest, return NS_OK; } -#ifdef HAVE_GECKO_1_8 NS_IMETHODIMP MozDownload::OnProgressChange (nsIWebProgress *aWebProgress, nsIRequest *aRequest, @@ -525,15 +380,6 @@ MozDownload::OnProgressChange64 (nsIWebProgress *aWebProgress, PRInt64 aMaxSelfProgress, PRInt64 aCurTotalProgress, PRInt64 aMaxTotalProgress) -#else /* !HAVE_GECKO_1_8 */ -NS_IMETHODIMP -MozDownload::OnProgressChange (nsIWebProgress *aWebProgress, - nsIRequest *aRequest, - PRInt32 aCurSelfProgress, - PRInt32 aMaxSelfProgress, - PRInt32 aCurTotalProgress, - PRInt32 aMaxTotalProgress) -#endif /* HAVE_GECKO_1_8 */ { if (mMaxSize >= 0 && ((aMaxTotalProgress > 0 && mMaxSize < aMaxTotalProgress) || @@ -596,8 +442,6 @@ MozDownload::OnSecurityChange (nsIWebProgress *aWebProgress, nsIRequest *aReques return NS_OK; } -#ifdef HAVE_GECKO_1_8 - /* void getInterface (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */ NS_IMETHODIMP MozDownload::GetInterface(const nsIID & uuid, void * *result) @@ -624,8 +468,6 @@ MozDownload::GetInterface(const nsIID & uuid, void * *result) return NS_ERROR_NO_INTERFACE; } -#endif /* HAVE_GECKO_1_8 */ - void MozDownload::Cancel() { @@ -635,23 +477,11 @@ MozDownload::Cancel() return; } -#ifdef HAVE_GECKO_1_8 if (mCancelable) { /* FIXME: error code? */ mCancelable->Cancel (NS_BINDING_ABORTED); } -#else - if (mWebPersist) - { - mWebPersist->CancelSave (); - } - - if (mObserver) - { - mObserver->Observe (nsnull, "oncancel", nsnull); - } -#endif } void @@ -695,7 +525,7 @@ nsresult InitiateMozillaDownload (nsIDOMDocument *domDocument, nsIURI *sourceURI PRInt64 timeNow = PR_Now(); - nsEmbedString fileDisplayName; + nsString fileDisplayName; inDestFile->GetLeafName(fileDisplayName); nsCOMPtr<nsIIOService> ioService; @@ -708,16 +538,11 @@ nsresult InitiateMozillaDownload (nsIDOMDocument *domDocument, nsIURI *sourceURI MozDownload *downloader = new MozDownload (); /* dlListener attaches to its progress dialog here, which gains ownership */ /* FIXME is that still true? */ -#ifdef HAVE_GECKO_1_8 rv = downloader->InitForEmbed (inOriginalURI, destURI, fileDisplayName, nsnull, timeNow, nsnull, webPersist, embedPersist, aMaxSize); NS_ENSURE_SUCCESS (rv, rv); rv = webPersist->SetProgressListener (downloader); -#else - rv = downloader->InitForEmbed (inOriginalURI, destURI, fileDisplayName.get(), - nsnull, timeNow, webPersist, embedPersist, aMaxSize); -#endif NS_ENSURE_SUCCESS (rv, rv); PRInt32 flags = nsIWebBrowserPersist::PERSIST_FLAGS_REPLACE_EXISTING_FILES; @@ -748,7 +573,7 @@ nsresult InitiateMozillaDownload (nsIDOMDocument *domDocument, nsIURI *sourceURI * will create the directory as needed. */ - nsEmbedCString cPath; + nsCString cPath; inDestFile->GetNativePath (cPath); GString *path = g_string_new (cPath.get()); @@ -761,7 +586,7 @@ nsresult InitiateMozillaDownload (nsIDOMDocument *domDocument, nsIURI *sourceURI g_string_append (path, _("Files")); filesFolder = do_CreateInstance ("@mozilla.org/file/local;1"); - filesFolder->InitWithNativePath (nsEmbedCString(path->str)); + filesFolder->InitWithNativePath (nsCString(path->str)); g_string_free (path, TRUE); @@ -887,7 +712,7 @@ nsresult BuildDownloadPath (const char *defaultFileName, nsILocalFile **_retval) nsCOMPtr <nsILocalFile> destFile (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID)); NS_ENSURE_TRUE (destFile, NS_ERROR_FAILURE); - destFile->InitWithNativePath (nsEmbedCString (path)); + destFile->InitWithNativePath (nsCString (path)); g_free (path); NS_IF_ADDREF (*_retval = destFile); diff --git a/embed/mozilla/MozDownload.h b/embed/mozilla/MozDownload.h index 509b28339..242f53db0 100644 --- a/embed/mozilla/MozDownload.h +++ b/embed/mozilla/MozDownload.h @@ -42,32 +42,27 @@ #ifndef MozDownload_h__ #define MozDownload_h__ -#include "mozilla-embed-persist.h" -#include "downloader-view.h" -#include "ephy-download.h" -#include "ephy-embed-shell.h" +#include <libgnomevfs/gnome-vfs-mime-handlers.h> #include <nsCOMPtr.h> -#include <nsIWebProgressListener.h> -#include <nsIURI.h> -#include <nsIMIMEInfo.h> - -#ifdef HAVE_GECKO_1_8 -#include <nsICancelable.h> -#include <nsITransfer.h> #include <nsIInterfaceRequestor.h> -#else -#include <nsIDownload.h> -#endif +#include <nsITransfer.h> +#include <nsIWebProgressListener.h> -#include <libgnomevfs/gnome-vfs-mime-handlers.h> +#include "mozilla-embed-persist.h" +#include "downloader-view.h" +#include "ephy-download.h" +#include "ephy-embed-shell.h" +class nsICancelable; class nsIDOMDocument; +class nsIInputStream; class nsILocalFile; -class nsIWebBrowserPersist; +class nsIMIMEInfo; class nsIObserver; class nsIRequest; -class nsIInputStream; +class nsIURI; +class nsIWebBrowserPersist; /* MozDownload Holds information used to display a single download in the UI. This object is @@ -97,14 +92,8 @@ nsresult InitiateMozillaDownload (nsIDOMDocument *domDocument, nsIURI *sourceUri PRInt64 aMaxSize); nsresult BuildDownloadPath (const char *defaultFileName, nsILocalFile **_retval); -class MozDownload : -#ifdef HAVE_GECKO_1_8 - public nsITransfer, +class MozDownload : public nsITransfer, public nsIInterfaceRequestor -#else - public nsIDownload, - public nsIWebProgressListener -#endif { public: MozDownload(); @@ -112,7 +101,6 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSIWEBPROGRESSLISTENER -#ifdef HAVE_GECKO_1_8 NS_DECL_NSIWEBPROGRESSLISTENER2 NS_DECL_NSITRANSFER NS_DECL_NSIINTERFACEREQUESTOR @@ -121,10 +109,6 @@ public: nsresult GetTargetFile (nsILocalFile **aFile); nsresult GetSource(nsIURI * *aSource); nsresult GetPercentComplete(PRInt32 *aPercentComplete); -#else - NS_DECL_NSITRANSFER - NS_DECL_NSIDOWNLOAD -#endif virtual void Cancel(); virtual void Pause(); @@ -135,18 +119,11 @@ public: nsresult GetTotalProgress (PRInt64 *aTProgress); nsresult GetElapsedTime (PRInt64 *aTProgress); -#ifdef HAVE_GECKO_1_8 nsresult InitForEmbed (nsIURI *aSource, nsIURI *aTarget, const nsAString &aDisplayName, nsIMIMEInfo *aMIMEInfo, PRTime aStartTime, nsILocalFile *aTempFile, nsICancelable *aCancelable, MozillaEmbedPersist *aEmbedPersist, PRInt64 aMaxSize); -#else - nsresult InitForEmbed (nsIURI *aSource, nsIURI *aTarget, - const PRUnichar *aDisplayName, nsIMIMEInfo *aMIMEInfo, - PRInt64 startTime, nsIWebBrowserPersist *aPersist, - MozillaEmbedPersist *aEmbedPersist, PRInt64 aMaxSize); -#endif protected: nsCOMPtr<nsIURI> mSource; @@ -164,12 +141,7 @@ protected: nsresult mStatus; -#ifdef HAVE_GECKO_1_8 nsCOMPtr<nsICancelable> mCancelable; -#else - nsCOMPtr<nsIWebBrowserPersist> mWebPersist; - nsCOMPtr<nsIObserver> mObserver; -#endif nsCOMPtr<nsIRequest> mRequest; EphyDownload *mEphyDownload; DownloaderView *mDownloaderView; diff --git a/embed/mozilla/MozRegisterComponents.cpp b/embed/mozilla/MozRegisterComponents.cpp index 77b52de91..6c76541a2 100644 --- a/embed/mozilla/MozRegisterComponents.cpp +++ b/embed/mozilla/MozRegisterComponents.cpp @@ -21,17 +21,41 @@ */ #include "mozilla-config.h" - #include "config.h" +#include <glib/gmessages.h> + +#include <nsStringAPI.h> + +#include <nsComponentManagerUtils.h> +#include <nsCOMPtr.h> +#include <nsDocShellCID.h> +#include <nsICategoryManager.h> +#include <nsIComponentManager.h> +#include <nsIComponentRegistrar.h> +#include <nsIGenericFactory.h> +#include <nsILocalFile.h> +#include <nsIServiceManager.h> +#include <nsMemory.h> +#include <nsNetCID.h> +#include <nsServiceManagerUtils.h> + +#ifdef HAVE_GECKO_1_9 +#include <nsIClassInfoImpl.h> +#endif + +#ifdef HAVE_MOZILLA_PSM +#include <nsISecureBrowserUI.h> +#endif + #include "ContentHandler.h" -#include "GlobalHistory.h" -#include "PrintingPromptService.h" -#include "MozDownload.h" -#include "EphyContentPolicy.h" -#include "EphySidebar.h" #include "EphyAboutModule.h" +#include "EphyContentPolicy.h" #include "EphyPromptService.h" +#include "EphySidebar.h" +#include "GlobalHistory.h" +#include "MozDownload.h" +#include "PrintingPromptService.h" #ifdef ENABLE_FILEPICKER #include "FilePicker.h" @@ -42,32 +66,16 @@ #include "GtkNSSDialogs.h" #include "GtkNSSKeyPairDialogs.h" #include "GtkNSSSecurityWarningDialogs.h" -#include <nsISecureBrowserUI.h> -#endif - -#include <nsMemory.h> -#include <nsDocShellCID.h> -#include <nsIGenericFactory.h> -#include <nsIComponentRegistrar.h> -#include <nsICategoryManager.h> -#include <nsCOMPtr.h> -#include <nsILocalFile.h> -#include <nsNetCID.h> - -#ifdef HAVE_GECKO_1_9 -#include <nsIClassInfoImpl.h> #endif -#include <glib/gmessages.h> - -NS_GENERIC_FACTORY_CONSTRUCTOR(MozDownload) -NS_GENERIC_FACTORY_CONSTRUCTOR(GContentHandler) -NS_GENERIC_FACTORY_CONSTRUCTOR(MozGlobalHistory) -NS_GENERIC_FACTORY_CONSTRUCTOR(GPrintingPromptService) -NS_GENERIC_FACTORY_CONSTRUCTOR(EphyContentPolicy) -NS_GENERIC_FACTORY_CONSTRUCTOR(EphySidebar) NS_GENERIC_FACTORY_CONSTRUCTOR(EphyAboutModule) +NS_GENERIC_FACTORY_CONSTRUCTOR(EphyContentPolicy) NS_GENERIC_FACTORY_CONSTRUCTOR(EphyPromptService) +NS_GENERIC_FACTORY_CONSTRUCTOR(EphySidebar) +NS_GENERIC_FACTORY_CONSTRUCTOR(GContentHandler) +NS_GENERIC_FACTORY_CONSTRUCTOR(GPrintingPromptService) +NS_GENERIC_FACTORY_CONSTRUCTOR(MozDownload) +NS_GENERIC_FACTORY_CONSTRUCTOR(MozGlobalHistory) #ifdef ENABLE_FILEPICKER NS_GENERIC_FACTORY_CONSTRUCTOR(GFilePicker) @@ -80,7 +88,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(GtkNSSKeyPairDialogs) NS_GENERIC_FACTORY_CONSTRUCTOR(GtkNSSSecurityWarningDialogs) #endif - /* class information */ NS_DECL_CLASSINFO(EphySidebar) @@ -219,14 +226,12 @@ static const nsModuleComponentInfo sAppComps[] = { EPHY_ABOUT_RECOVER_CONTRACTID, EphyAboutModuleConstructor }, -#ifdef HAVE_GECKO_1_8 { EPHY_ABOUT_NETERROR_CLASSNAME, EPHY_ABOUT_MODULE_CID, EPHY_ABOUT_NETERROR_CONTRACTID, EphyAboutModuleConstructor }, -#endif { EPHY_PROMPT_SERVICE_CLASSNAME, EPHY_PROMPT_SERVICE_IID, @@ -243,43 +248,6 @@ static const nsModuleComponentInfo sAppComps[] = { #endif /* HAVE_NSINONBLOCKINGALERTSERVICE_H */ }; -#if defined(HAVE_MOZILLA_PSM) && !defined(HAVE_GECKO_1_8) -/* 5999dfd3-571f-4fcf-964b-386879f5cded */ -#define NEW_CID { 0x5999dfd3, 0x571f, 0x4fcf, { 0x96, 0x4b, 0x38, 0x68, 0x79, 0xf5, 0xcd, 0xed } } - -static nsresult -reregister_secure_browser_ui (nsIComponentManager *cm, - nsIComponentRegistrar *cr) -{ - NS_ENSURE_ARG (cm); - NS_ENSURE_ARG (cr); - - /* Workaround as a result of: - * https://bugzilla.mozilla.org/show_bug.cgi?id=94974 - * see - * http://bugzilla.gnome.org/show_bug.cgi?id=164670 - */ - - nsresult rv; - nsCOMPtr<nsIFactory> factory; - rv = cm->GetClassObjectByContractID (NS_SECURE_BROWSER_UI_CONTRACTID, NS_GET_IID(nsIFactory), getter_AddRefs (factory)); - NS_ENSURE_SUCCESS (rv, rv); - - nsCID *cidPtr = nsnull; - rv = cr->ContractIDToCID(NS_SECURE_BROWSER_UI_CONTRACTID, &cidPtr); - NS_ENSURE_TRUE (NS_SUCCEEDED (rv) && cidPtr, rv); - - rv = cr->UnregisterFactory (*cidPtr, factory); - NS_ENSURE_SUCCESS (rv, rv); - - const nsCID new_cid = NEW_CID; - rv = cr->RegisterFactory (new_cid, "Epiphany Secure Browser Class", "@gnome.org/project/epiphany/hacks/secure-browser-ui;1", factory); - nsMemory::Free (cidPtr); - - return rv; -} -#endif /* defined(HAVE_MOZILLA_PSM) && !defined(HAVE_GECKO_1_8) */ - gboolean mozilla_register_components (void) { @@ -330,14 +298,5 @@ mozilla_register_components (void) } } -#if defined(HAVE_MOZILLA_PSM) && !defined(HAVE_GECKO_1_8) - /* Workaround for http://bugzilla.gnome.org/show_bug.cgi?id=164670 */ - rv = reregister_secure_browser_ui (cm, cr); - if (NS_FAILED (rv)) - { - g_warning ("Failed to divert the nsISecureBrowserUI implementation!\n"); - } -#endif /* defined(HAVE_MOZILLA_PSM) && !defined(HAVE_GECKO_1_8) */ - return ret; } diff --git a/embed/mozilla/MozRegisterComponents.h b/embed/mozilla/MozRegisterComponents.h index 81c7617f1..633e0ebbe 100644 --- a/embed/mozilla/MozRegisterComponents.h +++ b/embed/mozilla/MozRegisterComponents.h @@ -21,6 +21,8 @@ #ifndef MOZREGISTERCOMPONENTS_H #define MOZREGISTERCOMPONENTS_H +#include <glib.h> + gboolean mozilla_register_components (void); #endif /* MOZREGISTERCOMPONENTS_H */ diff --git a/embed/mozilla/MozillaPrivate.cpp b/embed/mozilla/MozillaPrivate.cpp index a3dc3483f..fde024b2e 100644 --- a/embed/mozilla/MozillaPrivate.cpp +++ b/embed/mozilla/MozillaPrivate.cpp @@ -19,17 +19,15 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "MozillaPrivate.h" - -#include <nsIServiceManager.h> +#define MOZILLA_INTERNAL_API 1 #include <nsString.h> -#include <nsPromiseFlatString.h> #include "ephy-debug.h" +#include "MozillaPrivate.h" + /* IMPORTANT. Put only code that use internal mozilla strings (nsAutoString for * example) in this file. Note that you cannot use embed strings here, * the header inclusions will conflict. diff --git a/embed/mozilla/MozillaPrivate.h b/embed/mozilla/MozillaPrivate.h index 4ea2fab0f..5f6c25828 100644 --- a/embed/mozilla/MozillaPrivate.h +++ b/embed/mozilla/MozillaPrivate.h @@ -18,8 +18,6 @@ * $Id$ */ -#include <glib.h> - namespace MozillaPrivate { } diff --git a/embed/mozilla/PrintingPromptService.cpp b/embed/mozilla/PrintingPromptService.cpp index 218c63b81..121425060 100644 --- a/embed/mozilla/PrintingPromptService.cpp +++ b/embed/mozilla/PrintingPromptService.cpp @@ -21,28 +21,28 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "PrintingPromptService.h" -#include "EphyUtils.h" -#include "AutoJSContextStack.h" - #include <gtk/gtkdialog.h> #include <libgnomeprintui/gnome-print-dialog.h> -#include "print-dialog.h" -#include "ephy-embed.h" -#include "ephy-command-manager.h" #include "eel-gconf-extensions.h" -#include "ephy-prefs.h" +#include "ephy-command-manager.h" #include "ephy-debug.h" +#include "ephy-embed.h" +#include "ephy-prefs.h" +#include "print-dialog.h" -#include <nsIPrintSettings.h> #include <nsCOMPtr.h> +#include <nsIPrintSettings.h> #include <nsIServiceManager.h> +#include "EphyUtils.h" +#include "AutoJSContextStack.h" + +#include "PrintingPromptService.h" + /* Implementation file */ NS_IMPL_ISUPPORTS3(GPrintingPromptService, nsIPrintingPromptService, nsIWebProgressListener, nsIPrintProgressParams) diff --git a/embed/mozilla/PrintingPromptService.h b/embed/mozilla/PrintingPromptService.h index b0c1c004e..de0dfb353 100644 --- a/embed/mozilla/PrintingPromptService.h +++ b/embed/mozilla/PrintingPromptService.h @@ -21,10 +21,11 @@ #ifndef __PrintingPromptService_h #define __PrintingPromptService_h -#include "nsError.h" -#include "nsIPrintingPromptService.h" #include "print-dialog.h" +#include <nscore.h> +#include <nsIPrintingPromptService.h> + #define G_PRINTINGPROMPTSERVICE_CID \ { /* 5998a2d3-88ea-4c52-b4bb-4e7abd0d35e0 */ \ 0x5998a2d3, \ @@ -36,7 +37,9 @@ #define G_PRINTINGPROMPTSERVICE_CLASSNAME "Epiphany's Printing Prompt Service" #define G_PRINTINGPROMPTSERVICE_CONTRACTID "@mozilla.org/embedcomp/printingprompt-service;1" -class GPrintingPromptService : public nsIPrintingPromptService, nsIWebProgressListener, nsIPrintProgressParams +class GPrintingPromptService : public nsIPrintingPromptService, + nsIWebProgressListener, + nsIPrintProgressParams { public: NS_DECL_ISUPPORTS diff --git a/embed/mozilla/mozilla-download.cpp b/embed/mozilla/mozilla-download.cpp index 75225c3a6..b2507b407 100644 --- a/embed/mozilla/mozilla-download.cpp +++ b/embed/mozilla/mozilla-download.cpp @@ -19,20 +19,21 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "mozilla-download.h" -#include "MozDownload.h" - -#include "ephy-debug.h" +#include <nsStringAPI.h> -#undef MOZILLA_INTERNAL_API -#include <nsEmbedString.h> -#define MOZILLA_INTERNAL_API 1 #include <nsILocalFile.h> +#include <nsIMIMEInfo.h> +#include <nsIURI.h> #include <nsMemory.h> +#include "ephy-debug.h" + +#include "MozDownload.h" + +#include "mozilla-download.h" + static void mozilla_download_class_init (MozillaDownloadClass *klass); static void mozilla_download_init (MozillaDownload *ges); static void mozilla_download_finalize (GObject *object); @@ -90,7 +91,7 @@ impl_get_target (EphyDownload *download) mozDownload->GetTargetFile (getter_AddRefs (targetFile)); - nsEmbedCString tempPathStr; + nsCString tempPathStr; targetFile->GetNativePath (tempPathStr); return g_strdup (tempPathStr.get ()); @@ -101,7 +102,7 @@ impl_get_source (EphyDownload *download) { nsCOMPtr<nsIURI> uri; MozDownload *mozDownload; - nsEmbedCString spec; + nsCString spec; mozDownload = MOZILLA_DOWNLOAD (download)->priv->moz_download; @@ -181,24 +182,14 @@ impl_get_mime (EphyDownload *download) { MozDownload *mozDownload; nsCOMPtr<nsIMIMEInfo> mime; - nsEmbedCString mimeType; + nsCString mimeType; mozDownload = MOZILLA_DOWNLOAD (download)->priv->moz_download; mozDownload->GetMIMEInfo (getter_AddRefs(mime)); if (!mime) return g_strdup ("application/octet-stream"); -#ifdef HAVE_GECKO_1_8 mime->GetMIMEType(mimeType); -#else - char *tmp = nsnull; - mime->GetMIMEType(&tmp); - mimeType.Assign(tmp); - if (tmp) - { - nsMemory::Free (tmp); - } -#endif return g_strdup (mimeType.get()); } diff --git a/embed/mozilla/mozilla-download.h b/embed/mozilla/mozilla-download.h index a50736f87..cbd49c510 100644 --- a/embed/mozilla/mozilla-download.h +++ b/embed/mozilla/mozilla-download.h @@ -21,10 +21,13 @@ #ifndef MOZILLA_DOWNLOAD_H #define MOZILLA_DOWNLOAD_H -#include <glib-object.h> #include <glib.h> +#include <glib-object.h> + #include "ephy-download.h" +G_BEGIN_DECLS + #define MOZILLA_TYPE_DOWNLOAD (mozilla_download_get_type ()) #define MOZILLA_DOWNLOAD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MOZILLA_TYPE_DOWNLOAD, MozillaDownload)) #define MOZILLA_DOWNLOAD_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MOZILLA_TYPE_DOWNLOAD, MozillaDownloadClass)) @@ -53,4 +56,6 @@ GType mozilla_download_get_type (void); EphyDownload *mozilla_download_new (MozDownload *download); +G_END_DECLS + #endif diff --git a/embed/mozilla/mozilla-embed-event.cpp b/embed/mozilla/mozilla-embed-event.cpp index eae87d95c..4dc255014 100644 --- a/embed/mozilla/mozilla-embed-event.cpp +++ b/embed/mozilla/mozilla-embed-event.cpp @@ -20,18 +20,16 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "mozilla-embed-event.h" - -#include "ephy-debug.h" +#include <glib/ghash.h> #include <nsCOMPtr.h> #include <nsIDOMEvent.h> -#include <glib/ghash.h> -#include <gtk/gtktypeutils.h> +#include "ephy-debug.h" + +#include "mozilla-embed-event.h" #define MOZILLA_EMBED_EVENT_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), MOZILLA_TYPE_EMBED_EVENT, MozillaEmbedEventPrivate)) diff --git a/embed/mozilla/mozilla-embed-event.h b/embed/mozilla/mozilla-embed-event.h index 79499e215..2a6d8592c 100644 --- a/embed/mozilla/mozilla-embed-event.h +++ b/embed/mozilla/mozilla-embed-event.h @@ -22,10 +22,10 @@ #ifndef MOZILLA_EMBED_EVENT_H #define MOZILLA_EMBED_EVENT_H -#include "ephy-embed-event.h" - -#include <glib-object.h> #include <glib.h> +#include <glib-object.h> + +#include "ephy-embed-event.h" G_BEGIN_DECLS diff --git a/embed/mozilla/mozilla-embed-find.cpp b/embed/mozilla/mozilla-embed-find.cpp index 1f3597c7e..75192ee36 100644 --- a/embed/mozilla/mozilla-embed-find.cpp +++ b/embed/mozilla/mozilla-embed-find.cpp @@ -20,15 +20,15 @@ */ #include "mozilla-config.h" - #include "config.h" +#include "ephy-debug.h" +#include "ephy-embed-find.h" +#include "ephy-embed-shell.h" + #include "EphyFind.h" #include "mozilla-embed-find.h" -#include "ephy-embed-find.h" -#include "ephy-embed-shell.h" -#include "ephy-debug.h" #define MOZILLA_EMBED_FIND_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), MOZILLA_TYPE_EMBED_FIND, MozillaEmbedFindPrivate)) diff --git a/embed/mozilla/mozilla-embed-find.h b/embed/mozilla/mozilla-embed-find.h index a879b71b7..da7a36065 100644 --- a/embed/mozilla/mozilla-embed-find.h +++ b/embed/mozilla/mozilla-embed-find.h @@ -21,8 +21,8 @@ #ifndef MOZILLA_EMBED_FIND_H #define MOZILLA_EMBED_FIND_H -#include <glib-object.h> #include <glib.h> +#include <glib-object.h> G_BEGIN_DECLS diff --git a/embed/mozilla/mozilla-embed-persist.cpp b/embed/mozilla/mozilla-embed-persist.cpp index 990ed0fbd..63ded311c 100644 --- a/embed/mozilla/mozilla-embed-persist.cpp +++ b/embed/mozilla/mozilla-embed-persist.cpp @@ -19,32 +19,43 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "mozilla-embed-persist.h" -#include "mozilla-embed.h" -#include "ephy-embed-shell.h" -#include "ephy-file-helpers.h" -#include "EphyBrowser.h" -#include "EphyHeaderSniffer.h" -#include "MozDownload.h" -#include "EphyUtils.h" -#include "ephy-debug.h" - #include <stddef.h> -#include <nsIWebBrowserPersist.h> +#include <nsStringAPI.h> + +#include <nsCOMPtr.h> +#include <nsComponentManagerUtils.h> #include <nsCWebBrowserPersist.h> -#include <nsIHistoryEntry.h> -#include <nsISHEntry.h> +#include <nsICacheEntryDescriptor.h> +#include <nsICacheService.h> +#include <nsICacheSession.h> #include <nsIDOMSerializer.h> +#include <nsIFile.h> +#include <nsIHistoryEntry.h> +#include <nsIInputStream.h> #include <nsIIOService.h> +#include <nsILocalFile.h> +#include <nsISHEntry.h> +#include <nsIURI.h> +#include <nsIWebBrowserPersist.h> #include <nsNetCID.h> #include <nsNetError.h> -#include <nsICacheEntryDescriptor.h> -#include <nsICacheService.h> -#include <nsICacheSession.h> +#include <nsServiceManagerUtils.h> +#include <nsXPCOM.h> + +#include "EphyBrowser.h" +#include "EphyHeaderSniffer.h" +#include "EphyUtils.h" +#include "MozDownload.h" + +#include "ephy-debug.h" +#include "ephy-embed-shell.h" +#include "ephy-file-helpers.h" +#include "mozilla-embed.h" + +#include "mozilla-embed-persist.h" static void mozilla_embed_persist_class_init (MozillaEmbedPersistClass *klass); @@ -127,18 +138,11 @@ impl_cancel (EphyEmbedPersist *persist) { nsCOMPtr<nsIWebBrowserPersist> bpersist = MOZILLA_EMBED_PERSIST (persist)->priv->mPersist; -#ifdef HAVE_GECKO_1_8 nsCOMPtr<nsICancelable> cancelable (do_QueryInterface (bpersist)); if (cancelable) { cancelable->Cancel (NS_BINDING_ABORTED); } -#else - if (bpersist) - { - bpersist->CancelSave (); - } -#endif g_object_unref (persist); } @@ -186,7 +190,7 @@ impl_save (EphyEmbedPersist *persist) if (uri) { /* FIXME: origin charset!! */ - rv = EphyUtils::NewURI (getter_AddRefs(inURI), nsEmbedCString(uri)); + rv = EphyUtils::NewURI (getter_AddRefs(inURI), nsCString(uri)); NS_ENSURE_SUCCESS (rv, FALSE); } else @@ -260,20 +264,13 @@ impl_save (EphyEmbedPersist *persist) { nsCOMPtr<nsICacheEntryDescriptor> descriptor; - nsEmbedCString spec; + nsCString spec; inURI->GetSpec (spec); -#ifdef HAVE_GECKO_1_8 rv = cacheSession->OpenCacheEntry (spec, nsICache::ACCESS_READ, PR_FALSE, getter_AddRefs (descriptor)); -#else - rv = cacheSession->OpenCacheEntry - (spec.get(), - nsICache::ACCESS_READ, - PR_FALSE, getter_AddRefs (descriptor)); -#endif cacheDescriptor = do_QueryInterface (descriptor); @@ -302,7 +299,7 @@ impl_save (EphyEmbedPersist *persist) nsCOMPtr<nsILocalFile> tmpFile = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID); NS_ENSURE_TRUE (tmpFile, FALSE); - tmpFile->InitWithNativePath (nsEmbedCString (tmp_filename)); + tmpFile->InitWithNativePath (nsCString (tmp_filename)); g_free (tmp_filename); /* Create an header sniffer and do the save */ @@ -323,7 +320,7 @@ impl_save (EphyEmbedPersist *persist) { /* Filename to save to */ nsCOMPtr<nsILocalFile> destFile; - NS_NewNativeLocalFile (nsEmbedCString(filename), + NS_NewNativeLocalFile (nsCString(filename), PR_TRUE, getter_AddRefs(destFile)); NS_ENSURE_TRUE (destFile, FALSE); @@ -369,11 +366,11 @@ impl_to_string (EphyEmbedPersist *persist) rv = browser->GetTargetDocument (getter_AddRefs(DOMDocument)); } - nsEmbedCString cOutString; + nsCString cOutString; nsCOMPtr<nsIDOMNode> node = do_QueryInterface(DOMDocument); if (node) { - nsEmbedString outString; + nsString outString; nsCOMPtr<nsIDOMSerializer> serializer; serializer = do_CreateInstance(NS_XMLSERIALIZER_CONTRACTID, &rv); if (serializer) diff --git a/embed/mozilla/mozilla-embed-persist.h b/embed/mozilla/mozilla-embed-persist.h index 1832b8d19..0294b992a 100644 --- a/embed/mozilla/mozilla-embed-persist.h +++ b/embed/mozilla/mozilla-embed-persist.h @@ -21,10 +21,10 @@ #ifndef MOZILLA_EMBED_PERSIST_H #define MOZILLA_EMBED_PERSIST_H -#include "ephy-embed-persist.h" - -#include <glib-object.h> #include <glib.h> +#include <glib-object.h> + +#include "ephy-embed-persist.h" G_BEGIN_DECLS diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp index 1269075d3..6203c9117 100644 --- a/embed/mozilla/mozilla-embed-single.cpp +++ b/embed/mozilla/mozilla-embed-single.cpp @@ -25,58 +25,35 @@ #include "config.h" -#include "mozilla-embed-single.h" - -#include "ephy-cookie-manager.h" -#include "ephy-password-manager.h" -#include "ephy-permission-manager.h" -#include "ephy-certificate-manager.h" -#include "ephy-embed-shell.h" - -#include "glib.h" -#include "ephy-debug.h" -#include "gtkmozembed.h" -#include "gtkmozembed_internal.h" -#include "mozilla-embed.h" -#include "ephy-file-helpers.h" -#include "mozilla-notifiers.h" -#include "ephy-langs.h" -#include "eel-gconf-extensions.h" -#include "ephy-embed-prefs.h" -#include "MozRegisterComponents.h" -#include "EphySingle.h" -#include "EphyBrowser.h" -#include "EphyUtils.h" -#include "MozillaPrivate.h" -#include "mozilla-x509-cert.h" +#include <stdlib.h> +#include <glib.h> #include <glib/gi18n.h> #include <libgnomevfs/gnome-vfs-utils.h> +#include <nsStringAPI.h> + +#include <gtkmozembed.h> +#include <gtkmozembed_internal.h> +#include <nsComponentManagerUtils.h> #include <nsCOMPtr.h> -#include <nsMemory.h> -#undef MOZILLA_INTERNAL_API -#include <nsEmbedString.h> -#define MOZILLA_INTERNAL_API 1 -#include <nsIPrefService.h> -#include <nsIServiceManager.h> -#include <nsIWindowWatcher.h> -#include <nsIIOService.h> -#include <nsISupportsPrimitives.h> -#include <nsICookieManager.h> +#include <nsCPasswordManager.h> #include <nsICookie2.h> #include <nsICookieManager.h> +#include <nsICookieManager.h> +#include <nsIFile.h> +#include <nsIIOService.h> +#include <nsILocalFile.h> #include <nsIPasswordManager.h> -#include <nsCPasswordManager.h> #include <nsIPermission.h> #include <nsIPermissionManager.h> -#include <nsIFile.h> -#include <nsILocalFile.h> +#include <nsIPrefService.h> +#include <nsIStyleSheetService.h> +#include <nsISupportsPrimitives.h> #include <nsIURI.h> - -#if defined(HAVE_MOZILLA_TOOLKIT) && defined(HAVE_GECKO_1_8) -#include "EphyDirectoryProvider.h" -#endif +#include <nsIWindowWatcher.h> +#include <nsMemory.h> +#include <nsServiceManagerUtils.h> #ifdef HAVE_MOZILLA_PSM #include <nsIX509Cert.h> @@ -87,31 +64,41 @@ #include <nsIPassword.h> #endif -#if defined (HAVE_CHROME_NSICHROMEREGISTRYSEA_H) -#include <chrome/nsIChromeRegistrySea.h> -#elif defined(MOZ_NSIXULCHROMEREGISTRY_SELECTSKIN) -#include <nsIChromeRegistry.h> -#endif - #ifdef ALLOW_PRIVATE_API -// FIXME: For setting the locale. hopefully gtkmozembed will do itself soon -#include <nsILocaleService.h> -#include <nsIHttpAuthManager.h> #include <nsICacheService.h> #include <nsIFontEnumerator.h> -#include <nsNetCID.h> +#include <nsIHttpAuthManager.h> #include <nsIIDNService.h> +#include <nsNetCID.h> #endif /* ALLOW_PRIVATE_API */ -#include <stdlib.h> +#include "ephy-file-helpers.h" +#include "eel-gconf-extensions.h" +#include "ephy-certificate-manager.h" +#include "ephy-cookie-manager.h" +#include "ephy-debug.h" +#include "ephy-embed-prefs.h" +#include "ephy-embed-shell.h" +#include "ephy-file-helpers.h" +#include "ephy-langs.h" +#include "ephy-password-manager.h" +#include "ephy-permission-manager.h" +#include "mozilla-embed.h" +#include "mozilla-notifiers.h" +#include "MozillaPrivate.h" +#include "mozilla-x509-cert.h" -#ifdef HAVE_GECKO_1_8 -#include <nsIURI.h> -#include <nsIStyleSheetService.h> +#include "EphyBrowser.h" +#include "EphySingle.h" #include "EphyUtils.h" -#include "ephy-file-helpers.h" +#include "MozRegisterComponents.h" + +#ifdef HAVE_MOZILLA_TOOLKIT +#include "EphyDirectoryProvider.h" #endif +#include "mozilla-embed-single.h" + #define MOZILLA_PROFILE_DIR "/mozilla" #define MOZILLA_PROFILE_NAME "epiphany" #define MOZILLA_PROFILE_FILE "prefs.js" @@ -127,17 +114,10 @@ struct MozillaEmbedSinglePrivate EphySingle *mSingleObserver; -#ifndef HAVE_GECKO_1_8 - /* monitor this widget for theme changes*/ - GtkWidget *theme_window; -#endif - -#ifdef HAVE_GECKO_1_8 char *user_css_file; guint user_css_enabled_notifier_id; EphyFileMonitor *user_css_file_monitor; guint user_css_enabled : 1; -#endif guint online : 1; }; @@ -259,7 +239,7 @@ mozilla_set_default_prefs (MozillaEmbedSingle *mes) /* read our predefined default prefs */ nsresult rv; nsCOMPtr<nsILocalFile> file; - NS_NewNativeLocalFile(nsEmbedCString(DEFAULT_PROFILE_FILE), + NS_NewNativeLocalFile(nsCString(DEFAULT_PROFILE_FILE), PR_TRUE, getter_AddRefs(file)); if (!file) return FALSE; @@ -295,16 +275,11 @@ mozilla_set_default_prefs (MozillaEmbedSingle *mes) g_warning ("failed to read user preferences, error: %x", rv); } -#ifdef HAVE_GECKO_1_8 pref->SetCharPref ("general.useragent.extra.epiphany", "Epiphany/" UA_VERSION); /* Unset old prefs, otherwise they end up in the user agent string too */ pref->ClearUserPref ("general.useragent.vendor"); pref->ClearUserPref ("general.useragent.vendorSub"); -#else - pref->SetCharPref ("general.useragent.vendor", "Epiphany"); - pref->SetCharPref ("general.useragent.vendorSub", UA_VERSION); -#endif /* Don't open ftp uris with an external handler if one is setup */ pref->SetBoolPref ("network.protocol-handler.external.ftp", PR_FALSE); @@ -312,71 +287,6 @@ mozilla_set_default_prefs (MozillaEmbedSingle *mes) return TRUE; } -#ifndef HAVE_GECKO_1_8 -static char * -color_to_string (GdkColor color) -{ - return g_strdup_printf ("#%.2x%.2x%.2x", - color.red >> 8, - color.green >> 8, - color.blue >> 8); -} - -static void -mozilla_update_colors (GtkWidget *window, - GtkStyle *previous_style, - MozillaEmbedSingle *mes) -{ - nsCOMPtr<nsIPrefService> prefService; - GdkColor color; - char *str; - - prefService = do_GetService (NS_PREFSERVICE_CONTRACTID); - if (!prefService) return; - - nsCOMPtr<nsIPrefBranch> pref; - prefService->GetBranch ("", getter_AddRefs(pref)); - if (!pref) return; - - /* Set the bg color to the text bg color*/ - color = window->style->base[GTK_STATE_NORMAL]; - str = color_to_string (color); - pref->SetCharPref ("browser.display.background_color", str); - g_free (str); - - /* Set the text color */ - color = window->style->text[GTK_STATE_NORMAL]; - str = color_to_string (color); - pref->SetCharPref ("browser.display.foreground_color", str); - g_free (str); - - /* FIXME: We should probably monitor and set link color here too, - * but i'm not really sure what to do about that yet - */ -} - -static void -mozilla_setup_colors (MozillaEmbedSingle *mes) -{ - GtkWidget *window; - - /* Create a random window to monitor for theme changes */ - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - mes->priv->theme_window = window; - gtk_widget_realize (window); - gtk_widget_ensure_style (window); - - /* monitor theme changes*/ - g_signal_connect (G_OBJECT (window), "style-set", - G_CALLBACK (mozilla_update_colors), mes); - - /* Initialize the colors */ - mozilla_update_colors (window, NULL, mes); - - mes->priv->theme_window = window; -} -#endif - static void mozilla_embed_single_new_window_orphan_cb (GtkMozEmbedSingle *moz_single, GtkMozEmbed **newEmbed, @@ -481,41 +391,6 @@ getUILang (nsAString& aUILang) } #endif -static nsresult -mozilla_init_chrome (void) -{ -/* FIXME: can we just omit this on new-toolkit ? */ -#if defined(MOZ_NSIXULCHROMEREGISTRY_SELECTSKIN) || defined(HAVE_CHROME_NSICHROMEREGISTRYSEA_H) - nsresult rv; - nsEmbedString uiLang; - -#ifdef HAVE_CHROME_NSICHROMEREGISTRYSEA_H - nsCOMPtr<nsIChromeRegistrySea> chromeRegistry = do_GetService (NS_CHROMEREGISTRY_CONTRACTID); -#else - nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService (NS_CHROMEREGISTRY_CONTRACTID); -#endif - NS_ENSURE_TRUE (chromeRegistry, NS_ERROR_FAILURE); - - // Set skin to 'classic' so we get native scrollbars. - rv = chromeRegistry->SelectSkin (nsEmbedCString("classic/1.0"), PR_FALSE); - NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); - - // set locale - rv = chromeRegistry->SetRuntimeProvider(PR_TRUE); - NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); - - rv = getUILang(uiLang); - NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); - - nsEmbedCString cUILang; - NS_UTF16ToCString (uiLang, NS_CSTRING_ENCODING_UTF8, cUILang); - - return chromeRegistry->SelectLocale (cUILang, PR_FALSE); -#else - return NS_OK; -#endif -} - static void mozilla_init_observer (MozillaEmbedSingle *single) { @@ -533,8 +408,6 @@ mozilla_init_observer (MozillaEmbedSingle *single) } } -#ifdef HAVE_GECKO_1_8 - static void user_css_register (MozillaEmbedSingle *single) { @@ -710,8 +583,6 @@ mozilla_stylesheet_shutdown (MozillaEmbedSingle *single) } } -#endif /* HAVE_GECKO_1_8 */ - static gboolean impl_init (EphyEmbedSingle *esingle) { @@ -733,8 +604,7 @@ impl_init (EphyEmbedSingle *esingle) gtk_moz_embed_set_comp_path (MOZILLA_HOME); #endif -#if defined(HAVE_MOZILLA_TOOLKIT) && defined(HAVE_GECKO_1_8) - +#ifdef HAVE_MOZILLA_TOOLKIT nsCOMPtr<nsIDirectoryServiceProvider> dp = new EphyDirectoryProvider (); if (!dp) return FALSE; @@ -747,9 +617,6 @@ impl_init (EphyEmbedSingle *esingle) mozilla_register_components (); - /* Until gtkmozembed does this itself */ - mozilla_init_chrome (); - mozilla_init_single (single); if (!mozilla_set_default_prefs (single)) @@ -757,22 +624,13 @@ impl_init (EphyEmbedSingle *esingle) return FALSE; } -#ifndef HAVE_GECKO_1_8 - /* FIXME: This should be removed when mozilla - * bugs 207000 and 207001 are fixed. - */ - mozilla_setup_colors (single); -#endif - START_PROFILER ("Mozilla prefs notifiers") mozilla_notifiers_init (); STOP_PROFILER ("Mozilla prefs notifiers") mozilla_init_observer (single); -#ifdef HAVE_GECKO_1_8 mozilla_stylesheet_init (single); -#endif return TRUE; } @@ -814,9 +672,7 @@ mozilla_embed_single_dispose (GObject *object) MozillaEmbedSingle *single = MOZILLA_EMBED_SINGLE (object); MozillaEmbedSinglePrivate *priv = single->priv; -#ifdef HAVE_GECKO_1_8 mozilla_stylesheet_shutdown (single); -#endif if (priv->mSingleObserver) { @@ -846,13 +702,6 @@ mozilla_embed_single_finalize (GObject *object) #endif g_free (mes->priv->user_prefs); - -#ifndef HAVE_GECKO_1_8 - if (mes->priv->theme_window) - { - gtk_widget_destroy (mes->priv->theme_window); - } -#endif } static void @@ -920,8 +769,8 @@ impl_get_backend_name (EphyEmbedSingle *esingle) return "gecko-1.9"; #elif defined(HAVE_GECKO_1_8) return "gecko-1.8"; -#elif defined(HAVE_GECKO_1_7) - return "gecko-1.7"; +#else +# error "Undefined/unsupported gecko version!" #endif } @@ -946,8 +795,8 @@ impl_get_font_list (EphyEmbedSingle *shell, { char *gFontString; - nsEmbedCString tmp; - NS_UTF16ToCString (nsEmbedString(fontArray[i]), + nsCString tmp; + NS_UTF16ToCString (nsString(fontArray[i]), NS_CSTRING_ENCODING_UTF8, tmp); gFontString = g_strdup (tmp.get()); l = g_list_prepend (l, gFontString); @@ -1004,13 +853,13 @@ impl_remove_cookie (EphyCookieManager *manager, NS_ENSURE_TRUE (idnService, ); nsresult rv; - nsEmbedCString host; - rv = idnService->ConvertUTF8toACE (nsEmbedCString(cookie->domain), host); + nsCString host; + rv = idnService->ConvertUTF8toACE (nsCString(cookie->domain), host); NS_ENSURE_SUCCESS (rv, ); cookieManager->Remove (host, - nsEmbedCString(cookie->name), - nsEmbedCString(cookie->path), + nsCString(cookie->name), + nsCString(cookie->path), PR_FALSE /* block */); } @@ -1053,25 +902,25 @@ impl_list_passwords (EphyPasswordManager *manager) passwordEnumerator->GetNext (getter_AddRefs(nsPassword)); if (!nsPassword) continue; - nsEmbedCString transfer; + nsCString transfer; rv = nsPassword->GetHost (transfer); if (NS_FAILED (rv)) continue; - nsEmbedCString host; + nsCString host; idnService->ConvertACEtoUTF8 (transfer, host); - nsEmbedString unicodeName; + nsString unicodeName; rv = nsPassword->GetUser (unicodeName); if (NS_FAILED (rv)) continue; - nsEmbedCString userName; + nsCString userName; NS_UTF16ToCString (unicodeName, NS_CSTRING_ENCODING_UTF8, userName); rv = nsPassword->GetPassword (unicodeName); if (NS_FAILED (rv)) continue; - nsEmbedCString userPassword; + nsCString userPassword; NS_UTF16ToCString (unicodeName, NS_CSTRING_ENCODING_UTF8, userPassword); @@ -1101,12 +950,12 @@ impl_remove_password (EphyPasswordManager *manager, NS_ENSURE_TRUE (idnService, ); nsresult rv; - nsEmbedCString host; - rv = idnService->ConvertUTF8toACE (nsEmbedCString(info->host), host); + nsCString host; + rv = idnService->ConvertUTF8toACE (nsCString(info->host), host); NS_ENSURE_SUCCESS (rv, ); - nsEmbedString userName; - NS_CStringToUTF16 (nsEmbedCString(info->username), + nsString userName; + NS_CStringToUTF16 (nsCString(info->username), NS_CSTRING_ENCODING_UTF8, userName); pm->RemoveUser (host, userName); } @@ -1126,7 +975,7 @@ impl_permission_manager_add (EphyPermissionManager *manager, if (!pm) return; nsCOMPtr<nsIURI> uri; - EphyUtils::NewURI(getter_AddRefs(uri), nsEmbedCString(host)); + EphyUtils::NewURI(getter_AddRefs(uri), nsCString(host)); if (!uri) return; gboolean allow = (permission == EPHY_PERMISSION_ALLOWED); @@ -1145,7 +994,7 @@ impl_permission_manager_remove (EphyPermissionManager *manager, (do_GetService (NS_PERMISSIONMANAGER_CONTRACTID)); if (!pm) return; - pm->Remove (nsEmbedCString (host), type); + pm->Remove (nsCString (host), type); } static void @@ -1170,7 +1019,7 @@ impl_permission_manager_test (EphyPermissionManager *manager, if (!pm) return EPHY_PERMISSION_DEFAULT; nsCOMPtr<nsIURI> uri; - EphyUtils::NewURI(getter_AddRefs(uri), nsEmbedCString (host)); + EphyUtils::NewURI(getter_AddRefs(uri), nsCString (host)); if (!uri) return EPHY_PERMISSION_DEFAULT; nsresult rv; @@ -1221,7 +1070,7 @@ impl_permission_manager_list (EphyPermissionManager *manager, if (!perm) continue; nsresult rv; - nsEmbedCString str; + nsCString str; rv = perm->GetType(str); if (NS_FAILED (rv)) continue; @@ -1318,8 +1167,8 @@ retrieveCerts (PRUint32 type) https://bugzilla.mozilla.org/show_bug.cgi?id=214742 */ - nsEmbedCString full_string; - NS_UTF16ToCString (nsEmbedString(certNameList[i]), + nsCString full_string; + NS_UTF16ToCString (nsString(certNameList[i]), NS_CSTRING_ENCODING_UTF8, full_string); const char *key = full_string.get(); @@ -1371,8 +1220,8 @@ impl_import (EphyCertificateManager *manager, localFile = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID); // TODO Is this correct ? - nsEmbedString path; - NS_CStringToUTF16 (nsEmbedCString(file), + nsString path; + NS_CStringToUTF16 (nsCString(file), NS_CSTRING_ENCODING_UTF8, path); diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp index 9d27d1c27..9ed487302 100644 --- a/embed/mozilla/mozilla-embed.cpp +++ b/embed/mozilla/mozilla-embed.cpp @@ -20,31 +20,31 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "mozilla-embed.h" -#include "mozilla-embed-event.h" -#include "ephy-embed-single.h" -#include "ephy-embed-shell.h" -#include "ephy-command-manager.h" -#include "ephy-string.h" -#include "ephy-debug.h" - -#include "EphyBrowser.h" -#include "EventContext.h" -#include "EphyUtils.h" +#include <nsStringAPI.h> #include <gtkmozembed.h> -#undef MOZILLA_INTERNAL_API -#include <nsEmbedString.h> -#define MOZILLA_INTERNAL_API 1 -#include <nsMemory.h> -#include <nsIURI.h> +#include <nsIDOMKeyEvent.h> +#include <nsIDOMMouseEvent.h> #include <nsIRequest.h> +#include <nsIURI.h> #include <nsIWebNavigation.h> #include <nsIWebProgressListener.h> -#include <nsGfxCIID.h> +#include <nsMemory.h> + +#include "EphyBrowser.h" +#include "EphyUtils.h" +#include "EventContext.h" + +#include "ephy-command-manager.h" +#include "ephy-debug.h" +#include "ephy-embed-shell.h" +#include "ephy-embed-single.h" +#include "ephy-string.h" +#include "mozilla-embed-event.h" + +#include "mozilla-embed.h" static void mozilla_embed_class_init (MozillaEmbedClass *klass); static void mozilla_embed_init (MozillaEmbed *gs); @@ -92,20 +92,12 @@ struct MozillaEmbedPrivate { EphyBrowser *browser; MozillaEmbedLoadState load_state; -#ifndef HAVE_GECKO_1_8 - guint focus_connected : 1; -#endif /* !HAVE_GECKO_1_8 */ }; #define WINDOWWATCHER_CONTRACTID "@mozilla.org/embedcomp/window-watcher;1" static GObjectClass *parent_class = NULL; -#ifndef HAVE_GECKO_1_8 -static guint fiesid = 0; -static guint foesid = 0; -#endif /* !HAVE_GECKO_1_8 */ - static void impl_manager_do_command (EphyCommandManager *manager, const char *command) @@ -201,28 +193,6 @@ mozilla_embed_grab_focus (GtkWidget *widget) } } -#ifndef HAVE_GECKO_1_8 -static gboolean -child_focus_in_event_cb (GtkWidget *child, - GdkEventFocus *event, - MozillaEmbed *embed) -{ - embed->priv->browser->FocusActivate (); - - return FALSE; -} - -static gboolean -child_focus_out_event_cb (GtkWidget *child, - GdkEventFocus *event, - MozillaEmbed *embed) -{ - embed->priv->browser->FocusDeactivate (); - - return FALSE; -} -#endif /* !HAVE_GECKO_1_8 */ - static void impl_close (EphyEmbed *embed) { @@ -246,60 +216,6 @@ mozilla_embed_realize (GtkWidget *widget) g_warning ("EphyBrowser initialization failed for %p\n", widget); return; } - -#ifndef HAVE_GECKO_1_8 - /* HACK ALERT! This depends highly on undocumented interna of - * GtkMozEmbed! - * - * GtkMozEmbed::realize installs focus-[in|out]-event handlers to - * toplevel, and, on the first realize only, to the child. - * GtkMozEmbed disconnects its focus-[in|out]-event handler - * to the toplevel on unrealize, and leaves the ones to the child - * in place. So we don't need to unblock the blocked handlers - * and therefore need no ::unrealize handler. - */ - - GtkWidget *toplevel = gtk_widget_get_toplevel (widget); - gpointer data = ((GtkMozEmbed *) widget)->data; - - guint n; - - n = g_signal_handlers_block_matched (toplevel, - (GSignalMatchType) (G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DATA), - fiesid, 0, NULL, NULL, data); - n += g_signal_handlers_block_matched (toplevel, - (GSignalMatchType) (G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DATA), - foesid, 0, NULL, NULL, data); - if (n != 2) - { - g_warning ("Unexpected number (n=%d) of toplevel focus handlers found!\n", n); - } - - if (mpriv->focus_connected) return; - - GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget)); - g_return_if_fail (child != NULL); - - n = g_signal_handlers_block_matched (child, - (GSignalMatchType) (G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DATA), - fiesid, 0, NULL, NULL, widget); - n += g_signal_handlers_block_matched (child, - (GSignalMatchType) (G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DATA), - foesid, 0, NULL, NULL, widget); - if (n != 2) - { - g_warning ("Unexpected number (n=%d) of child focus handlers found!\n", n); - } - - g_signal_connect_object (child, "focus-in-event", - G_CALLBACK (child_focus_in_event_cb), widget, - G_CONNECT_AFTER); - g_signal_connect_object (child, "focus-out-event", - G_CALLBACK (child_focus_out_event_cb), widget, - G_CONNECT_AFTER); - - mpriv->focus_connected = TRUE; -#endif /* !HAVE_GECKO_1_8 */ } static GObject * @@ -332,11 +248,6 @@ mozilla_embed_class_init (MozillaEmbedClass *klass) widget_class->grab_focus = mozilla_embed_grab_focus; widget_class->realize = mozilla_embed_realize; -#ifndef HAVE_GECKO_1_8 - fiesid = g_signal_lookup ("focus-in-event", GTK_TYPE_WIDGET); - foesid = g_signal_lookup ("focus-out-event", GTK_TYPE_WIDGET); -#endif /* !HAVE_GECKO_1_8 */ - g_type_class_add_private (object_class, sizeof(MozillaEmbedPrivate)); } @@ -434,15 +345,15 @@ impl_can_go_forward (EphyEmbed *embed) static gboolean mozilla_embed_get_uri_parent (MozillaEmbed *membed, const char *aUri, - nsEmbedCString &aParent) + nsCString &aParent) { nsresult rv; - nsEmbedCString encoding; + nsCString encoding; rv = membed->priv->browser->GetEncoding (encoding); if (NS_FAILED (rv)) return FALSE; nsCOMPtr<nsIURI> uri; - rv = EphyUtils::NewURI (getter_AddRefs(uri), nsEmbedCString(aUri), encoding.get()); + rv = EphyUtils::NewURI (getter_AddRefs(uri), nsCString(aUri), encoding.get()); if (NS_FAILED(rv) || !uri) return FALSE; /* Don't support going 'up' with chrome url's, mozilla handily @@ -450,12 +361,12 @@ mozilla_embed_get_uri_parent (MozillaEmbed *membed, * rdf/chrome/src/nsChromeProtocolHandler.cpp::NewURI() * (the Canonify() call) */ - nsEmbedCString scheme; + nsCString scheme; rv = uri->GetScheme (scheme); if (NS_FAILED(rv) || !scheme.Length()) return FALSE; if (strcmp (scheme.get(), "chrome") == 0) return FALSE; - nsEmbedCString path; + nsCString path; rv = uri->GetPath(path); if (NS_FAILED(rv) || !path.Length()) return FALSE; if (strcmp (path.get (), "/") == 0) return FALSE; @@ -466,12 +377,12 @@ mozilla_embed_get_uri_parent (MozillaEmbed *membed, if (slash[1] == '\0') { /* ends with a slash - a directory, go to parent */ - rv = uri->Resolve (nsEmbedCString(".."), aParent); + rv = uri->Resolve (nsCString(".."), aParent); } else { /* it's a file, go to the directory */ - rv = uri->Resolve (nsEmbedCString("."), aParent); + rv = uri->Resolve (nsCString("."), aParent); } return NS_SUCCEEDED (rv); @@ -487,7 +398,7 @@ impl_can_go_up (EphyEmbed *embed) address = ephy_embed_get_location (embed, TRUE); if (address == NULL) return FALSE; - nsEmbedCString parent; + nsCString parent; result = mozilla_embed_get_uri_parent (membed, address, parent); g_free (address); @@ -505,7 +416,7 @@ impl_get_go_up_list (EphyEmbed *embed) if (address == NULL) return NULL; s = address; - nsEmbedCString parent; + nsCString parent; while (mozilla_embed_get_uri_parent (membed, s, parent)) { s = g_strdup (parent.get()); @@ -539,7 +450,7 @@ impl_go_up (EphyEmbed *embed) if (uri == NULL) return; gboolean rv; - nsEmbedCString parent_uri; + nsCString parent_uri; rv = mozilla_embed_get_uri_parent (membed, uri, parent_uri); g_free (uri); @@ -591,11 +502,11 @@ impl_get_location (EphyEmbed *embed, if (NS_FAILED (rv) || !furi) furi.swap(uri); /* Hide password part */ - nsEmbedCString user; + nsCString user; furi->GetUsername (user); furi->SetUserPass (user); - nsEmbedCString url; + nsCString url; furi->GetSpec (url); return url.Length() ? g_strdup (url.get()) : NULL; @@ -700,7 +611,7 @@ impl_shistory_get_nth (EphyEmbed *embed, char **aTitle) { nsresult rv; - nsEmbedCString url; + nsCString url; PRUnichar *title; MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv; @@ -717,8 +628,8 @@ impl_shistory_get_nth (EphyEmbed *embed, if (title) { - nsEmbedCString cTitle; - NS_UTF16ToCString (nsEmbedString(title), + nsCString cTitle; + NS_UTF16ToCString (nsString(title), NS_CSTRING_ENCODING_UTF8, cTitle); *aTitle = g_strdup (cTitle.get()); nsMemory::Free (title); @@ -776,7 +687,7 @@ impl_get_security_level (EphyEmbed *embed, nsresult rv; PRUint32 state; - nsEmbedCString desc; + nsCString desc; rv = mpriv->browser->GetSecurityInfo (&state, desc); if (NS_FAILED (rv)) return; @@ -836,7 +747,7 @@ impl_set_encoding (EphyEmbed *embed, { MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv; nsresult rv; - nsEmbedCString currEnc; + nsCString currEnc; g_return_if_fail (encoding != NULL); @@ -859,7 +770,7 @@ impl_get_encoding (EphyEmbed *embed) { MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv; nsresult rv; - nsEmbedCString encoding; + nsCString encoding; rv = mpriv->browser->GetEncoding (encoding); @@ -876,7 +787,7 @@ impl_has_automatic_encoding (EphyEmbed *embed) { MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv; nsresult rv; - nsEmbedCString encoding; + nsCString encoding; rv = mpriv->browser->GetForcedEncoding (encoding); @@ -923,7 +834,6 @@ update_load_state (MozillaEmbed *membed, gint state) priv->browser->GetDocumentType ()); } -#ifdef HAVE_GECKO_1_8 if (state & GTK_MOZ_EMBED_FLAG_RESTORING && priv->load_state == MOZILLA_EMBED_LOAD_STARTED) { @@ -934,7 +844,6 @@ update_load_state (MozillaEmbed *membed, gint state) g_signal_emit_by_name (membed, "ge-content-change", address); g_free (address); } -#endif if (state & GTK_MOZ_EMBED_FLAG_IS_NETWORK) { @@ -994,9 +903,7 @@ mozilla_embed_net_state_all_cb (GtkMozEmbed *embed, const char *aURI, { GTK_MOZ_EMBED_FLAG_IS_REQUEST, EPHY_EMBED_STATE_IS_REQUEST }, { GTK_MOZ_EMBED_FLAG_IS_DOCUMENT, EPHY_EMBED_STATE_IS_DOCUMENT }, { GTK_MOZ_EMBED_FLAG_IS_NETWORK, EPHY_EMBED_STATE_IS_NETWORK }, -#ifdef HAVE_GECKO_1_8 { GTK_MOZ_EMBED_FLAG_RESTORING, EPHY_EMBED_STATE_RESTORING }, -#endif { 0, EPHY_EMBED_STATE_UNKNOWN } }; diff --git a/embed/mozilla/mozilla-embed.h b/embed/mozilla/mozilla-embed.h index d10c850b8..dc26493e0 100644 --- a/embed/mozilla/mozilla-embed.h +++ b/embed/mozilla/mozilla-embed.h @@ -21,12 +21,12 @@ #ifndef MOZILLA_EMBED_H #define MOZILLA_EMBED_H -#include "ephy-embed.h" +#include <glib.h> +#include <glib-object.h> #include <gtkmozembed.h> -#include <glib-object.h> -#include <glib.h> +#include "ephy-embed.h" G_BEGIN_DECLS diff --git a/embed/mozilla/mozilla-notifiers.cpp b/embed/mozilla/mozilla-notifiers.cpp index 153c8df73..07c7f8502 100644 --- a/embed/mozilla/mozilla-notifiers.cpp +++ b/embed/mozilla/mozilla-notifiers.cpp @@ -21,31 +21,32 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "mozilla-notifiers.h" - -#include "eel-gconf-extensions.h" -#include "ephy-prefs.h" -#include "ephy-embed-prefs.h" -#include "ephy-langs.h" -#include "ephy-node.h" -#include "ephy-encodings.h" -#include "ephy-embed-shell.h" -#include "ephy-debug.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <glib/gi18n.h> #include <gdk/gdkx.h> #include <gtk/gtksettings.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> #include <nsCOMPtr.h> -#include <nsIServiceManager.h> #include <nsIPrefService.h> +#include <nsIServiceManager.h> #include <nsMemory.h> +#include <nsServiceManagerUtils.h> + +#include "eel-gconf-extensions.h" +#include "ephy-debug.h" +#include "ephy-embed-prefs.h" +#include "ephy-embed-shell.h" +#include "ephy-encodings.h" +#include "ephy-langs.h" +#include "ephy-node.h" +#include "ephy-prefs.h" + +#include "mozilla-notifiers.h" /* define to migrate epiphany 1.0 font preferences */ #define MIGRATE_PIXEL_SIZE diff --git a/embed/mozilla/mozilla-notifiers.h b/embed/mozilla/mozilla-notifiers.h index 6b6a06eda..f47d4b830 100644 --- a/embed/mozilla/mozilla-notifiers.h +++ b/embed/mozilla/mozilla-notifiers.h @@ -23,6 +23,7 @@ #ifndef MOZILLA_NOTIFIERS_H #define MOZILLA_NOTIFIERS_H +#include <glib.h> #include <glib-object.h> #include <gconf/gconf.h> diff --git a/embed/mozilla/mozilla-x509-cert.cpp b/embed/mozilla/mozilla-x509-cert.cpp index c80ee918d..60468ee9b 100644 --- a/embed/mozilla/mozilla-x509-cert.cpp +++ b/embed/mozilla/mozilla-x509-cert.cpp @@ -20,15 +20,13 @@ */ #include "mozilla-config.h" - #include "config.h" -#include "mozilla-x509-cert.h" +#include <nsStringAPI.h> + #include "ephy-debug.h" -#undef MOZILLA_INTERNAL_API -#include <nsEmbedString.h> -#define MOZILLA_INTERNAL_API 1 +#include "mozilla-x509-cert.h" #define MOZILLA_X509_CERT_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \ MOZILLA_TYPE_X509_CERT, MozillaX509CertPrivate)) @@ -128,11 +126,11 @@ impl_get_title (EphyX509Cert *cert) /* This title logic is adapted from Mozilla source at mozilla/security/manager/ssl/src/nsCertTree.cpp */ - nsEmbedString name; + nsString name; m_cert->priv->mozilla_cert->GetCommonName (name); if (name.Length()) { - nsEmbedCString cname; + nsCString cname; NS_UTF16ToCString (name, NS_CSTRING_ENCODING_UTF8, cname); m_cert->priv->title = g_strdup (cname.get()); @@ -140,10 +138,10 @@ impl_get_title (EphyX509Cert *cert) else { /* No common name, so get the nickname instead */ - nsEmbedString nick; + nsString nick; m_cert->priv->mozilla_cert->GetNickname (nick); - nsEmbedCString cnick; + nsCString cnick; NS_UTF16ToCString (nick, NS_CSTRING_ENCODING_UTF8, cnick); const char * str = cnick.get(); diff --git a/embed/mozilla/mozilla-x509-cert.h b/embed/mozilla/mozilla-x509-cert.h index eb0cbe5ec..f5aae190e 100644 --- a/embed/mozilla/mozilla-x509-cert.h +++ b/embed/mozilla/mozilla-x509-cert.h @@ -24,6 +24,7 @@ #include "ephy-x509-cert.h" #include <glib-object.h> + #include <nsCOMPtr.h> #include <nsIX509Cert.h> |