aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-05-07 21:32:54 +0800
committerChristian Persch <chpe@src.gnome.org>2004-05-07 21:32:54 +0800
commitbb74728ca89c5fefd999f86960c9a16db0e7e5c9 (patch)
treeb9708e6ee104340ff5ec123ae205d221fe5fa82a /embed
parent0dcd33eacecfaa7c83f420e2c1eeda13fa7939e5 (diff)
downloadgsoc2013-epiphany-bb74728ca89c5fefd999f86960c9a16db0e7e5c9.tar
gsoc2013-epiphany-bb74728ca89c5fefd999f86960c9a16db0e7e5c9.tar.gz
gsoc2013-epiphany-bb74728ca89c5fefd999f86960c9a16db0e7e5c9.tar.bz2
gsoc2013-epiphany-bb74728ca89c5fefd999f86960c9a16db0e7e5c9.tar.lz
gsoc2013-epiphany-bb74728ca89c5fefd999f86960c9a16db0e7e5c9.tar.xz
gsoc2013-epiphany-bb74728ca89c5fefd999f86960c9a16db0e7e5c9.tar.zst
gsoc2013-epiphany-bb74728ca89c5fefd999f86960c9a16db0e7e5c9.zip
Merged nsIDownload API changes from HEAD.
2004-05-07 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/ContentHandler.cpp: * embed/mozilla/ContentHandler.h: * embed/mozilla/EventContext.h: * embed/mozilla/FilePicker.cpp: * embed/mozilla/Makefile.am: * embed/mozilla/MozDownload.cpp: * embed/mozilla/MozDownload.h: * embed/mozilla/mozilla-download.cpp: * embed/mozilla/mozilla-embed-persist.cpp: Merged nsIDownload API changes from HEAD.
Diffstat (limited to 'embed')
-rw-r--r--embed/mozilla/ContentHandler.cpp40
-rw-r--r--embed/mozilla/ContentHandler.h6
-rw-r--r--embed/mozilla/EventContext.h3
-rw-r--r--embed/mozilla/FilePicker.cpp134
-rw-r--r--embed/mozilla/Makefile.am1
-rw-r--r--embed/mozilla/MozDownload.cpp78
-rw-r--r--embed/mozilla/MozDownload.h19
-rw-r--r--embed/mozilla/mozilla-download.cpp4
-rw-r--r--embed/mozilla/mozilla-embed-persist.cpp6
9 files changed, 246 insertions, 45 deletions
diff --git a/embed/mozilla/ContentHandler.cpp b/embed/mozilla/ContentHandler.cpp
index eb6853bbe..a1436f9b1 100644
--- a/embed/mozilla/ContentHandler.cpp
+++ b/embed/mozilla/ContentHandler.cpp
@@ -57,16 +57,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
}
////////////////////////////////////////////////////////////////////////////////
@@ -93,9 +102,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 ();
@@ -229,7 +243,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
#if MOZILLA_SNAPSHOT > 11
mLauncher->GetTargetFile (getter_AddRefs(mTempFile));
@@ -351,9 +369,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)
{
@@ -383,12 +410,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/EventContext.h b/embed/mozilla/EventContext.h
index a2deba41b..2f7a64a9f 100644
--- a/embed/mozilla/EventContext.h
+++ b/embed/mozilla/EventContext.h
@@ -14,6 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
*/
#ifndef EVENT_CONTEXT_H
@@ -31,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 3443d17e6..cb3d98138 100644
--- a/embed/mozilla/FilePicker.cpp
+++ b/embed/mozilla/FilePicker.cpp
@@ -24,30 +24,24 @@
#endif
#include "FilePicker.h"
-
-#include "nsCRT.h"
-#include "nsCOMPtr.h"
-#include "nsISupportsArray.h"
-#include "nsIServiceManager.h"
-
-#include "nsString.h"
-#include "nsXPIDLString.h"
-#include "nsIPrefService.h"
-#include "nsIURI.h"
-#include "nsIFileURL.h"
-#include "nsIChannel.h"
-#include "nsIFileChannel.h"
-#include "nsNetCID.h"
-#include "nsILocalFile.h"
-#include "nsIPromptService.h"
-#include "nsReadableUtils.h"
-#include "nsIDOMWindow.h"
-#include "nsIDOMWindowInternal.h"
-#include "nsCOMPtr.h"
-#include "nsString.h"
-#include "nsILocalFile.h"
#include "MozillaPrivate.h"
+#include <nsCOMPtr.h>
+#include <nsIServiceManager.h>
+#include <nsIURI.h>
+#include <nsIFileURL.h>
+#include <nsILocalFile.h>
+#include <nsIPromptService.h>
+#include <nsIDOMWindow.h>
+#include <nsNetCID.h>
+
+#include <nsString.h>
+#include <nsReadableUtils.h>
+
+#if MOZILLA_SNAPSHOT < 16
+#include <nsIDOMWindowInternal.h>
+#endif
+
#include "ephy-string.h"
#include "ephy-prefs.h"
#include "ephy-gui.h"
@@ -85,8 +79,12 @@ GFilePicker::~GFilePicker()
}
}
-/* void init (in nsIDOMWindowInternal parent, in wstring title, in short mode); */
+/* void init (in nsIDOMWindow parent, in AString title, in short mode); */
+#if MOZILLA_SNAPSHOT < 16
NS_IMETHODIMP GFilePicker::Init(nsIDOMWindowInternal *parent, const PRUnichar *title, PRInt16 mode)
+#else
+NS_IMETHODIMP GFilePicker::Init(nsIDOMWindow *parent, const nsAString& title, PRInt16 mode)
+#endif
{
LOG ("GFilePicker::Init")
@@ -97,7 +95,11 @@ NS_IMETHODIMP GFilePicker::Init(nsIDOMWindowInternal *parent, const PRUnichar *t
gtk_window_set_transient_for (GTK_WINDOW (mDialog), GTK_WINDOW (pwin));
}
- gtk_window_set_title (GTK_WINDOW (mDialog), NS_ConvertUCS2toUTF8 (title).get());
+#if MOZILLA_SNAPSHOT < 13
+ gtk_window_set_title (GTK_WINDOW (mDialog), NS_ConvertUCS2toUTF8(title).get());
+#else
+ gtk_window_set_title (GTK_WINDOW (mDialog), NS_ConvertUTF16toUTF8 (title).get());
+#endif
mMode = mode;
@@ -159,47 +161,86 @@ NS_IMETHODIMP GFilePicker::AppendFilters(PRInt32 filterMask)
if (filterMask & nsIFilePicker::filterAll)
{
+#if MOZILLA_SNAPSHOT < 16
AppendFilter (NS_ConvertUTF8toUCS2 (_("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_ConvertUTF8toUCS2 (_("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_ConvertUTF8toUCS2 (_("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)
{
+#if MOZILLA_SNAPSHOT < 16
AppendFilter (NS_ConvertUTF8toUCS2 (_("Image files")).get(),
NS_LITERAL_STRING ("*.png; *.gif; *.jpeg; *.jpg").get());
+#else
+ AppendFilter (NS_ConvertUTF8toUTF16 (_("Image files")),
+ NS_LITERAL_STRING ("*.png; *.gif; *.jpeg; *.jpg"));
+#endif
}
if (filterMask & nsIFilePicker::filterXML)
{
+#if MOZILLA_SNAPSHOT < 16
AppendFilter (NS_ConvertUTF8toUCS2 (_("XML files")).get(),
NS_LITERAL_STRING ("*.xml").get());
+#else
+ AppendFilter (NS_ConvertUTF8toUTF16 (_("XML files")),
+ NS_LITERAL_STRING ("*.xml"));
+#endif
}
if (filterMask & nsIFilePicker::filterXUL)
{
+#if MOZILLA_SNAPSHOT < 16
AppendFilter (NS_ConvertUTF8toUCS2 (_("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
{
LOG ("GFilePicker::AppendFilter title '%s' for '%s'",
NS_ConvertUCS2toUTF8 (title).get(),
NS_ConvertUCS2toUTF8 (filter).get())
- nsCAutoString pattern = NS_ConvertUCS2toUTF8 (filter);
+#if MOZILLA_SNAPHOST < 13
+ NS_ConvertUCS2toUTF8 pattern(filter);
+#else
+ NS_ConvertUTF16toUTF8 pattern(filter);
+#endif
pattern.StripWhitespace();
+ if (pattern.IsEmpty()) return NS_ERROR_FAILURE;
char **patterns = g_strsplit (pattern.get(), ";", -1);
@@ -210,7 +251,11 @@ NS_IMETHODIMP GFilePicker::AppendFilter(const PRUnichar *title, const PRUnichar
gtk_file_filter_add_pattern (filth, patterns[i]);
}
+#if MOZILLA_SNAPHOST < 13
gtk_file_filter_set_name (filth, NS_ConvertUCS2toUTF8(title).get());
+#else
+ gtk_file_filter_set_name (filth, NS_ConvertUTF16toUTF8(title).get());
+#endif
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (mDialog), filth);
g_strfreev (patterns);
@@ -218,8 +263,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;
@@ -230,8 +279,11 @@ NS_IMETHODIMP GFilePicker::GetDefaultString(PRUnichar **aDefaultString)
{
converted = g_filename_to_utf8(filename, -1, NULL, NULL, NULL);
- /* FIXME: when can depend on moz >= 1.6, use CopyUTF8toUCS2 here */
- *aDefaultString = ToNewUnicode (NS_ConvertUTF8toUCS2 (converted));
+#if MOZILLA_SNAPSHOT < 16
+ *aDefaultString = ToNewUnicode (NS_ConvertUTF8toUTF16 (converted));
+#else
+ CopyUTF8toUTF16 (converted, aDefaultString);
+#endif
g_free (filename);
g_free (converted);
@@ -240,31 +292,53 @@ 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
{
LOG ("GFilePicker::SetDefaultString to %s",
NS_ConvertUCS2toUTF8 (aDefaultString).get())
+#if MOZILLA_SNAPSHOT < 16
if (aDefaultString)
+#else
+ if (aDefaultString.Length())
+#endif
{
/* set_current_name takes UTF-8, not a filename */
+#if MOZILLA_SNAPSHOT < 13
gtk_file_chooser_set_current_name
(GTK_FILE_CHOOSER (mDialog),
NS_ConvertUCS2toUTF8 (aDefaultString).get());
+#else
+ gtk_file_chooser_set_current_name
+ (GTK_FILE_CHOOSER (mDialog),
+ NS_ConvertUTF16toUTF8 (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_ConvertUCS2toUTF8(aDefaultExtension).get())
diff --git a/embed/mozilla/Makefile.am b/embed/mozilla/Makefile.am
index 16016a89f..b7d9d8cde 100644
--- a/embed/mozilla/Makefile.am
+++ b/embed/mozilla/Makefile.am
@@ -1,4 +1,3 @@
-# Remove appcomps dir when 1.4 is deprecated
INCLUDES = \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/embed \
diff --git a/embed/mozilla/MozDownload.cpp b/embed/mozilla/MozDownload.cpp
index 473d81cfd..d2354ecd9 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,18 @@ 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
+#if MOZILLA_SNAPSHOT < 16
MozDownload::InitForEmbed (nsIURI *aSource, nsILocalFile *aTarget, const PRUnichar *aDisplayName,
+#else
+MozDownload::InitForEmbed (nsIURI *aSource, nsIURI *aTarget, const PRUnichar *aDisplayName,
+#endif
nsIMIMEInfo *aMIMEInfo, PRInt64 startTime, nsIWebBrowserPersist *aPersist,
MozillaEmbedPersist *aEmbedPersist, PRInt32 aMaxSize)
{
@@ -92,10 +102,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 +169,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 +183,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 +351,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 +365,31 @@ MozDownload::OnStateChange (nsIWebProgress *aWebProgress, nsIRequest *aRequest,
if we have to open the saved file */
if ((strcmp (NS_ConvertUCS2toUTF8 (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 +397,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 +535,18 @@ nsresult InitiateMozillaDownload (nsIDOMDocument *domDocument, nsIURI *sourceURI
nsAutoString fileDisplayName;
inDestFile->GetLeafName(fileDisplayName);
+ #if MOZILLA_SNAPSHOT >= 16
+ nsCOMPtr<nsIURI> destURI;
+ NS_NewFileURI (getter_AddRefs(destURI), inDestFile);
+ #endif
+
MozDownload *downloader = new MozDownload ();
/* dlListener attaches to its progress dialog here, which gains ownership */
+ #if MOZILLA_SNAPSHOT < 16
rv = downloader->InitForEmbed (inOriginalURI, inDestFile, fileDisplayName.get(),
+ #else
+ rv = downloader->InitForEmbed (inOriginalURI, destURI, fileDisplayName.get(),
+ #endif
nsnull, timeNow, webPersist, embedPersist, aMaxSize);
NS_ENSURE_SUCCESS (rv, rv);
diff --git a/embed/mozilla/MozDownload.h b/embed/mozilla/MozDownload.h
index ad5cfb169..35a81ad2a 100644
--- a/embed/mozilla/MozDownload.h
+++ b/embed/mozilla/MozDownload.h
@@ -34,7 +34,10 @@
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
- * ***** END LICENSE BLOCK ***** */
+ * ***** END LICENSE BLOCK *****
+ *
+ * $Id$
+ */
#ifndef MozDownload_h__
#define MozDownload_h__
@@ -95,6 +98,9 @@ public:
virtual ~MozDownload();
NS_DECL_ISUPPORTS
+#if MOZILLA_SNAPSHOT > 15
+ NS_DECL_NSITRANSFER
+#endif
NS_DECL_NSIDOWNLOAD
NS_DECL_NSIWEBPROGRESSLISTENER
@@ -106,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 5c475437f..2e4e1c19f 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);
@@ -137,9 +138,6 @@ impl_save (EphyEmbedPersist *persist)
long max_size;
EphyEmbed *embed;
EmbedPersistFlags flags;
- PRUint32 persistFlags = 0;
-
- /* FIXME implement max size */
g_object_ref (persist);
@@ -167,8 +165,8 @@ impl_save (EphyEmbedPersist *persist)
char *tmp_filename, *base;
base = g_build_filename (g_get_tmp_dir (), "sav-XXXXXX", NULL);
tmp_filename = ephy_file_tmp_filename (base, "html");
- if (tmp_filename == NULL) return FALSE;
g_free (base);
+ if (tmp_filename == NULL) return FALSE;
nsCOMPtr<nsILocalFile> tmpFile = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID);
tmpFile->InitWithNativePath (nsDependentCString (tmp_filename));