aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog27
-rw-r--r--configure.in9
-rw-r--r--embed/mozilla/ContentHandler.cpp40
-rw-r--r--embed/mozilla/ContentHandler.h6
-rw-r--r--embed/mozilla/EphyHeaderSniffer.cpp1
-rw-r--r--embed/mozilla/EventContext.h1
-rw-r--r--embed/mozilla/FilePicker.cpp105
-rw-r--r--embed/mozilla/MozDownload.cpp72
-rw-r--r--embed/mozilla/MozDownload.h14
-rw-r--r--embed/mozilla/mozilla-download.cpp4
-rw-r--r--embed/mozilla/mozilla-embed-persist.cpp1
11 files changed, 248 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index 530695593..ab742e5ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,24 @@
+2004-04-27 Marco Pesenti Gritti <marco@gnome.org>
+
+ * configure.in:
+ * embed/mozilla/ContentHandler.cpp:
+ * embed/mozilla/ContentHandler.h:
+ * embed/mozilla/EphyHeaderSniffer.cpp:
+ * embed/mozilla/EventContext.h:
+ * embed/mozilla/FilePicker.cpp:
+ * embed/mozilla/MozDownload.cpp:
+ * embed/mozilla/MozDownload.h:
+ * embed/mozilla/mozilla-download.cpp:
+ * embed/mozilla/mozilla-embed-persist.cpp:
+
+ Nice mess of defines to support 1.8a. Damn.
+
2004-04-27 Christian Persch <chpe@cvs.gnome.org>
- * src/ephy-window.c: (ephy_window_delete_event_cb):
+ * src/ephy-window.c: (ephy_window_delete_event_cb):
- Exit print preview mode before closing a window. Fixes a crasher;
- Epiphany equivalent of galeon bug #121298.
+ Exit print preview mode before closing a window. Fixes a crasher;
+ Epiphany equivalent of galeon bug #121298.
2004-04-26 Marco Pesenti Gritti <marco@gnome.org>
@@ -63,7 +78,7 @@
* lib/ephy-dialog.h:
* src/prefs-dialog.c: (setup_font_combo):
- Fix font selection combo box issues; fixes bug #138560.
+ Fix font selection combo box issues; fixes bug #138560.
2004-04-18 Christian Persch <chpe@cvs.gnome.org>
@@ -79,8 +94,8 @@
* src/ephy-window.c: (ephy_window_set_chrome),
(ephy_window_set_property), (ephy_window_class_init):
- Fix chrome for new windows opened from _blank target.
- Fixes bug #139512.
+ Fix chrome for new windows opened from _blank target.
+ Fixes bug #139512.
2004-04-17 Marco Pesenti Gritti <marco@gnome.org>
diff --git a/configure.in b/configure.in
index e3c57b2be..6598b4b09 100644
--- a/configure.in
+++ b/configure.in
@@ -143,8 +143,8 @@ MOZILLA_VERSION="`$PKG_CONFIG --modversion mozilla-gtkmozembed`"
dnl allow user to override the autodetected mozilla version
dnl - without arguments for cvs head
AC_ARG_WITH(mozilla-snapshot,
- AC_HELP_STRING([--with-mozilla-snapshot@<:@=1.6|1.7a|1.7b|trunk@:>@],
- [Whether to try building against mozilla 1.6|1.7a|1.7b|trunk
+ AC_HELP_STRING([--with-mozilla-snapshot@<:@=1.6|1.7a|1.7b|1.8a|trunk@:>@],
+ [Whether to try building against mozilla 1.6|1.7a|1.7b|1.8a|trunk
snapshot. @<:@guessed@:>@]),
[autodetect=" (guessed: $MOZILLA_VERSION)"; MOZILLA_VERSION="$withval"])
@@ -155,10 +155,11 @@ case "$MOZILLA_VERSION" in
1.7a) MOZILLA_SNAPSHOT=14 ;;
1.7b) MOZILLA_SNAPSHOT=15 ;;
1.7) MOZILLA_SNAPSHOT=15 ;;
-trunk) MOZILLA_SNAPSHOT=15 ;;
+ 1.8a) MOZILLA_SNAPSHOT=16 ;;
+trunk) MOZILLA_SNAPSHOT=16 ;;
*) AC_ERROR([
*****************************************************************************
-Epiphany can be built using Mozilla 1.6, 1.7a, 1.7b, or
+Epiphany can be built using Mozilla 1.6, 1.7a, 1.7b, 1.8a or
trunk snapshot, but the version available is $MOZILLA_VERSION.
When using Mozilla trunk snapshot, a successful build is not guaranteed due
diff --git a/embed/mozilla/ContentHandler.cpp b/embed/mozilla/ContentHandler.cpp
index 460d9a937..489ab72ae 100644
--- a/embed/mozilla/ContentHandler.cpp
+++ b/embed/mozilla/ContentHandler.cpp
@@ -58,16 +58,25 @@ class GContentHandler;
NS_IMPL_ISUPPORTS1(GContentHandler, nsIHelperAppLauncherDialog)
+#if MOZILLA_SNAPSHOT < 16
GContentHandler::GContentHandler() : mMimeType(nsnull)
{
LOG ("GContentHandler ctor (%p)", this)
}
+#else
+GContentHandler::GContentHandler()
+{
+ LOG ("GContentHandler ctor (%p)", this)
+}
+#endif
GContentHandler::~GContentHandler()
{
LOG ("GContentHandler dtor (%p)", this)
+#if MOZILLA_SNAPSHOT < 16
nsMemory::Free (mMimeType);
+#endif
}
////////////////////////////////////////////////////////////////////////////////
@@ -89,9 +98,14 @@ NS_IMETHODIMP GContentHandler::Show(nsIHelperAppLauncher *aLauncher,
NS_ENSURE_SUCCESS (rv, rv);
single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (embed_shell));
+#if MOZILLA_SNAPSHOT < 16
g_signal_emit_by_name (single, "handle_content", mMimeType,
mUrl.get(), &handled);
-
+#else
+ g_signal_emit_by_name (single, "handle_content", mMimeType.get(),
+ mUrl.get(), &handled);
+#endif
+
if (!handled)
{
MIMEDoAction ();
@@ -214,7 +228,11 @@ NS_METHOD GContentHandler::Init (void)
mLauncher->GetMIMEInfo (getter_AddRefs(MIMEInfo));
NS_ENSURE_TRUE (MIMEInfo, NS_ERROR_FAILURE);
+#if MOZILLA_SNAPSHOT < 16
rv = MIMEInfo->GetMIMEType (&mMimeType);
+#else
+ rv = MIMEInfo->GetMIMEType (mMimeType);
+#endif
mLauncher->GetTargetFile (getter_AddRefs(mTempFile));
@@ -329,9 +347,18 @@ NS_METHOD GContentHandler::MIMEDoAction (void)
auto_downloads = eel_gconf_get_boolean (CONF_AUTO_DOWNLOADS);
- mHelperApp = gnome_vfs_mime_get_default_application (mMimeType);
+#if MOZILLA_SNAPSHOT < 16
+ mHelperApp = gnome_vfs_mime_get_default_application (mMimeType);
+#else
+ mHelperApp = gnome_vfs_mime_get_default_application (mMimeType.get());
+#endif
CheckAppSupportScheme ();
+
+#if MOZILLA_SNAPSHOT < 16
mPermission = ephy_embed_shell_check_mime (embed_shell, mMimeType);
+#else
+ mPermission = ephy_embed_shell_check_mime (embed_shell, mMimeType.get());
+#endif
if (auto_downloads)
{
@@ -361,12 +388,21 @@ NS_METHOD GContentHandler::MIMEDoAction (void)
/* HACK we use the application description to ask
MozDownload to open the file when download
is finished */
+#if MOZILLA_SNAPSHOT < 16
mimeInfo->SetApplicationDescription
(NS_LITERAL_STRING ("gnome-default").get());
+#else
+ mimeInfo->SetApplicationDescription
+ (NS_LITERAL_STRING ("gnome-default"));
+#endif
}
else
{
+#if MOZILLA_SNAPSHOT < 16
mimeInfo->SetApplicationDescription (nsnull);
+#else
+ mimeInfo->SetApplicationDescription (NS_LITERAL_STRING (""));
+#endif
}
if (mAction == CONTENT_ACTION_OPEN)
diff --git a/embed/mozilla/ContentHandler.h b/embed/mozilla/ContentHandler.h
index a7f4cb7ca..3d850d9c6 100644
--- a/embed/mozilla/ContentHandler.h
+++ b/embed/mozilla/ContentHandler.h
@@ -82,7 +82,11 @@ class GContentHandler : public nsIHelperAppLauncherDialog
nsCOMPtr<nsIFile> mTempFile;
nsCOMPtr<nsISupports> mContext;
- char *mMimeType;
+#if MOZILLA_SNAPSHOT < 16
+ char *mMimeType;
+#else
+ nsCString mMimeType;
+#endif
PRBool mAppSupportScheme;
GnomeVFSMimeApplication *mHelperApp;
ContentAction mAction;
diff --git a/embed/mozilla/EphyHeaderSniffer.cpp b/embed/mozilla/EphyHeaderSniffer.cpp
index f2ac46543..9ee7d1ce1 100644
--- a/embed/mozilla/EphyHeaderSniffer.cpp
+++ b/embed/mozilla/EphyHeaderSniffer.cpp
@@ -371,6 +371,7 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI)
nsresult EphyHeaderSniffer::InitiateDownload (nsILocalFile *aDestFile)
{
LOG ("Initiating download")
+
return InitiateMozillaDownload (mDocument, mURL, aDestFile,
mContentType.get(), mOriginalURI, mEmbedPersist,
mPostData, nsnull, -1);
diff --git a/embed/mozilla/EventContext.h b/embed/mozilla/EventContext.h
index 418c088a0..870787cb9 100644
--- a/embed/mozilla/EventContext.h
+++ b/embed/mozilla/EventContext.h
@@ -33,6 +33,7 @@
#include "nsIDOMElementCSSInlineStyle.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsIDOMDocument.h"
+#include "nsIDocument.h"
#include "EphyBrowser.h"
#include "ephy-embed.h"
diff --git a/embed/mozilla/FilePicker.cpp b/embed/mozilla/FilePicker.cpp
index 1c9612d93..292d7d9a8 100644
--- a/embed/mozilla/FilePicker.cpp
+++ b/embed/mozilla/FilePicker.cpp
@@ -85,8 +85,12 @@ GFilePicker::~GFilePicker()
}
}
-/* void init (in nsIDOMWindowInternal parent, in wstring title, in short mode); */
-NS_IMETHODIMP GFilePicker::Init(nsIDOMWindowInternal *parent, const PRUnichar *title, PRInt16 mode)
+/* void init (in nsIDOMWindow parent, in AString title, in short mode); */
+#if MOZILLA_SNAPSHOT < 16
+NS_IMETHODIMP GFilePicker::Init(nsIDOMWindowInternal *parent, PRUnichar *title, PRInt16 mode)
+#else
+NS_IMETHODIMP GFilePicker::Init(nsIDOMWindow *parent, const nsAString& title, PRInt16 mode)
+#endif
{
LOG ("GFilePicker::Init")
@@ -97,7 +101,11 @@ NS_IMETHODIMP GFilePicker::Init(nsIDOMWindowInternal *parent, const PRUnichar *t
gtk_window_set_transient_for (GTK_WINDOW (mDialog), GTK_WINDOW (pwin));
}
+#if MOZILLA_SNAPSHOT < 16
gtk_window_set_title (GTK_WINDOW (mDialog), NS_ConvertUTF16toUTF8 (title).get());
+#else
+ gtk_window_set_title (GTK_WINDOW (mDialog), NS_ConvertUCS2toUTF8(title).get());
+#endif
mMode = mode;
@@ -159,46 +167,90 @@ NS_IMETHODIMP GFilePicker::AppendFilters(PRInt32 filterMask)
if (filterMask & nsIFilePicker::filterAll)
{
+#if MOZILLA_SNAPSHOT < 16
AppendFilter (NS_ConvertUTF8toUTF16 (_("All files")).get(),
NS_LITERAL_STRING ("*").get());
+#else
+ AppendFilter (NS_ConvertUTF8toUTF16 (_("All files")),
+ NS_LITERAL_STRING ("*"));
+#endif
}
if (filterMask & nsIFilePicker::filterHTML)
{
+#if MOZILLA_SNAPSHOT < 16
AppendFilter (NS_ConvertUTF8toUTF16 (_("HTML files")).get(),
NS_LITERAL_STRING ("*.html; *.htm; *.shtml; *.xhtml").get());
+#else
+ AppendFilter (NS_ConvertUTF8toUTF16 (_("HTML files")),
+ NS_LITERAL_STRING ("*.html; *.htm; *.shtml; *.xhtml"));
+#endif
}
if (filterMask & nsIFilePicker::filterText)
{
+#if MOZILLA_SNAPSHOT < 16
AppendFilter (NS_ConvertUTF8toUTF16 (_("Text files")).get(),
NS_LITERAL_STRING ("*.txt; *.text").get());
+#else
+ AppendFilter (NS_ConvertUTF8toUTF16 (_("Text files")),
+ NS_LITERAL_STRING ("*.txt; *.text"));
+#endif
}
if (filterMask & nsIFilePicker::filterImages)
{
- AppendFilter (NS_ConvertUTF8toUTF16 (_("Image files")).get(),
- NS_LITERAL_STRING ("*.png; *.gif; *.jpeg; *.jpg").get());
+#if MOZILLA_SNAPSHOT < 16
+ AppendFilter (NS_ConvertUTF8toUTF16 (_("Image files")),
+ NS_LITERAL_STRING ("*.png; *.gif; *.jpeg; *.jpg"));
+#else
+ AppendFilter (NS_ConvertUTF8toUTF16 (_("Image files")),
+ NS_LITERAL_STRING ("*.png; *.gif; *.jpeg; *.jpg"));
+#endif
}
if (filterMask & nsIFilePicker::filterXML)
{
- AppendFilter (NS_ConvertUTF8toUTF16 (_("XML files")).get(),
- NS_LITERAL_STRING ("*.xml").get());
+#if MOZILLA_SNAPSHOT < 16
+ AppendFilter (NS_ConvertUTF8toUTF16 (_("XML files")),
+ NS_LITERAL_STRING ("*.xml"));
+#else
+ AppendFilter (NS_ConvertUTF8toUTF16 (_("XML files")),
+ NS_LITERAL_STRING ("*.xml"));
+#endif
}
if (filterMask & nsIFilePicker::filterXUL)
{
+#if MOZILLA_SNAPSHOT < 16
AppendFilter (NS_ConvertUTF8toUTF16 (_("XUL files")).get(),
NS_LITERAL_STRING ("*.xul").get());
+#else
+ AppendFilter (NS_ConvertUTF8toUTF16 (_("XUL files")),
+ NS_LITERAL_STRING ("*.xul"));
+#endif
}
return NS_OK;
}
-/* void appendFilter (in wstring title, in wstring filter); */
+/* void appendFilter (in AString title, in AString filter); */
+#if MOZILLA_SNAPSHOT < 16
NS_IMETHODIMP GFilePicker::AppendFilter(const PRUnichar *title, const PRUnichar *filter)
+#else
+NS_IMETHODIMP GFilePicker::AppendFilter(const nsAString& title, const nsAString& filter)
+#endif
{
+#if MOZILLA_SNAPHOST < 16
LOG ("GFilePicker::AppendFilter title '%s' for '%s'",
NS_ConvertUTF16toUTF8 (title).get(),
NS_ConvertUTF16toUTF8 (filter).get())
+#else
+ LOG ("GFilePicker::AppendFilter title '%s' for '%s'",
+ NS_ConvertUCS2toUTF8 (title),
+ NS_ConvertUCS2toUTF8 (filter))
+#endif
+#if MOZILLA_SNAPHOST < 16
NS_ConvertUTF16toUTF8 pattern(filter);
+#else
+ NS_ConvertUCS2toUTF8 pattern(filter);
+#endif
pattern.StripWhitespace();
if (pattern.IsEmpty()) return NS_ERROR_FAILURE;
@@ -211,7 +263,11 @@ NS_IMETHODIMP GFilePicker::AppendFilter(const PRUnichar *title, const PRUnichar
gtk_file_filter_add_pattern (filth, patterns[i]);
}
+#if MOZILLA_SNAPHOST < 16
gtk_file_filter_set_name (filth, NS_ConvertUTF16toUTF8(title).get());
+#else
+ gtk_file_filter_set_name (filth, NS_ConvertUCS2toUTF8(title).get());
+#endif
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (mDialog), filth);
g_strfreev (patterns);
@@ -219,8 +275,12 @@ NS_IMETHODIMP GFilePicker::AppendFilter(const PRUnichar *title, const PRUnichar
return NS_OK;
}
-/* attribute wstring defaultString; */
+/* attribute AString defaultString; */
+#if MOZILLA_SNAPSHOT < 16
NS_IMETHODIMP GFilePicker::GetDefaultString(PRUnichar **aDefaultString)
+#else
+NS_IMETHODIMP GFilePicker::GetDefaultString(nsAString& aDefaultString)
+#endif
{
char *filename, *converted;
@@ -231,7 +291,7 @@ NS_IMETHODIMP GFilePicker::GetDefaultString(PRUnichar **aDefaultString)
{
converted = g_filename_to_utf8(filename, -1, NULL, NULL, NULL);
- *aDefaultString = ToNewUnicode (NS_ConvertUTF8toUTF16 (converted));
+ aDefaultString = NS_ConvertUTF8toUTF16 (converted);
g_free (filename);
g_free (converted);
@@ -240,31 +300,54 @@ NS_IMETHODIMP GFilePicker::GetDefaultString(PRUnichar **aDefaultString)
return NS_OK;
}
+#if MOZILLA_SNAPSHOT < 16
NS_IMETHODIMP GFilePicker::SetDefaultString(const PRUnichar *aDefaultString)
+#else
+NS_IMETHODIMP GFilePicker::SetDefaultString(const nsAString& aDefaultString)
+#endif
{
+#if MOZILLA_SNAPSHOT < 16
LOG ("GFilePicker::SetDefaultString to %s",
NS_ConvertUTF16toUTF8 (aDefaultString).get())
+#else
+ LOG ("GFilePicker::SetDefaultString to %s",
+ NS_ConvertUCS2toUTF8 (aDefaultString).get())
+#endif
- if (aDefaultString)
+ if (aDefaultString.Length())
{
/* set_current_name takes UTF-8, not a filename */
+#if MOZILLA_SNAPSHOT < 16
gtk_file_chooser_set_current_name
(GTK_FILE_CHOOSER (mDialog),
NS_ConvertUTF16toUTF8 (aDefaultString).get());
+#else
+ gtk_file_chooser_set_current_name
+ (GTK_FILE_CHOOSER (mDialog),
+ NS_ConvertUCS2toUTF8 (aDefaultString).get());
+#endif
}
return NS_OK;
}
-/* attribute wstring defaultExtension; */
+/* attribute AString defaultExtension; */
+#if MOZILLA_SNAPSHOT < 16
NS_IMETHODIMP GFilePicker::GetDefaultExtension(PRUnichar **aDefaultExtension)
+#else
+NS_IMETHODIMP GFilePicker::GetDefaultExtension(nsAString& aDefaultExtension)
+#endif
{
LOG ("GFilePicker::GetDefaultExtension")
return NS_ERROR_NOT_IMPLEMENTED;
}
+#if MOZILLA_SNAPSHOT < 16
NS_IMETHODIMP GFilePicker::SetDefaultExtension(const PRUnichar *aDefaultExtension)
+#else
+NS_IMETHODIMP GFilePicker::SetDefaultExtension(const nsAString& aDefaultExtension)
+#endif
{
LOG ("GFilePicker::SetDefaultExtension to %s",
NS_ConvertUTF16toUTF8(aDefaultExtension).get())
diff --git a/embed/mozilla/MozDownload.cpp b/embed/mozilla/MozDownload.cpp
index 722e7d8a5..2dd99e98d 100644
--- a/embed/mozilla/MozDownload.cpp
+++ b/embed/mozilla/MozDownload.cpp
@@ -60,7 +60,9 @@
#include "nsDirectoryServiceUtils.h"
#include "nsIRequest.h"
#include "nsIMIMEInfo.h"
+#include "nsIFileURL.h"
#include "netCore.h"
+#include "nsNetUtil.h"
const char* const persistContractID = "@mozilla.org/embedding/browser/nsWebBrowserPersist;1";
@@ -80,10 +82,14 @@ MozDownload::~MozDownload()
NS_ASSERTION (!mEphyDownload, "MozillaDownload still alive!");
}
+#if MOZILLA_SNAPSHOT < 16
NS_IMPL_ISUPPORTS2(MozDownload, nsIDownload, nsIWebProgressListener)
+#else
+NS_IMPL_ISUPPORTS3(MozDownload, nsIDownload, nsITransfer, nsIWebProgressListener)
+#endif
NS_IMETHODIMP
-MozDownload::InitForEmbed (nsIURI *aSource, nsILocalFile *aTarget, const PRUnichar *aDisplayName,
+MozDownload::InitForEmbed (nsIURI *aSource, nsIURI *aTarget, const PRUnichar *aDisplayName,
nsIMIMEInfo *aMIMEInfo, PRInt64 startTime, nsIWebBrowserPersist *aPersist,
MozillaEmbedPersist *aEmbedPersist, PRInt32 aMaxSize)
{
@@ -92,10 +98,16 @@ MozDownload::InitForEmbed (nsIURI *aSource, nsILocalFile *aTarget, const PRUnich
return Init (aSource, aTarget, aDisplayName, aMIMEInfo, startTime, aPersist);
}
-/* void init (in nsIURI aSource, in nsILocalFile aTarget, in wstring aDisplayName, in nsIMIMEInfo aMIMEInfo, in long long startTime, in nsIWebBrowserPersist aPersist); */
+/* void init (in nsIURI aSource, in nsIURI aTarget, in wstring aDisplayName, in nsIMIMEInfo aMIMEInfo, in long long startTime, in nsIWebBrowserPersist aPersist); */
+#if MOZILLA_SNAPSHOT < 16
NS_IMETHODIMP
MozDownload::Init(nsIURI *aSource, nsILocalFile *aTarget, const PRUnichar *aDisplayName,
- nsIMIMEInfo *aMIMEInfo, PRInt64 startTime, nsIWebBrowserPersist *aPersist)
+ nsIMIMEInfo *aMIMEInfo, PRInt64 startTime, nsIWebBrowserPersist *aPersist)
+#else
+NS_IMETHODIMP
+MozDownload::Init(nsIURI *aSource, nsIURI *aTarget, const PRUnichar *aDisplayName,
+ nsIMIMEInfo *aMIMEInfo, PRInt64 startTime, nsIWebBrowserPersist *aPersist)
+#endif
{
PRBool addToView = PR_TRUE;
nsresult rv;
@@ -153,8 +165,13 @@ MozDownload::GetSource(nsIURI **aSource)
return NS_OK;
}
+#if MOZILLA_SNAPSHOT < 16
NS_IMETHODIMP
MozDownload::GetTarget(nsILocalFile **aTarget)
+#else
+NS_IMETHODIMP
+MozDownload::GetTarget(nsIURI **aTarget)
+#endif
{
NS_ENSURE_ARG_POINTER(aTarget);
NS_IF_ADDREF(*aTarget = mDestination);
@@ -162,6 +179,23 @@ MozDownload::GetTarget(nsILocalFile **aTarget)
return NS_OK;
}
+#if MOZILLA_SNAPSHOT > 15
+NS_IMETHODIMP
+MozDownload::GetTargetFile (nsILocalFile** aTargetFile)
+{
+ nsresult rv;
+
+ nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(mDestination, &rv);
+ if (NS_FAILED(rv)) return rv;
+
+ nsCOMPtr<nsIFile> file;
+ rv = fileURL->GetFile(getter_AddRefs(file));
+ if (NS_SUCCEEDED(rv))
+ rv = CallQueryInterface(file, aTargetFile);
+ return rv;
+}
+#endif
+
NS_IMETHODIMP
MozDownload::GetPersist(nsIWebBrowserPersist **aPersist)
{
@@ -313,8 +347,8 @@ MozDownload::OnStateChange (nsIWebProgress *aWebProgress, nsIRequest *aRequest,
else if (NS_SUCCEEDED (aStatus))
{
GnomeVFSMimeApplication *helperApp;
- char *mimeType;
-
+#if MOZILLA_SNAPSHOT < 16
+ char *mimeType;
rv = mMIMEInfo->GetMIMEType (&mimeType);
NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
@@ -327,13 +361,31 @@ MozDownload::OnStateChange (nsIWebProgress *aWebProgress, nsIRequest *aRequest,
if we have to open the saved file */
if ((strcmp (NS_ConvertUTF16toUTF8 (description).get(), "gnome-default") == 0) &&
helperApp)
+#else
+ nsCAutoString mimeType;
+ rv = mMIMEInfo->GetMIMEType (mimeType);
+ NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
+
+ helperApp = gnome_vfs_mime_get_default_application (mimeType.get());
+
+ nsAutoString description;
+ mMIMEInfo->GetApplicationDescription (description);
+
+ /* HACK we use the application description to decide
+ if we have to open the saved file */
+ if ((strcmp (NS_ConvertUCS2toUTF8 (description).get(), "gnome-default") == 0) &&
+ helperApp)
+#endif
{
GList *params = NULL;
char *param;
nsCAutoString aDest;
+#if MOZILLA_SNAPSHOT < 16
mDestination->GetNativePath (aDest);
-
+#else
+ mDestination->GetSpec (aDest);
+#endif
param = gnome_vfs_make_uri_canonical (aDest.get ());
params = g_list_append (params, param);
gnome_vfs_mime_application_launch (helperApp, params);
@@ -341,9 +393,10 @@ MozDownload::OnStateChange (nsIWebProgress *aWebProgress, nsIRequest *aRequest,
g_list_free (params);
}
-
+#if MOZILLA_SNAPSHOT < 16
nsMemory::Free (mimeType);
nsMemory::Free (description);
+#endif
gnome_vfs_mime_application_free (helperApp);
}
}
@@ -478,9 +531,12 @@ nsresult InitiateMozillaDownload (nsIDOMDocument *domDocument, nsIURI *sourceURI
nsAutoString fileDisplayName;
inDestFile->GetLeafName(fileDisplayName);
+ nsCOMPtr<nsIURI> destURI;
+ NS_NewFileURI (getter_AddRefs(destURI), inDestFile);
+
MozDownload *downloader = new MozDownload ();
/* dlListener attaches to its progress dialog here, which gains ownership */
- rv = downloader->InitForEmbed (inOriginalURI, inDestFile, fileDisplayName.get(),
+ rv = downloader->InitForEmbed (inOriginalURI, destURI, fileDisplayName.get(),
nsnull, timeNow, webPersist, embedPersist, aMaxSize);
NS_ENSURE_SUCCESS (rv, rv);
diff --git a/embed/mozilla/MozDownload.h b/embed/mozilla/MozDownload.h
index 326056059..35a81ad2a 100644
--- a/embed/mozilla/MozDownload.h
+++ b/embed/mozilla/MozDownload.h
@@ -98,6 +98,9 @@ public:
virtual ~MozDownload();
NS_DECL_ISUPPORTS
+#if MOZILLA_SNAPSHOT > 15
+ NS_DECL_NSITRANSFER
+#endif
NS_DECL_NSIDOWNLOAD
NS_DECL_NSIWEBPROGRESSLISTENER
@@ -109,14 +112,25 @@ public:
nsresult GetCurrentProgress (PRInt32 *aCurrentProgress);
nsresult GetTotalProgress (PRInt32 *aTProgress);
nsresult GetElapsedTime (PRInt64 *aTProgress);
+#if MOZILLA_SNAPSHOT < 16
nsresult InitForEmbed (nsIURI *aSource, nsILocalFile *aTarget,
const PRUnichar *aDisplayName, nsIMIMEInfo *aMIMEInfo,
PRInt64 startTime, nsIWebBrowserPersist *aPersist,
MozillaEmbedPersist *aEmbedPersist, PRInt32 aMaxSize);
+#else
+ nsresult InitForEmbed (nsIURI *aSource, nsIURI *aTarget,
+ const PRUnichar *aDisplayName, nsIMIMEInfo *aMIMEInfo,
+ PRInt64 startTime, nsIWebBrowserPersist *aPersist,
+ MozillaEmbedPersist *aEmbedPersist, PRInt32 aMaxSize);
+#endif
protected:
nsCOMPtr<nsIURI> mSource;
+#if MOZILLA_SNAPSHOT < 16
nsCOMPtr<nsILocalFile> mDestination;
+#else
+ nsCOMPtr<nsIURI> mDestination;
+#endif
nsCOMPtr<nsIMIMEInfo> mMIMEInfo;
PRInt64 mLastUpdate;
PRInt64 mStartTime;
diff --git a/embed/mozilla/mozilla-download.cpp b/embed/mozilla/mozilla-download.cpp
index 136d05491..455c875a1 100644
--- a/embed/mozilla/mozilla-download.cpp
+++ b/embed/mozilla/mozilla-download.cpp
@@ -87,7 +87,11 @@ impl_get_target (EphyDownload *download)
mozDownload = MOZILLA_DOWNLOAD (download)->priv->moz_download;
+#if MOZILLA_SNAPSHOT < 16
mozDownload->GetTarget (getter_AddRefs (targetFile));
+#else
+ mozDownload->GetTargetFile (getter_AddRefs (targetFile));
+#endif
nsCAutoString tempPathStr;
targetFile->GetNativePath (tempPathStr);
diff --git a/embed/mozilla/mozilla-embed-persist.cpp b/embed/mozilla/mozilla-embed-persist.cpp
index a69c55aad..68f545cfe 100644
--- a/embed/mozilla/mozilla-embed-persist.cpp
+++ b/embed/mozilla/mozilla-embed-persist.cpp
@@ -38,6 +38,7 @@
#include <nsIHistoryEntry.h>
#include <nsISHEntry.h>
#include <nsIDocumentEncoder.h>
+#include <nsIDocument.h>
static void
mozilla_embed_persist_class_init (MozillaEmbedPersistClass *klass);