diff options
Diffstat (limited to 'embed')
-rw-r--r-- | embed/ephy-embed-persist.h | 2 | ||||
-rw-r--r-- | embed/ephy-embed.c | 9 | ||||
-rw-r--r-- | embed/ephy-embed.h | 13 | ||||
-rw-r--r-- | embed/ephy-favicon-cache.c | 3 | ||||
-rw-r--r-- | embed/mozilla/EphyBrowser.cpp | 17 | ||||
-rw-r--r-- | embed/mozilla/EphyBrowser.h | 2 | ||||
-rw-r--r-- | embed/mozilla/EphyHeaderSniffer.cpp | 5 | ||||
-rw-r--r-- | embed/mozilla/EphyHeaderSniffer.h | 3 | ||||
-rw-r--r-- | embed/mozilla/MozDownload.cpp | 18 | ||||
-rw-r--r-- | embed/mozilla/MozDownload.h | 2 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed-persist.cpp | 18 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed.cpp | 25 |
12 files changed, 28 insertions, 89 deletions
diff --git a/embed/ephy-embed-persist.h b/embed/ephy-embed-persist.h index 2f2db4f1b..ca53ff7a2 100644 --- a/embed/ephy-embed-persist.h +++ b/embed/ephy-embed-persist.h @@ -44,7 +44,7 @@ typedef struct EphyEmbedPersistPrivate EphyEmbedPersistPrivate; typedef enum { - EMBED_PERSIST_BYPASSCACHE = 1 << 0, + EMBED_PERSIST_COPY_PAGE = 1 << 0, EMBED_PERSIST_MAINDOC = 1 << 1, EMBED_PERSIST_NO_VIEW = 1 << 2, EMBED_PERSIST_ASK_DESTINATION = 1 << 3 diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index 41cbb551f..3158a1d00 100644 --- a/embed/ephy-embed.c +++ b/embed/ephy-embed.c @@ -415,15 +415,6 @@ ephy_embed_reload (EphyEmbed *embed, } gresult -ephy_embed_copy_page (EphyEmbed *dest, - EphyEmbed *source, - EmbedDisplayType display_type) -{ - EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (dest); - return klass->copy_page (dest, source, display_type); -} - -gresult ephy_embed_zoom_set (EphyEmbed *embed, float zoom, gboolean reflow) diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h index b0c9c77ed..b25f02dea 100644 --- a/embed/ephy-embed.h +++ b/embed/ephy-embed.h @@ -86,12 +86,6 @@ typedef enum EMBED_RELOAD_BYPASSPROXY = 1 << 3 } EmbedReloadFlags; -typedef enum -{ - DISPLAY_AS_SOURCE = 1U, - DISPLAY_NORMAL = 2U -} EmbedDisplayType; - typedef struct { gboolean print_to_file; @@ -223,9 +217,6 @@ struct EphyEmbedClass char **location); gresult (* reload) (EphyEmbed *embed, EmbedReloadFlags flags); - gresult (* copy_page) (EphyEmbed *dest, - EphyEmbed *source, - EmbedDisplayType display_type); gresult (* zoom_set) (EphyEmbed *embed, float zoom, gboolean reflow); @@ -321,10 +312,6 @@ gresult ephy_embed_get_location (EphyEmbed *embed, gresult ephy_embed_reload (EphyEmbed *embed, EmbedReloadFlags flags); -gresult ephy_embed_copy_page (EphyEmbed *dest, - EphyEmbed *source, - EmbedDisplayType display_type); - /* Zoom */ gresult ephy_embed_zoom_set (EphyEmbed *embed, float zoom, diff --git a/embed/ephy-favicon-cache.c b/embed/ephy-favicon-cache.c index f0c3a0022..0ba259132 100644 --- a/embed/ephy-favicon-cache.c +++ b/embed/ephy-favicon-cache.c @@ -384,8 +384,7 @@ ephy_favicon_cache_download (EphyFaviconCache *cache, persist = ephy_embed_persist_new (NULL); ephy_embed_persist_set_dest (persist, dest); - ephy_embed_persist_set_flags - (persist, EMBED_PERSIST_BYPASSCACHE | EMBED_PERSIST_NO_VIEW); + ephy_embed_persist_set_flags (persist, EMBED_PERSIST_NO_VIEW); ephy_embed_persist_set_max_size (persist, 100); ephy_embed_persist_set_source (persist, favicon_url); diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp index 102607e4e..9dbafbbd7 100644 --- a/embed/mozilla/EphyBrowser.cpp +++ b/embed/mozilla/EphyBrowser.cpp @@ -490,23 +490,6 @@ nsresult EphyBrowser::Find (PRBool backwards, return finder->FindNext(didFind); } -nsresult EphyBrowser::LoadDocument(nsISupports *aPageDescriptor, - PRUint32 aDisplayType) -{ - nsresult rv; - - g_return_val_if_fail (mWebBrowser, NS_ERROR_FAILURE); - - nsCOMPtr<nsIDocShell> ds; - ds = do_GetInterface (mWebBrowser); - if (!ds) return NS_ERROR_FAILURE; - - nsCOMPtr<nsIWebPageDescriptor> wpd = do_QueryInterface(ds, &rv); - if (!wpd || !NS_SUCCEEDED(rv)) return NS_ERROR_FAILURE; - - return wpd->LoadPage(aPageDescriptor, aDisplayType); -} - nsresult EphyBrowser::GetPageDescriptor(nsISupports **aPageDescriptor) { nsresult rv; diff --git a/embed/mozilla/EphyBrowser.h b/embed/mozilla/EphyBrowser.h index 9d02d87b0..4d4a11da6 100644 --- a/embed/mozilla/EphyBrowser.h +++ b/embed/mozilla/EphyBrowser.h @@ -32,6 +32,7 @@ #include "nsCOMPtr.h" #include "nsIDOMEventReceiver.h" #include "nsIDOMDocument.h" +#include "nsIDOMWindow.h" #include "nsPIDOMWindow.h" #include <gtkmozembed.h> @@ -65,7 +66,6 @@ public: nsresult Find (PRBool bacwards, PRBool *didFind); - nsresult LoadDocument(nsISupports *aPageDescriptor, PRUint32 aDisplayType); nsresult GetPageDescriptor(nsISupports **aPageDescriptor); nsresult GetSHInfo (PRInt32 *count, PRInt32 *index); diff --git a/embed/mozilla/EphyHeaderSniffer.cpp b/embed/mozilla/EphyHeaderSniffer.cpp index 957f9cf19..fb185a0c7 100644 --- a/embed/mozilla/EphyHeaderSniffer.cpp +++ b/embed/mozilla/EphyHeaderSniffer.cpp @@ -69,8 +69,7 @@ #include <bonobo/bonobo-i18n.h> EphyHeaderSniffer::EphyHeaderSniffer (nsIWebBrowserPersist* aPersist, MozillaEmbedPersist *aEmbedPersist, - nsIFile* aFile, nsIURI* aURL, nsIDOMDocument* aDocument, nsIInputStream* aPostData, - PRBool aBypassCache) + nsIFile* aFile, nsIURI* aURL, nsIDOMDocument* aDocument, nsIInputStream* aPostData) : mPersist(aPersist) , mEmbedPersist(aEmbedPersist) , mTmpFile(aFile) @@ -319,7 +318,7 @@ nsresult EphyHeaderSniffer::InitiateDownload (nsILocalFile *aDestFile) LOG ("Initiating download") return InitiateMozillaDownload (mDocument, mURL, aDestFile, mContentType.get(), mOriginalURI, mEmbedPersist, - mBypassCache, mPostData); + mPostData, nsnull); } NS_IMETHODIMP EphyHeaderSniffer::Prompt (const PRUnichar *dialogTitle, const PRUnichar *text, diff --git a/embed/mozilla/EphyHeaderSniffer.h b/embed/mozilla/EphyHeaderSniffer.h index c3790cec3..8d5d6f0d3 100644 --- a/embed/mozilla/EphyHeaderSniffer.h +++ b/embed/mozilla/EphyHeaderSniffer.h @@ -54,7 +54,7 @@ class EphyHeaderSniffer : public nsIWebProgressListener, public: EphyHeaderSniffer (nsIWebBrowserPersist* aPersist, MozillaEmbedPersist *aEmbedPersist, nsIFile* aFile, nsIURI* aURL, - nsIDOMDocument* aDocument, nsIInputStream* aPostData, PRBool aBypassCache); + nsIDOMDocument* aDocument, nsIInputStream* aPostData); virtual ~EphyHeaderSniffer (); NS_DECL_ISUPPORTS @@ -74,7 +74,6 @@ private: nsCOMPtr<nsIURI> mOriginalURI; nsCOMPtr<nsIDOMDocument> mDocument; nsCOMPtr<nsIInputStream> mPostData; - PRBool mBypassCache; nsCString mContentType; nsCString mContentDisposition; nsCOMPtr<nsIPromptService> mPrompt; diff --git a/embed/mozilla/MozDownload.cpp b/embed/mozilla/MozDownload.cpp index 63901ee35..875d11e3b 100644 --- a/embed/mozilla/MozDownload.cpp +++ b/embed/mozilla/MozDownload.cpp @@ -385,10 +385,13 @@ MozDownload::Resume() nsresult InitiateMozillaDownload (nsIDOMDocument *domDocument, nsIURI *sourceURI, nsILocalFile* inDestFile, const char *contentType, nsIURI* inOriginalURI, MozillaEmbedPersist *embedPersist, - PRBool bypassCache, nsIInputStream *postData) + nsIInputStream *postData, nsISupports *aCacheKey) { nsresult rv = NS_OK; + EmbedPersistFlags ephy_flags; + ephy_flags = ephy_embed_persist_get_flags (EPHY_EMBED_PERSIST (embedPersist)); + PRBool isHTML = (domDocument && contentType && (strcmp (contentType, "text/html") == 0 || strcmp (contentType, "text/xml") == 0 || @@ -410,20 +413,15 @@ nsresult InitiateMozillaDownload (nsIDOMDocument *domDocument, nsIURI *sourceURI PRInt32 flags = nsIWebBrowserPersist::PERSIST_FLAGS_NO_CONVERSION | nsIWebBrowserPersist::PERSIST_FLAGS_REPLACE_EXISTING_FILES; - if (bypassCache) - { - flags |= nsIWebBrowserPersist::PERSIST_FLAGS_BYPASS_CACHE; - } - else + if (ephy_flags & EMBED_PERSIST_COPY_PAGE) { flags |= nsIWebBrowserPersist::PERSIST_FLAGS_FROM_CACHE; } - webPersist->SetPersistFlags(flags); - - if (!isHTML) + + if (!isHTML || ephy_flags & EMBED_PERSIST_COPY_PAGE) { - rv = webPersist->SaveURI (sourceURI, nsnull, nsnull, + rv = webPersist->SaveURI (sourceURI, aCacheKey, nsnull, postData, nsnull, inDestFile); } else diff --git a/embed/mozilla/MozDownload.h b/embed/mozilla/MozDownload.h index 49f0e6cc9..89d20b8c3 100644 --- a/embed/mozilla/MozDownload.h +++ b/embed/mozilla/MozDownload.h @@ -79,7 +79,7 @@ nsresult InitiateMozillaDownload (nsIDOMDocument *domDocument, nsIURI *sourceUri, nsILocalFile* inDestFile, const char *contentType, nsIURI* inOriginalURI, MozillaEmbedPersist *embedPersist, - PRBool bypassCache, nsIInputStream *postData); + nsIInputStream *postData, nsISupports *aCacheKey); class MozDownload : public nsIDownload, public nsIWebProgressListener diff --git a/embed/mozilla/mozilla-embed-persist.cpp b/embed/mozilla/mozilla-embed-persist.cpp index f08d8648e..052aacb76 100644 --- a/embed/mozilla/mozilla-embed-persist.cpp +++ b/embed/mozilla/mozilla-embed-persist.cpp @@ -169,7 +169,9 @@ impl_save (EphyEmbedPersist *persist) "embed", &embed, "max_size", &max_size, NULL); - + + g_return_val_if_fail (!(flags & EMBED_PERSIST_COPY_PAGE) + || embed != NULL, G_FAILED); g_return_val_if_fail (filename != NULL, G_FAILED); EphyBrowser *browser = NULL; @@ -244,6 +246,14 @@ impl_save (EphyEmbedPersist *persist) if (NS_FAILED(rv) || !DOMDocument) return G_FAILED; } + + /* Get the current page descriptor */ + nsCOMPtr<nsISupports> pageDescriptor; + if (flags & EMBED_PERSIST_COPY_PAGE) + { + rv = browser->GetPageDescriptor(getter_AddRefs(pageDescriptor)); + } + if (filename == NULL) { /* Create an header sniffer and do the save */ @@ -253,8 +263,7 @@ impl_save (EphyEmbedPersist *persist) EphyHeaderSniffer* sniffer = new EphyHeaderSniffer (webPersist, MOZILLA_EMBED_PERSIST (persist), - tmpFile, inURI, DOMDocument, postData, - flags & EMBED_PERSIST_BYPASSCACHE); + tmpFile, inURI, DOMDocument, postData); if (!sniffer) return G_FAILED; webPersist->SetProgressListener(sniffer); @@ -271,8 +280,7 @@ impl_save (EphyEmbedPersist *persist) rv = InitiateMozillaDownload (DOMDocument, inURI, destFile, nsnull, inURI, MOZILLA_EMBED_PERSIST (persist), - flags & EMBED_PERSIST_BYPASSCACHE, - postData); + postData, pageDescriptor); if (NS_FAILED (rv)) return G_FAILED; } diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp index e240304d2..dbc04ad39 100644 --- a/embed/mozilla/mozilla-embed.cpp +++ b/embed/mozilla/mozilla-embed.cpp @@ -99,10 +99,6 @@ static gresult impl_reload (EphyEmbed *embed, EmbedReloadFlags flags); static gresult -impl_copy_page (EphyEmbed *dest, - EphyEmbed *source, - EmbedDisplayType display_type); -static gresult impl_zoom_set (EphyEmbed *embed, float zoom, gboolean reflow); @@ -377,7 +373,6 @@ ephy_embed_init (EphyEmbedClass *embed_class) embed_class->get_title = impl_get_title; embed_class->get_location = impl_get_location; embed_class->reload = impl_reload; - embed_class->copy_page = impl_copy_page; embed_class->zoom_set = impl_zoom_set; embed_class->zoom_get = impl_zoom_get; embed_class->shistory_count = impl_shistory_count; @@ -802,26 +797,6 @@ impl_reload (EphyEmbed *embed, } static gresult -impl_copy_page (EphyEmbed *dest, - EphyEmbed *source, - EmbedDisplayType display_type) -{ - MozillaEmbedPrivate *mpriv_dest = MOZILLA_EMBED(dest)->priv; - MozillaEmbedPrivate *mpriv_source = MOZILLA_EMBED(source)->priv; - - nsresult rv; - - nsCOMPtr<nsISupports> pageDescriptor; - rv = mpriv_source->browser->GetPageDescriptor(getter_AddRefs(pageDescriptor)); - if (!pageDescriptor || NS_FAILED(rv)) return G_FAILED; - - rv = mpriv_dest->browser->LoadDocument(pageDescriptor, static_cast<PRUint32>(display_type)); - if (NS_FAILED(rv)) return G_FAILED; - - return G_OK; -} - -static gresult impl_zoom_set (EphyEmbed *embed, float zoom, gboolean reflow) |