diff options
author | Marco Pesenti Gritti <marco@gnome.org> | 2003-10-28 19:33:19 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2003-10-28 19:33:19 +0800 |
commit | 025c7959e438aad9770f9aa801b6ead6e19e79dd (patch) | |
tree | 7a3595c5b012722d6e6dcea81b97773c15c9450c /embed/mozilla | |
parent | 4ff6bbed9a23f05f1ee9158d2607c2e811c5de6f (diff) | |
download | gsoc2013-epiphany-025c7959e438aad9770f9aa801b6ead6e19e79dd.tar gsoc2013-epiphany-025c7959e438aad9770f9aa801b6ead6e19e79dd.tar.gz gsoc2013-epiphany-025c7959e438aad9770f9aa801b6ead6e19e79dd.tar.bz2 gsoc2013-epiphany-025c7959e438aad9770f9aa801b6ead6e19e79dd.tar.lz gsoc2013-epiphany-025c7959e438aad9770f9aa801b6ead6e19e79dd.tar.xz gsoc2013-epiphany-025c7959e438aad9770f9aa801b6ead6e19e79dd.tar.zst gsoc2013-epiphany-025c7959e438aad9770f9aa801b6ead6e19e79dd.zip |
Open source in the default editor and remove the unused copy api. Add a
2003-10-28 Marco Pesenti Gritti <marco@gnome.org>
* embed/ephy-embed-persist.h:
* embed/ephy-embed.c:
* embed/ephy-embed.h:
* embed/ephy-favicon-cache.c: (ephy_favicon_cache_download):
* embed/mozilla/EphyBrowser.cpp:
* embed/mozilla/EphyBrowser.h:
* embed/mozilla/EphyHeaderSniffer.cpp:
* embed/mozilla/EphyHeaderSniffer.h:
* embed/mozilla/MozDownload.cpp:
* embed/mozilla/MozDownload.h:
* embed/mozilla/mozilla-embed-persist.cpp:
* embed/mozilla/mozilla-embed.cpp:
* src/ephy-shell.c: (delete_files), (ephy_shell_finalize),
(ephy_shell_new_tab), (ephy_shell_delete_on_exit):
* src/ephy-shell.h:
* src/window-commands.c: (get_editor_application),
(editor_open_uri), (save_source_completed_cb),
(editor_can_open_uri), (save_temp_source),
(window_cmd_view_page_source):
Open source in the default editor and
remove the unused copy api.
Add a missing include while at it.
Diffstat (limited to 'embed/mozilla')
-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 |
8 files changed, 26 insertions, 64 deletions
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) |