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/mozilla/ContentHandler.cpp | |
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/mozilla/ContentHandler.cpp')
-rw-r--r-- | embed/mozilla/ContentHandler.cpp | 145 |
1 files changed, 34 insertions, 111 deletions
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 { |