aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla
diff options
context:
space:
mode:
authorChristian Persch <chpe@src.gnome.org>2008-03-28 23:08:18 +0800
committerChristian Persch <chpe@src.gnome.org>2008-03-28 23:08:18 +0800
commit8f3dca989dceffa6785610f848e778a90ebab9c9 (patch)
treebc75f53f685cc43d1470f42a2f73a0c1cbd6d000 /embed/mozilla
parent954631cb5f0d76a52459f0ff7f6517733bc4af56 (diff)
downloadgsoc2013-epiphany-8f3dca989dceffa6785610f848e778a90ebab9c9.tar
gsoc2013-epiphany-8f3dca989dceffa6785610f848e778a90ebab9c9.tar.gz
gsoc2013-epiphany-8f3dca989dceffa6785610f848e778a90ebab9c9.tar.bz2
gsoc2013-epiphany-8f3dca989dceffa6785610f848e778a90ebab9c9.tar.lz
gsoc2013-epiphany-8f3dca989dceffa6785610f848e778a90ebab9c9.tar.xz
gsoc2013-epiphany-8f3dca989dceffa6785610f848e778a90ebab9c9.tar.zst
gsoc2013-epiphany-8f3dca989dceffa6785610f848e778a90ebab9c9.zip
Remove the unnecessary setting of the preffered action in the casees that action was going to be the default one anyway. Don't open twice, just let gecko handle opening in the preferred application.
Browse-to doesn't seem to work yet. svn path=/branches/gnome-2-22/; revision=8153
Diffstat (limited to 'embed/mozilla')
-rw-r--r--embed/mozilla/ContentHandler.cpp24
-rw-r--r--embed/mozilla/MozDownload.cpp36
2 files changed, 32 insertions, 28 deletions
diff --git a/embed/mozilla/ContentHandler.cpp b/embed/mozilla/ContentHandler.cpp
index b7ba3b43f..3535d362c 100644
--- a/embed/mozilla/ContentHandler.cpp
+++ b/embed/mozilla/ContentHandler.cpp
@@ -416,14 +416,7 @@ NS_METHOD GContentHandler::MIMEDoAction (void)
mLauncher->GetMIMEInfo(getter_AddRefs(mimeInfo));
NS_ENSURE_TRUE (mimeInfo, NS_ERROR_FAILURE);
-#ifdef HAVE_GECKO_1_9
- nsHandlerInfoAction action;
- if (mAction == CONTENT_ACTION_DOWNLOAD) {
- action = EPHY_ACTION_BROWSE_TO_FILE;
- } else {
- action = nsIMIMEInfo::useSystemDefault;
- }
-#else
+#ifndef HAVE_GECKO_1_9
char *info = NULL;
if (mAction == CONTENT_ACTION_OPEN)
@@ -478,5 +471,20 @@ NS_METHOD GContentHandler::MIMEDoAction (void)
mLauncher->SaveToDisk (nsnull, PR_FALSE);
}
+#ifdef HAVE_GECKO_1_9
+ /* We have to do this work down here because the external helper app modifies the
+ * value after calling SaveToDisk.
+ */
+ nsHandlerInfoAction action;
+ if (mAction == CONTENT_ACTION_DOWNLOAD) {
+ action = EPHY_ACTION_BROWSE_TO_FILE;
+
+ /* This won't be able to transport the activation time so we cannot
+ * do startup notification, but it's the best that was available
+ */
+ mimeInfo->SetPreferredAction (action);
+ }
+#endif
+
return NS_OK;
}
diff --git a/embed/mozilla/MozDownload.cpp b/embed/mozilla/MozDownload.cpp
index d24bcb25c..943da0ff8 100644
--- a/embed/mozilla/MozDownload.cpp
+++ b/embed/mozilla/MozDownload.cpp
@@ -351,26 +351,22 @@ MozDownload::OnStateChange (nsIWebProgress *aWebProgress, nsIRequest *aRequest,
{
NS_ENSURE_TRUE (mMIMEInfo, NS_ERROR_FAILURE);
#ifdef HAVE_GECKO_1_9
- nsHandlerInfoAction action;
- mMIMEInfo->GetPreferredAction(&action);
-
- nsCOMPtr<nsIInterfaceRequestor> req (do_QueryInterface (mRequest));
-
- if (action == EPHY_ACTION_BROWSE_TO_FILE) {
- nsCString destSpec;
- rv = mDestination->GetSpec (destSpec);
- NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
-
- GFile *dest;
- dest = g_file_new_for_uri (destSpec.get ());
- ephy_file_browse_to (dest, 0 /* FIXME BUG BUG BUG */);
- g_object_unref (dest);
- } else {
- rv = mMIMEInfo->LaunchWithURI (mDestination, req);
- NS_ENSURE_SUCCESS(rv, rv);
- }
-
- return NS_OK;
+ nsHandlerInfoAction action;
+ mMIMEInfo->GetPreferredAction(&action);
+
+ if (action == EPHY_ACTION_BROWSE_TO_FILE) {
+ nsCString destSpec;
+ rv = mDestination->GetSpec (destSpec);
+ NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
+
+ GFile *dest;
+ dest = g_file_new_for_uri (destSpec.get ());
+ ephy_file_browse_to (dest, 0 /* FIXME BUG BUG BUG */);
+ g_object_unref (dest);
+ }
+ /* All other values are handled by gecko itself */
+
+ return NS_OK;
#else
GDesktopAppInfo *helperApp;