aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/EphyHeaderSniffer.cpp
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@src.gnome.org>2004-03-17 17:02:38 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2004-03-17 17:02:38 +0800
commitdbdcf80ba8e559236f9937aaafba1d14b1cee46e (patch)
treed5711b633861b6ffc879fbbce08ea1364e9a64c9 /embed/mozilla/EphyHeaderSniffer.cpp
parent9765279aba4cbed66b182e91eaa18e8225305a18 (diff)
downloadgsoc2013-epiphany-dbdcf80ba8e559236f9937aaafba1d14b1cee46e.tar
gsoc2013-epiphany-dbdcf80ba8e559236f9937aaafba1d14b1cee46e.tar.gz
gsoc2013-epiphany-dbdcf80ba8e559236f9937aaafba1d14b1cee46e.tar.bz2
gsoc2013-epiphany-dbdcf80ba8e559236f9937aaafba1d14b1cee46e.tar.lz
gsoc2013-epiphany-dbdcf80ba8e559236f9937aaafba1d14b1cee46e.tar.xz
gsoc2013-epiphany-dbdcf80ba8e559236f9937aaafba1d14b1cee46e.tar.zst
gsoc2013-epiphany-dbdcf80ba8e559236f9937aaafba1d14b1cee46e.zip
merging pre-gnome-2-8 branch
Diffstat (limited to 'embed/mozilla/EphyHeaderSniffer.cpp')
-rw-r--r--embed/mozilla/EphyHeaderSniffer.cpp31
1 files changed, 7 insertions, 24 deletions
diff --git a/embed/mozilla/EphyHeaderSniffer.cpp b/embed/mozilla/EphyHeaderSniffer.cpp
index 68e51ca6c..28bbf7e22 100644
--- a/embed/mozilla/EphyHeaderSniffer.cpp
+++ b/embed/mozilla/EphyHeaderSniffer.cpp
@@ -67,9 +67,7 @@
#include "nsIMIMEInfo.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDownload.h"
-#if MOZILLA_SNAPSHOT > 10
#include "nsIMIMEHeaderParam.h"
-#endif
#include <glib/gi18n.h>
#include <libgnomevfs/gnome-vfs-utils.h>
@@ -245,7 +243,6 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI)
if (defaultFileName.IsEmpty() && !mContentDisposition.IsEmpty())
{
/* 1 Use the HTTP header suggestion. */
-#if MOZILLA_SNAPSHOT > 10
nsCOMPtr<nsIMIMEHeaderParam> mimehdrpar =
do_GetService("@mozilla.org/network/mime-hdrparam;1");
@@ -274,17 +271,6 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI)
defaultFileName = fileName;
}
}
-#else
- PRInt32 index = mContentDisposition.Find("filename=");
- if (index >= 0)
- {
- /* Take the substring following the prefix. */
- index += strlen ("filename=");
- nsCAutoString filename;
- mContentDisposition.Right(filename, mContentDisposition.Length() - index);
- defaultFileName = NS_ConvertUTF8toUCS2(filename);
- }
-#endif
}
if (defaultFileName.IsEmpty())
@@ -296,10 +282,7 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI)
{
nsCAutoString fileNameCString;
url->GetFileName(fileNameCString);
- /* FIXME: when we can depend on moz >= 1.5, use
- * CopyUTF8toUTF16 instead
- */
- defaultFileName = NS_ConvertUTF8toUCS2(fileNameCString);
+ CopyUTF8toUTF16 (fileNameCString, defaultFileName);
}
}
@@ -319,25 +302,25 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI)
/* 4 Use the host. */
nsCAutoString hostName;
mURL->GetHost(hostName);
- /* FIXME: when we can depend on moz >= 1.5, use
- * CopyUTF8toUTF16 instead
- */
- defaultFileName = NS_ConvertUTF8toUCS2(hostName);
+ CopyUTF8toUTF16 (hostName, defaultFileName);
}
/* 5 One last case to handle about:blank and other untitled pages. */
if (defaultFileName.IsEmpty())
{
- defaultFileName = NS_ConvertUTF8toUCS2 (_("Untitled"));
+ CopyUTF8toUTF16 (_("Untitled"), defaultFileName);
}
/* Validate the file name to ensure legality. */
- char *default_name = g_strdup (NS_ConvertUCS2toUTF8 (defaultFileName).get());
+ char *default_name = g_strdup (NS_ConvertUTF16toUTF8 (defaultFileName).get());
default_name = g_strdelimit (default_name, "/", ' ');
const char *key;
key = ephy_embed_persist_get_persist_key (EPHY_EMBED_PERSIST (mEmbedPersist));
+ /* FIXME: do better here by using nsITextToSubURI service, like in
+ * http://lxr.mozilla.org/seamonkey/source/xpfe/communicator/resources/content/contentAreaUtils.js#763
+ */
char *filename;
filename = gnome_vfs_unescape_string (default_name, NULL);