aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog22
-rw-r--r--embed/mozilla/EphyBrowser.cpp (renamed from embed/mozilla/EphyWrapper.cpp)110
-rw-r--r--embed/mozilla/EphyBrowser.h (renamed from embed/mozilla/EphyWrapper.h)6
-rw-r--r--embed/mozilla/EventContext.cpp6
-rw-r--r--embed/mozilla/EventContext.h6
-rw-r--r--embed/mozilla/Makefile.am4
-rw-r--r--embed/mozilla/mozilla-embed-persist.cpp22
-rw-r--r--embed/mozilla/mozilla-embed.cpp100
-rw-r--r--embed/mozilla/mozilla-embed.h4
9 files changed, 166 insertions, 114 deletions
diff --git a/ChangeLog b/ChangeLog
index 1d5fd5a27..2d6fab314 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,27 @@
2003-10-27 Marco Pesenti Gritti <marco@gnome.org>
+ * embed/mozilla/EphyBrowser.cpp:
+ * embed/mozilla/EphyBrowser.h:
+ * embed/mozilla/EphyWrapper.cpp:
+ * embed/mozilla/EphyWrapper.h:
+ * embed/mozilla/EventContext.cpp:
+ * embed/mozilla/EventContext.h:
+ * embed/mozilla/Makefile.am:
+ * embed/mozilla/mozilla-embed-persist.cpp:
+ * embed/mozilla/mozilla-embed.cpp:
+ * embed/mozilla/mozilla-embed.h:
+
+ Solving the wrapper mess Episode 3.
+ Rename to EphyBrowser and add sanity checks.
+ GtkMozEmbed initialize the browser on realize, that
+ means until that we shouldnt use most of the EphyBrowser
+ methods. I'm quite sure there are not such cases in
+ current implementation, otherwise we would have had
+ problems also before. Though better avoid problems
+ in the future.
+
+2003-10-27 Marco Pesenti Gritti <marco@gnome.org>
+
* embed/mozilla/EphyWrapper.cpp:
* embed/mozilla/EphyWrapper.h:
* embed/mozilla/mozilla-embed.cpp:
diff --git a/embed/mozilla/EphyWrapper.cpp b/embed/mozilla/EphyBrowser.cpp
index 793a27197..f23f7163a 100644
--- a/embed/mozilla/EphyWrapper.cpp
+++ b/embed/mozilla/EphyBrowser.cpp
@@ -22,7 +22,7 @@
#include "config.h"
#endif
-#include "EphyWrapper.h"
+#include "EphyBrowser.h"
#include "GlobalHistory.h"
#include "ephy-embed.h"
#include "ephy-string.h"
@@ -78,17 +78,17 @@
#include "ContentHandler.h"
#include "EphyEventListener.h"
-EphyWrapper::EphyWrapper ()
+EphyBrowser::EphyBrowser ()
{
mEventListener = nsnull;
mEventReceiver = nsnull;
}
-EphyWrapper::~EphyWrapper ()
+EphyBrowser::~EphyBrowser ()
{
}
-nsresult EphyWrapper::Init (GtkMozEmbed *mozembed)
+nsresult EphyBrowser::Init (GtkMozEmbed *mozembed)
{
mGtkMozEmbed = mozembed;
@@ -99,7 +99,7 @@ nsresult EphyWrapper::Init (GtkMozEmbed *mozembed)
return mWebBrowser->GetContentDOMWindow (getter_AddRefs (mDOMWindow));
}
-nsresult EphyWrapper::InitDocument ()
+nsresult EphyBrowser::InitDocument ()
{
nsresult rv;
@@ -115,7 +115,7 @@ nsresult EphyWrapper::InitDocument ()
}
nsresult
-EphyWrapper::GetListener (void)
+EphyBrowser::GetListener (void)
{
if (mEventReceiver) return NS_ERROR_FAILURE;
@@ -138,7 +138,7 @@ EphyWrapper::GetListener (void)
}
nsresult
-EphyWrapper::AttachListeners(void)
+EphyBrowser::AttachListeners(void)
{
if (!mEventReceiver) return NS_ERROR_FAILURE;
@@ -150,7 +150,7 @@ EphyWrapper::AttachListeners(void)
}
nsresult
-EphyWrapper::DetachListeners(void)
+EphyBrowser::DetachListeners(void)
{
if (!mEventReceiver) return NS_ERROR_FAILURE;
@@ -161,17 +161,15 @@ EphyWrapper::DetachListeners(void)
mEventListener, PR_FALSE);
}
-nsresult EphyWrapper::Print (nsIPrintSettings *options, PRBool preview)
+nsresult EphyBrowser::Print (nsIPrintSettings *options, PRBool preview)
{
nsresult result;
+ g_return_val_if_fail (mWebBrowser, NS_ERROR_FAILURE);
+
nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(mWebBrowser, &result));
if (NS_FAILED(result) || !print) return NS_ERROR_FAILURE;
- nsCOMPtr<nsIDOMWindow> DOMWindow;
- result = mWebBrowser->GetContentDOMWindow (getter_AddRefs(DOMWindow));
- if (NS_FAILED(result) || !DOMWindow) return NS_ERROR_FAILURE;
-
if (!preview)
{
result = print->Print (options, nsnull);
@@ -184,11 +182,13 @@ nsresult EphyWrapper::Print (nsIPrintSettings *options, PRBool preview)
return result;
}
-nsresult EphyWrapper::PrintPreviewClose (void)
+nsresult EphyBrowser::PrintPreviewClose (void)
{
nsresult rv;
PRBool isPreview = PR_FALSE;
+ g_return_val_if_fail (mWebBrowser, NS_ERROR_FAILURE);
+
nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(mWebBrowser, &rv));
if (NS_FAILED(rv) || !print) return NS_ERROR_FAILURE;
@@ -201,10 +201,12 @@ nsresult EphyWrapper::PrintPreviewClose (void)
return rv;
}
-nsresult EphyWrapper::PrintPreviewNumPages (int *numPages)
+nsresult EphyBrowser::PrintPreviewNumPages (int *numPages)
{
nsresult rv;
+ g_return_val_if_fail (mWebBrowser, NS_ERROR_FAILURE);
+
nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(mWebBrowser, &rv));
if (NS_FAILED(rv) || !print) return NS_ERROR_FAILURE;
@@ -212,10 +214,12 @@ nsresult EphyWrapper::PrintPreviewNumPages (int *numPages)
return rv;
}
-nsresult EphyWrapper::PrintPreviewNavigate(PRInt16 navType, PRInt32 pageNum)
+nsresult EphyBrowser::PrintPreviewNavigate(PRInt16 navType, PRInt32 pageNum)
{
nsresult rv;
+ g_return_val_if_fail (mWebBrowser, NS_ERROR_FAILURE);
+
nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(mWebBrowser, &rv));
if (NS_FAILED(rv) || !print) return NS_ERROR_FAILURE;
@@ -223,19 +227,24 @@ nsresult EphyWrapper::PrintPreviewNavigate(PRInt16 navType, PRInt32 pageNum)
return rv;
}
-nsresult EphyWrapper::GetPrintSettings (nsIPrintSettings **options)
+nsresult EphyBrowser::GetPrintSettings (nsIPrintSettings **options)
{
nsresult result;
+
+ g_return_val_if_fail (mWebBrowser, NS_ERROR_FAILURE);
+
nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(mWebBrowser, &result));
if (NS_FAILED(result) || !print) return NS_ERROR_FAILURE;
return print->GetGlobalPrintSettings(options);
}
-nsresult EphyWrapper::GetSHistory (nsISHistory **aSHistory)
+nsresult EphyBrowser::GetSHistory (nsISHistory **aSHistory)
{
nsresult result;
+ g_return_val_if_fail (mWebBrowser, NS_ERROR_FAILURE);
+
nsCOMPtr<nsIWebNavigation> ContentNav = do_QueryInterface (mWebBrowser);
if (!ContentNav) return NS_ERROR_FAILURE;
@@ -249,7 +258,7 @@ nsresult EphyWrapper::GetSHistory (nsISHistory **aSHistory)
return NS_OK;
}
-nsresult EphyWrapper::Destroy ()
+nsresult EphyBrowser::Destroy ()
{
DetachListeners ();
@@ -258,20 +267,24 @@ nsresult EphyWrapper::Destroy ()
return NS_OK;
}
-nsresult EphyWrapper::GoToHistoryIndex (PRInt16 index)
+nsresult EphyBrowser::GoToHistoryIndex (PRInt16 index)
{
nsresult result;
+ g_return_val_if_fail (mWebBrowser, NS_ERROR_FAILURE);
+
nsCOMPtr<nsIWebNavigation> ContentNav = do_QueryInterface (mWebBrowser);
if (!ContentNav) return NS_ERROR_FAILURE;
return ContentNav->GotoIndex (index);
}
-nsresult EphyWrapper::SetZoom (float aZoom, PRBool reflow)
+nsresult EphyBrowser::SetZoom (float aZoom, PRBool reflow)
{
nsresult result;
+ g_return_val_if_fail (mWebBrowser, NS_ERROR_FAILURE);
+
if (reflow)
{
nsCOMPtr<nsIContentViewer> contentViewer;
@@ -314,7 +327,7 @@ nsresult EphyWrapper::SetZoom (float aZoom, PRBool reflow)
return NS_OK;
}
-nsresult EphyWrapper::SetZoomOnDocshell (float aZoom, nsIDocShell *DocShell)
+nsresult EphyBrowser::SetZoomOnDocshell (float aZoom, nsIDocShell *DocShell)
{
nsresult result;
@@ -329,14 +342,16 @@ nsresult EphyWrapper::SetZoomOnDocshell (float aZoom, nsIDocShell *DocShell)
return DeviceContext->SetTextZoom (aZoom);
}
-nsresult EphyWrapper::GetContentViewer (nsIContentViewer **aViewer)
+nsresult EphyBrowser::GetContentViewer (nsIContentViewer **aViewer)
{
+ g_return_val_if_fail (mWebBrowser, NS_ERROR_FAILURE);
+
nsCOMPtr<nsIDocShell> ourDocShell(do_GetInterface(mWebBrowser));
NS_ENSURE_TRUE(ourDocShell, NS_ERROR_FAILURE);
return ourDocShell->GetContentViewer(aViewer);
}
-nsresult EphyWrapper::GetZoom (float *aZoom)
+nsresult EphyBrowser::GetZoom (float *aZoom)
{
nsresult result;
@@ -351,15 +366,17 @@ nsresult EphyWrapper::GetZoom (float *aZoom)
return mdv->GetTextZoom (aZoom);
}
-nsresult EphyWrapper::GetDocument (nsIDOMDocument **aDOMDocument)
+nsresult EphyBrowser::GetDocument (nsIDOMDocument **aDOMDocument)
{
return mDOMWindow->GetDocument (aDOMDocument);
}
-nsresult EphyWrapper::GetTargetDocument (nsIDOMDocument **aDOMDocument)
+nsresult EphyBrowser::GetTargetDocument (nsIDOMDocument **aDOMDocument)
{
nsresult result;
+ g_return_val_if_fail (mWebBrowser, NS_ERROR_FAILURE);
+
/* Use the current target document */
if (mTargetDocument)
{
@@ -386,7 +403,7 @@ nsresult EphyWrapper::GetTargetDocument (nsIDOMDocument **aDOMDocument)
return mDOMWindow->GetDocument (aDOMDocument);
}
-nsresult EphyWrapper::GetSHInfo (PRInt32 *count, PRInt32 *index)
+nsresult EphyBrowser::GetSHInfo (PRInt32 *count, PRInt32 *index)
{
nsresult result;
@@ -400,7 +417,7 @@ nsresult EphyWrapper::GetSHInfo (PRInt32 *count, PRInt32 *index)
return NS_OK;
}
-nsresult EphyWrapper::GetSHTitleAtIndex (PRInt32 index, PRUnichar **title)
+nsresult EphyBrowser::GetSHTitleAtIndex (PRInt32 index, PRUnichar **title)
{
nsresult result;
@@ -419,7 +436,7 @@ nsresult EphyWrapper::GetSHTitleAtIndex (PRInt32 index, PRUnichar **title)
return NS_OK;
}
-nsresult EphyWrapper::GetSHUrlAtIndex (PRInt32 index, nsCString &url)
+nsresult EphyBrowser::GetSHUrlAtIndex (PRInt32 index, nsCString &url)
{
nsresult result;
@@ -442,10 +459,12 @@ nsresult EphyWrapper::GetSHUrlAtIndex (PRInt32 index, nsCString &url)
return NS_OK;
}
-nsresult EphyWrapper::FindSetProperties (const PRUnichar *search_string,
+nsresult EphyBrowser::FindSetProperties (const PRUnichar *search_string,
PRBool case_sensitive,
PRBool wrap_around)
{
+ g_return_val_if_fail (mWebBrowser, NS_ERROR_FAILURE);
+
nsCOMPtr<nsIWebBrowserFind> finder (do_GetInterface(mWebBrowser));
finder->SetSearchString (search_string);
@@ -455,9 +474,11 @@ nsresult EphyWrapper::FindSetProperties (const PRUnichar *search_string,
return NS_OK;
}
-nsresult EphyWrapper::Find (PRBool backwards,
+nsresult EphyBrowser::Find (PRBool backwards,
PRBool *didFind)
{
+ g_return_val_if_fail (mWebBrowser, NS_ERROR_FAILURE);
+
nsCOMPtr<nsIWebBrowserFind> finder (do_GetInterface(mWebBrowser));
finder->SetFindBackwards (backwards);
@@ -465,11 +486,13 @@ nsresult EphyWrapper::Find (PRBool backwards,
return finder->FindNext(didFind);
}
-nsresult EphyWrapper::LoadDocument(nsISupports *aPageDescriptor,
+nsresult EphyBrowser::LoadDocument(nsISupports *aPageDescriptor,
PRUint32 aDisplayType)
{
nsresult rv;
+ g_return_val_if_fail (mWebBrowser, NS_ERROR_FAILURE);
+
nsCOMPtr<nsIWebNavigation> wn;
wn = do_QueryInterface (mWebBrowser);
if (!wn) return NS_ERROR_FAILURE;
@@ -480,10 +503,12 @@ nsresult EphyWrapper::LoadDocument(nsISupports *aPageDescriptor,
return wpd->LoadPage(aPageDescriptor, aDisplayType);
}
-nsresult EphyWrapper::GetPageDescriptor(nsISupports **aPageDescriptor)
+nsresult EphyBrowser::GetPageDescriptor(nsISupports **aPageDescriptor)
{
nsresult rv;
+ g_return_val_if_fail (mWebBrowser, NS_ERROR_FAILURE);
+
nsCOMPtr<nsIWebNavigation> wn;
wn = do_QueryInterface (mWebBrowser);
if (!wn) return NS_ERROR_FAILURE;
@@ -494,7 +519,7 @@ nsresult EphyWrapper::GetPageDescriptor(nsISupports **aPageDescriptor)
return wpd->GetCurrentDescriptor(aPageDescriptor);
}
-nsresult EphyWrapper::GetDocumentUrl (nsCString &url)
+nsresult EphyBrowser::GetDocumentUrl (nsCString &url)
{
nsresult result;
@@ -517,7 +542,7 @@ nsresult EphyWrapper::GetDocumentUrl (nsCString &url)
return uri->GetSpec (url);
}
-nsresult EphyWrapper::GetTargetDocumentUrl (nsCString &url)
+nsresult EphyBrowser::GetTargetDocumentUrl (nsCString &url)
{
nsresult result;
@@ -542,10 +567,12 @@ nsresult EphyWrapper::GetTargetDocumentUrl (nsCString &url)
return NS_OK;
}
-nsresult EphyWrapper::ForceEncoding (const char *encoding)
+nsresult EphyBrowser::ForceEncoding (const char *encoding)
{
nsresult result;
+ g_return_val_if_fail (mWebBrowser, NS_ERROR_FAILURE);
+
nsCOMPtr<nsIDocShell> docShell;
docShell = do_GetInterface (mWebBrowser);
if (!docShell) return NS_ERROR_FAILURE;
@@ -558,21 +585,21 @@ nsresult EphyWrapper::ForceEncoding (const char *encoding)
return result;
}
-nsresult EphyWrapper::PushTargetDocument (nsIDOMDocument *domDoc)
+nsresult EphyBrowser::PushTargetDocument (nsIDOMDocument *domDoc)
{
mTargetDocument = domDoc;
return NS_OK;
}
-nsresult EphyWrapper::PopTargetDocument ()
+nsresult EphyBrowser::PopTargetDocument ()
{
mTargetDocument = nsnull;
return NS_OK;
}
-nsresult EphyWrapper::GetEncodingInfo (EphyEncodingInfo **infoptr)
+nsresult EphyBrowser::GetEncodingInfo (EphyEncodingInfo **infoptr)
{
nsresult result;
EphyEncodingInfo *info;
@@ -699,9 +726,12 @@ nsresult EphyWrapper::GetEncodingInfo (EphyEncodingInfo **infoptr)
return NS_OK;
}
-nsresult EphyWrapper::DoCommand (const char *command)
+nsresult EphyBrowser::DoCommand (const char *command)
{
nsCOMPtr<nsICommandManager> cmdManager;
+
+ g_return_val_if_fail (mWebBrowser, NS_ERROR_FAILURE);
+
cmdManager = do_GetInterface (mWebBrowser);
if (!cmdManager) return NS_ERROR_FAILURE;
diff --git a/embed/mozilla/EphyWrapper.h b/embed/mozilla/EphyBrowser.h
index a4df9b32e..b803ccec8 100644
--- a/embed/mozilla/EphyWrapper.h
+++ b/embed/mozilla/EphyBrowser.h
@@ -39,11 +39,11 @@
class EphyEventListener;
-class EphyWrapper
+class EphyBrowser
{
public:
- EphyWrapper();
- ~EphyWrapper();
+ EphyBrowser();
+ ~EphyBrowser();
nsresult Init (GtkMozEmbed *mozembed);
nsresult InitDocument ();
diff --git a/embed/mozilla/EventContext.cpp b/embed/mozilla/EventContext.cpp
index 061448aa8..1ef9de9eb 100644
--- a/embed/mozilla/EventContext.cpp
+++ b/embed/mozilla/EventContext.cpp
@@ -56,9 +56,9 @@ EventContext::~EventContext ()
{
}
-nsresult EventContext::Init (EphyWrapper *wrapper)
+nsresult EventContext::Init (EphyBrowser *browser)
{
- mWrapper = wrapper;
+ mBrowser = browser;
mDOMDocument = nsnull;
return NS_OK;
@@ -771,7 +771,7 @@ nsresult EventContext::IsPageFramed (nsIDOMNode *node, PRBool *Framed)
nsresult result;
nsCOMPtr<nsIDOMDocument> mainDocument;
- result = mWrapper->GetDocument (getter_AddRefs(mainDocument));
+ result = mBrowser->GetDocument (getter_AddRefs(mainDocument));
if (NS_FAILED(result) || !mainDocument) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMDocument> nodeDocument;
diff --git a/embed/mozilla/EventContext.h b/embed/mozilla/EventContext.h
index ca59d16dd..44dc37483 100644
--- a/embed/mozilla/EventContext.h
+++ b/embed/mozilla/EventContext.h
@@ -31,7 +31,7 @@
#include "nsIDOMElementCSSInlineStyle.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsIDOMDocument.h"
-#include "EphyWrapper.h"
+#include "EphyBrowser.h"
#include "ephy-embed.h"
#include "ephy-embed-event.h"
@@ -42,14 +42,14 @@ public:
EventContext();
~EventContext();
- nsresult Init (EphyWrapper *wrapper);
+ nsresult Init (EphyBrowser *wrapper);
nsresult GetMouseEventInfo (nsIDOMMouseEvent *event, EphyEmbedEvent *info);
nsresult GetKeyEventInfo (nsIDOMKeyEvent *event, EphyEmbedEvent *info);
nsresult GetTargetDocument (nsIDOMDocument **domDoc);
private:
- EphyWrapper *mWrapper;
+ EphyBrowser *mBrowser;
nsCOMPtr<nsIDOMDocument> mDOMDocument;
nsresult GatherTextUnder (nsIDOMNode* aNode, nsString& aResult);
diff --git a/embed/mozilla/Makefile.am b/embed/mozilla/Makefile.am
index d73ef4794..485af100f 100644
--- a/embed/mozilla/Makefile.am
+++ b/embed/mozilla/Makefile.am
@@ -60,8 +60,8 @@ libephymozillaembed_la_SOURCES = \
EphyEventListener.h \
EphyHeaderSniffer.cpp \
EphyHeaderSniffer.h \
- EphyWrapper.cpp \
- EphyWrapper.h \
+ EphyBrowser.cpp \
+ EphyBrowser.h \
EventContext.cpp \
EventContext.h \
ExternalProtocolHandlers.cpp \
diff --git a/embed/mozilla/mozilla-embed-persist.cpp b/embed/mozilla/mozilla-embed-persist.cpp
index 3aef38c89..f08d8648e 100644
--- a/embed/mozilla/mozilla-embed-persist.cpp
+++ b/embed/mozilla/mozilla-embed-persist.cpp
@@ -24,7 +24,7 @@
#include "mozilla-embed-persist.h"
#include "mozilla-embed.h"
-#include "EphyWrapper.h"
+#include "EphyBrowser.h"
#include "EphyHeaderSniffer.h"
#include "MozDownload.h"
@@ -172,15 +172,15 @@ impl_save (EphyEmbedPersist *persist)
g_return_val_if_fail (filename != NULL, G_FAILED);
- EphyWrapper *wrapper = NULL;
+ EphyBrowser *browser = NULL;
if (embed)
{
- wrapper = (EphyWrapper *) mozilla_embed_get_ephy_wrapper (MOZILLA_EMBED(embed));
- g_return_val_if_fail (wrapper != NULL, G_FAILED);
+ browser = (EphyBrowser *) mozilla_embed_get_ephy_browser (MOZILLA_EMBED(embed));
+ g_return_val_if_fail (browser != NULL, G_FAILED);
}
- /* we must have one of uri or wrapper */
- g_assert (wrapper != NULL || uri != NULL);
+ /* we must have one of uri or browser */
+ g_assert (browser != NULL || uri != NULL);
/* Get a temp filename to save to */
nsCOMPtr<nsIProperties> dirService(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
@@ -204,7 +204,7 @@ impl_save (EphyEmbedPersist *persist)
}
else
{
- rv = wrapper->GetDocumentUrl (sURI);
+ rv = browser->GetDocumentUrl (sURI);
if (NS_FAILED(rv)) return G_FAILED;
}
rv = NS_NewURI(getter_AddRefs(inURI), sURI);
@@ -212,11 +212,11 @@ impl_save (EphyEmbedPersist *persist)
/* Get post data */
nsCOMPtr<nsIInputStream> postData;
- if (wrapper)
+ if (browser)
{
PRInt32 sindex;
- nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(wrapper->mWebBrowser));
+ nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(browser->mWebBrowser));
nsCOMPtr<nsISHistory> sessionHistory;
webNav->GetSessionHistory(getter_AddRefs(sessionHistory));
nsCOMPtr<nsIHistoryEntry> entry;
@@ -235,11 +235,11 @@ impl_save (EphyEmbedPersist *persist)
{
if (flags & EMBED_PERSIST_MAINDOC)
{
- rv = wrapper->GetDocument (getter_AddRefs(DOMDocument));
+ rv = browser->GetDocument (getter_AddRefs(DOMDocument));
}
else
{
- rv = wrapper->GetTargetDocument (getter_AddRefs(DOMDocument));
+ rv = browser->GetTargetDocument (getter_AddRefs(DOMDocument));
}
if (NS_FAILED(rv) || !DOMDocument) return G_FAILED;
}
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
index 2c7a24e69..5a6b11945 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -24,7 +24,7 @@
#include "ephy-debug.h"
#include "mozilla-embed.h"
#include "MozillaPrivate.h"
-#include "EphyWrapper.h"
+#include "EphyBrowser.h"
#include "EventContext.h"
#include "ephy-debug.h"
@@ -223,10 +223,10 @@ signal_connections[] =
struct MozillaEmbedPrivate
{
- MozillaEmbedPrivate() : wrapper(NULL), security_state(-1), no_page(1)
+ MozillaEmbedPrivate() : browser(NULL), security_state(-1), no_page(1)
{ /* nothing */ }
- EphyWrapper *wrapper;
+ EphyBrowser *browser;
nsCOMPtr<nsIRequest> request;
gint security_state;
@@ -249,7 +249,7 @@ impl_manager_do_command (EphyCommandManager *manager,
nsresult result = NS_OK;
MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(manager)->priv;
- result = mpriv->wrapper->DoCommand (command);
+ result = mpriv->browser->DoCommand (command);
return result ? G_OK : G_FAILED;
}
@@ -334,7 +334,7 @@ impl_find_next (EphyEmbed *embed,
PRBool didFind;
- result = mpriv->wrapper->Find (backwards, &didFind);
+ result = mpriv->browser->Find (backwards, &didFind);
return didFind ? G_OK : G_FAILED;
}
@@ -358,7 +358,7 @@ impl_find_set_properties (EphyEmbed *embed,
nsresult result = NS_OK;
MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv;
- result = mpriv->wrapper->FindSetProperties
+ result = mpriv->browser->FindSetProperties
((NS_ConvertUTF8toUCS2(search_string)).get(),
case_sensitive, wrap_around);
@@ -412,11 +412,11 @@ mozilla_embed_realize (GtkWidget *widget)
(* GTK_WIDGET_CLASS(parent_class)->realize) (widget);
nsresult result;
- result = mpriv->wrapper->Init (GTK_MOZ_EMBED (widget));
+ result = mpriv->browser->Init (GTK_MOZ_EMBED (widget));
if (NS_FAILED(result))
{
- g_warning ("Wrapper initialization failed");
+ g_warning ("Browser initialization failed");
}
}
@@ -442,17 +442,17 @@ mozilla_embed_init (MozillaEmbed *embed)
embed->priv->no_page = 1;
embed->priv->browser_document_initialized = FALSE;
- embed->priv->wrapper = new EphyWrapper ();
+ embed->priv->browser = new EphyBrowser ();
mozilla_embed_connect_signals (embed);
}
gpointer
-mozilla_embed_get_ephy_wrapper (MozillaEmbed *embed)
+mozilla_embed_get_ephy_browser (MozillaEmbed *embed)
{
- g_return_val_if_fail (embed->priv->wrapper != NULL, NULL);
+ g_return_val_if_fail (embed->priv->browser != NULL, NULL);
- return embed->priv->wrapper;
+ return embed->priv->browser;
}
static void
@@ -487,11 +487,11 @@ mozilla_embed_destroy (GtkObject *object)
(void *)object);
}
- if (embed->priv->wrapper)
+ if (embed->priv->browser)
{
- embed->priv->wrapper->Destroy();
- delete embed->priv->wrapper;
- embed->priv->wrapper = NULL;
+ embed->priv->browser->Destroy();
+ delete embed->priv->browser;
+ embed->priv->browser = NULL;
}
GTK_OBJECT_CLASS (parent_class)->destroy (object);
@@ -764,13 +764,13 @@ impl_get_location (EphyEmbed *embed,
if (toplevel)
{
- rv = mpriv->wrapper->GetDocumentUrl (url);
+ rv = mpriv->browser->GetDocumentUrl (url);
l = (NS_SUCCEEDED (rv) && !url.IsEmpty()) ?
g_strdup (url.get()) : NULL;
}
else
{
- rv = mpriv->wrapper->GetTargetDocumentUrl (url);
+ rv = mpriv->browser->GetTargetDocumentUrl (url);
l = (NS_SUCCEEDED (rv) && !url.IsEmpty()) ?
g_strdup (url.get()) : NULL;
}
@@ -821,10 +821,10 @@ impl_copy_page (EphyEmbed *dest,
nsresult rv;
nsCOMPtr<nsISupports> pageDescriptor;
- rv = mpriv_source->wrapper->GetPageDescriptor(getter_AddRefs(pageDescriptor));
+ rv = mpriv_source->browser->GetPageDescriptor(getter_AddRefs(pageDescriptor));
if (!pageDescriptor || NS_FAILED(rv)) return G_FAILED;
- rv = mpriv_dest->wrapper->LoadDocument(pageDescriptor, static_cast<PRUint32>(display_type));
+ rv = mpriv_dest->browser->LoadDocument(pageDescriptor, static_cast<PRUint32>(display_type));
if (NS_FAILED(rv)) return G_FAILED;
return G_OK;
@@ -835,13 +835,13 @@ impl_zoom_set (EphyEmbed *embed,
float zoom,
gboolean reflow)
{
- EphyWrapper *wrapper;
+ EphyBrowser *browser;
nsresult result;
- wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
- g_return_val_if_fail (wrapper != NULL, G_FAILED);
+ browser = MOZILLA_EMBED(embed)->priv->browser;
+ g_return_val_if_fail (browser != NULL, G_FAILED);
- result = wrapper->SetZoom (zoom, reflow);
+ result = browser->SetZoom (zoom, reflow);
if (NS_SUCCEEDED (result))
{
@@ -858,7 +858,7 @@ impl_zoom_get (EphyEmbed *embed,
float f;
MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv;
- nsresult result = mpriv->wrapper->GetZoom (&f);
+ nsresult result = mpriv->browser->GetZoom (&f);
if (NS_SUCCEEDED (result))
{
@@ -880,7 +880,7 @@ impl_shistory_count (EphyEmbed *embed,
MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv;
int c, index;
- rv = mpriv->wrapper->GetSHInfo (&c, &index);
+ rv = mpriv->browser->GetSHInfo (&c, &index);
*count = c;
@@ -914,11 +914,11 @@ impl_shistory_get_nth (EphyEmbed *embed,
}
}
- rv = mpriv->wrapper->GetSHUrlAtIndex(nth, url);
+ rv = mpriv->browser->GetSHUrlAtIndex(nth, url);
*aUrl = (NS_SUCCEEDED (rv) && !url.IsEmpty()) ? g_strdup(url.get()) : NULL;
- rv = mpriv->wrapper->GetSHTitleAtIndex(nth, &title);
+ rv = mpriv->browser->GetSHTitleAtIndex(nth, &title);
*aTitle = g_strdup (NS_ConvertUCS2toUTF8(title).get());
@@ -935,7 +935,7 @@ impl_shistory_get_pos (EphyEmbed *embed,
MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv;
int count, index;
- rv = mpriv->wrapper->GetSHInfo (&count, &index);
+ rv = mpriv->browser->GetSHInfo (&count, &index);
*pos = index;
@@ -949,7 +949,7 @@ impl_shistory_go_nth (EphyEmbed *embed,
nsresult rv;
MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv;
- rv = mpriv->wrapper->GoToHistoryIndex (nth);
+ rv = mpriv->browser->GoToHistoryIndex (nth);
return NS_SUCCEEDED(rv) ? G_OK : G_FAILED;
}
@@ -998,14 +998,14 @@ impl_print (EphyEmbed *embed,
MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv;
nsCOMPtr<nsIPrintSettings> options;
- result = mpriv->wrapper->GetPrintSettings(getter_AddRefs(options));
+ result = mpriv->browser->GetPrintSettings(getter_AddRefs(options));
if (!NS_SUCCEEDED (result)) return G_FAILED;
MozillaCollatePrintSettings(info, options);
options->SetPrintSilent (PR_TRUE);
- result = mpriv->wrapper->Print(options, info->preview);
+ result = mpriv->browser->Print(options, info->preview);
return NS_SUCCEEDED (result) ? G_OK : G_FAILED;
}
@@ -1014,12 +1014,12 @@ static gresult
impl_print_preview_close (EphyEmbed *embed)
{
nsresult result = NS_OK;
- EphyWrapper *wrapper;
+ EphyBrowser *browser;
- wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
- g_return_val_if_fail (wrapper != NULL, G_FAILED);
+ browser = MOZILLA_EMBED(embed)->priv->browser;
+ g_return_val_if_fail (browser != NULL, G_FAILED);
- result = wrapper->PrintPreviewClose();
+ result = browser->PrintPreviewClose();
return NS_SUCCEEDED(result) ? G_OK : G_FAILED;
}
@@ -1030,7 +1030,7 @@ impl_print_preview_num_pages (EphyEmbed *embed,
nsresult result = NS_OK;
MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv;
- result = mpriv->wrapper->PrintPreviewNumPages(retNum);
+ result = mpriv->browser->PrintPreviewNumPages(retNum);
return NS_SUCCEEDED(result) ? G_OK : G_FAILED;
}
@@ -1042,7 +1042,7 @@ impl_print_preview_navigate (EphyEmbed *embed,
nsresult result = NS_OK;
MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv;
- result = mpriv->wrapper->PrintPreviewNavigate(navType, pageNum);
+ result = mpriv->browser->PrintPreviewNavigate(navType, pageNum);
return NS_SUCCEEDED(result) ? G_OK : G_FAILED;
}
@@ -1053,7 +1053,7 @@ impl_set_encoding (EphyEmbed *embed,
nsresult result;
MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv;
- result = mpriv->wrapper->ForceEncoding (encoding);
+ result = mpriv->browser->ForceEncoding (encoding);
if (NS_FAILED (result)) return G_FAILED;
gtk_moz_embed_reload (GTK_MOZ_EMBED (embed),
@@ -1072,7 +1072,7 @@ impl_get_encoding_info (EphyEmbed *embed,
g_return_val_if_fail (info != NULL, G_FAILED);
*info = NULL;
- result = mpriv->wrapper->GetEncodingInfo (info);
+ result = mpriv->browser->GetEncodingInfo (info);
return NS_SUCCEEDED(result) ? G_OK : G_FAILED;
}
@@ -1144,7 +1144,7 @@ mozilla_embed_net_state_all_cb (GtkMozEmbed *embed, const char *aURI,
{
nsresult rv;
- rv = membed->priv->wrapper->InitDocument ();
+ rv = membed->priv->browser->InitDocument ();
if (NS_FAILED (rv))
{
g_warning ("Browser document initialization failed");
@@ -1231,7 +1231,7 @@ mozilla_embed_dom_key_down_cb (GtkMozEmbed *embed, gpointer dom_event,
nsresult rv;
EventContext ctx;
- ctx.Init (mpriv->wrapper);
+ ctx.Init (mpriv->browser);
rv = ctx.GetKeyEventInfo (ev, info);
if (NS_FAILED (rv)) return G_FAILED;
@@ -1256,11 +1256,11 @@ mozilla_embed_dom_key_down_cb (GtkMozEmbed *embed, gpointer dom_event,
rv = ctx.GetTargetDocument (getter_AddRefs(doc));
if (NS_SUCCEEDED(rv))
{
- rv = mpriv->wrapper->PushTargetDocument (doc);
+ rv = mpriv->browser->PushTargetDocument (doc);
if (NS_SUCCEEDED(rv))
{
g_signal_emit_by_name (membed, "ge_context_menu", info, &ret);
- mpriv->wrapper->PopTargetDocument ();
+ mpriv->browser->PopTargetDocument ();
}
}
}
@@ -1294,7 +1294,7 @@ mozilla_embed_dom_mouse_click_cb (GtkMozEmbed *embed, gpointer dom_event,
info = ephy_embed_event_new ();
- event_context.Init (mpriv->wrapper);
+ event_context.Init (mpriv->browser);
result = event_context.GetMouseEventInfo (static_cast<nsIDOMMouseEvent*>(dom_event), info);
if (NS_SUCCEEDED(result))
@@ -1303,12 +1303,12 @@ mozilla_embed_dom_mouse_click_cb (GtkMozEmbed *embed, gpointer dom_event,
result = event_context.GetTargetDocument (getter_AddRefs(domDoc));
if (NS_SUCCEEDED(result))
{
- result = mpriv->wrapper->PushTargetDocument (domDoc);
+ result = mpriv->browser->PushTargetDocument (domDoc);
if (NS_SUCCEEDED(result))
{
g_signal_emit_by_name (membed, "ge_dom_mouse_click",
info, &return_value);
- mpriv->wrapper->PopTargetDocument ();
+ mpriv->browser->PopTargetDocument ();
}
}
@@ -1338,7 +1338,7 @@ mozilla_embed_dom_mouse_down_cb (GtkMozEmbed *embed, gpointer dom_event,
info = ephy_embed_event_new ();
- event_context.Init (mpriv->wrapper);
+ event_context.Init (mpriv->browser);
result = event_context.GetMouseEventInfo (static_cast<nsIDOMMouseEvent*>(dom_event), info);
if (NS_FAILED (result)) return FALSE;
@@ -1348,7 +1348,7 @@ mozilla_embed_dom_mouse_down_cb (GtkMozEmbed *embed, gpointer dom_event,
result = event_context.GetTargetDocument (getter_AddRefs(domDoc));
if (NS_SUCCEEDED(result))
{
- result = mpriv->wrapper->PushTargetDocument (domDoc);
+ result = mpriv->browser->PushTargetDocument (domDoc);
if (NS_SUCCEEDED(result))
{
@@ -1362,7 +1362,7 @@ mozilla_embed_dom_mouse_down_cb (GtkMozEmbed *embed, gpointer dom_event,
info, &return_value);
}
- mpriv->wrapper->PopTargetDocument ();
+ mpriv->browser->PopTargetDocument ();
}
}
diff --git a/embed/mozilla/mozilla-embed.h b/embed/mozilla/mozilla-embed.h
index ca74d4f72..8412bb5b0 100644
--- a/embed/mozilla/mozilla-embed.h
+++ b/embed/mozilla/mozilla-embed.h
@@ -51,9 +51,9 @@ struct MozillaEmbedClass
GtkMozEmbedClass parent_class;
};
-GType mozilla_embed_get_type (void);
+GType mozilla_embed_get_type (void);
-gpointer mozilla_embed_get_ephy_wrapper (MozillaEmbed *embed);
+gpointer mozilla_embed_get_ephy_browser (MozillaEmbed *embed);
G_END_DECLS