aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2003-10-27 23:18:14 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-10-27 23:18:14 +0800
commit0c602edff1de6eaf85746201f94e2b1c4d815da0 (patch)
treef8eec8899ad045851561fb66b1967d930e1db813 /embed
parent21f69a6461a12704c97fad51d7ac709faab90cdc (diff)
downloadgsoc2013-epiphany-0c602edff1de6eaf85746201f94e2b1c4d815da0.tar
gsoc2013-epiphany-0c602edff1de6eaf85746201f94e2b1c4d815da0.tar.gz
gsoc2013-epiphany-0c602edff1de6eaf85746201f94e2b1c4d815da0.tar.bz2
gsoc2013-epiphany-0c602edff1de6eaf85746201f94e2b1c4d815da0.tar.lz
gsoc2013-epiphany-0c602edff1de6eaf85746201f94e2b1c4d815da0.tar.xz
gsoc2013-epiphany-0c602edff1de6eaf85746201f94e2b1c4d815da0.tar.zst
gsoc2013-epiphany-0c602edff1de6eaf85746201f94e2b1c4d815da0.zip
Solving the wrapper mess Episode 1.
2003-10-27 Marco Pesenti Gritti <marco@gnome.org> * embed/ephy-embed.c: * embed/ephy-embed.h: * embed/mozilla/EphyWrapper.cpp: * embed/mozilla/EphyWrapper.h: * embed/mozilla/EventContext.cpp: * embed/mozilla/mozilla-embed-persist.cpp: * embed/mozilla/mozilla-embed.cpp: Solving the wrapper mess Episode 1. Cleanup EphyWrapper to use higher level apis. Do not set docshell history explicitly, it seem to pickup the registered one nicely.
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed.c8
-rw-r--r--embed/ephy-embed.h5
-rw-r--r--embed/mozilla/EphyWrapper.cpp253
-rw-r--r--embed/mozilla/EphyWrapper.h21
-rw-r--r--embed/mozilla/EventContext.cpp2
-rw-r--r--embed/mozilla/mozilla-embed-persist.cpp4
-rw-r--r--embed/mozilla/mozilla-embed.cpp43
7 files changed, 58 insertions, 278 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index c40ec74c4..41cbb551f 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -475,14 +475,6 @@ ephy_embed_shistory_go_nth (EphyEmbed *embed,
return klass->shistory_go_nth (embed, nth);
}
-gboolean
-ephy_embed_shistory_copy (EphyEmbed *source,
- EphyEmbed *dest)
-{
- EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (source);
- return klass->shistory_copy (source, dest);
-}
-
gresult
ephy_embed_get_security_level (EphyEmbed *embed,
EmbedSecurityLevel *level,
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index 66678e404..b0c9c77ed 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -242,8 +242,6 @@ struct EphyEmbedClass
int *pos);
gresult (* shistory_go_nth) (EphyEmbed *embed,
int nth);
- gboolean (* shistory_copy) (EphyEmbed *source,
- EphyEmbed *dest);
gresult (* get_security_level) (EphyEmbed *embed,
EmbedSecurityLevel *level,
char **description);
@@ -351,9 +349,6 @@ gresult ephy_embed_shistory_get_pos (EphyEmbed *embed,
gresult ephy_embed_shistory_go_nth (EphyEmbed *embed,
int nth);
-gboolean ephy_embed_shistory_copy (EphyEmbed *source,
- EphyEmbed *dest);
-
/* Utils */
gresult ephy_embed_get_security_level (EphyEmbed *embed,
diff --git a/embed/mozilla/EphyWrapper.cpp b/embed/mozilla/EphyWrapper.cpp
index bea527fe2..a511d5b98 100644
--- a/embed/mozilla/EphyWrapper.cpp
+++ b/embed/mozilla/EphyWrapper.cpp
@@ -30,6 +30,7 @@
#include <gtkmozembed_internal.h>
#include <unistd.h>
+#include "nsIDocCharset.h"
#include "nsICommandManager.h"
#include "nsIContentViewer.h"
#include "nsIGlobalHistory.h"
@@ -89,28 +90,21 @@ EphyWrapper::~EphyWrapper ()
nsresult EphyWrapper::Init (GtkMozEmbed *mozembed)
{
- nsresult result;
+ nsresult rv;
gtk_moz_embed_get_nsIWebBrowser (mozembed,
getter_AddRefs(mWebBrowser));
if (!mWebBrowser) return NS_ERROR_FAILURE;
- nsCOMPtr<nsIDocShell> DocShell;
- result = GetDocShell (getter_AddRefs(DocShell));
- if (NS_FAILED(result) || !DocShell) return NS_ERROR_FAILURE;
-
- nsCOMPtr<nsIDocShellHistory> dsHistory = do_QueryInterface (DocShell);
- if (!dsHistory) return NS_ERROR_FAILURE;
+ rv = mWebBrowser->GetContentDOMWindow (getter_AddRefs (mDOMWindow));
+ if (NS_FAILED (rv)) return NS_ERROR_FAILURE;
mEventListener = new EphyEventListener();
mEventListener->Init (EPHY_EMBED (mozembed));
GetListener();
AttachListeners();
- nsCOMPtr<nsIGlobalHistory> inst =
- do_GetService(NS_GLOBALHISTORY_CONTRACTID, &result);
-
- return dsHistory->SetGlobalHistory(inst);
+ return NS_OK;
}
nsresult
@@ -160,33 +154,6 @@ EphyWrapper::DetachListeners(void)
mEventListener, PR_FALSE);
}
-nsresult EphyWrapper::GetDocShell (nsIDocShell **aDocShell)
-{
- nsCOMPtr<nsIDocShellTreeItem> browserAsItem;
- browserAsItem = do_QueryInterface(mWebBrowser);
- if (!browserAsItem) return NS_ERROR_FAILURE;
-
- // get the owner for that item
- nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
- browserAsItem->GetTreeOwner(getter_AddRefs(treeOwner));
- if (!treeOwner) return NS_ERROR_FAILURE;
-
- // get the primary content shell as an item
- nsCOMPtr<nsIDocShellTreeItem> contentItem;
- treeOwner->GetPrimaryContentShell(getter_AddRefs(contentItem));
- if (!contentItem) return NS_ERROR_FAILURE;
-
- // QI that back to a docshell
- nsCOMPtr<nsIDocShell> DocShell;
- DocShell = do_QueryInterface(contentItem);
- if (!DocShell) return NS_ERROR_FAILURE;
-
- *aDocShell = DocShell.get();
-
- NS_IF_ADDREF(*aDocShell);
-
- return NS_OK;
-}
nsresult EphyWrapper::Print (nsIPrintSettings *options, PRBool preview)
{
nsresult result;
@@ -262,12 +229,7 @@ nsresult EphyWrapper::GetSHistory (nsISHistory **aSHistory)
{
nsresult result;
- nsCOMPtr<nsIDocShell> DocShell;
- result = GetDocShell (getter_AddRefs(DocShell));
- if (NS_FAILED(result) || !DocShell) return NS_ERROR_FAILURE;
-
- nsCOMPtr<nsIWebNavigation> ContentNav = do_QueryInterface (DocShell,
- &result);
+ nsCOMPtr<nsIWebNavigation> ContentNav = do_QueryInterface (mWebBrowser);
if (!ContentNav) return NS_ERROR_FAILURE;
nsCOMPtr<nsISHistory> SessionHistory;
@@ -285,7 +247,6 @@ nsresult EphyWrapper::Destroy ()
DetachListeners ();
mWebBrowser = nsnull;
- mChromeNav = nsnull;
return NS_OK;
}
@@ -294,12 +255,7 @@ nsresult EphyWrapper::GoToHistoryIndex (PRInt16 index)
{
nsresult result;
- nsCOMPtr<nsIDocShell> DocShell;
- result = GetDocShell (getter_AddRefs(DocShell));
- if (NS_FAILED(result) || !DocShell) return NS_ERROR_FAILURE;
-
- nsCOMPtr<nsIWebNavigation> ContentNav = do_QueryInterface (DocShell,
- &result);
+ nsCOMPtr<nsIWebNavigation> ContentNav = do_QueryInterface (mWebBrowser);
if (!ContentNav) return NS_ERROR_FAILURE;
return ContentNav->GotoIndex (index);
@@ -309,14 +265,10 @@ nsresult EphyWrapper::SetZoom (float aZoom, PRBool reflow)
{
nsresult result;
- nsCOMPtr<nsIDocShell> DocShell;
- result = GetDocShell (getter_AddRefs(DocShell));
- if (NS_FAILED(result) || !DocShell) return NS_ERROR_FAILURE;
-
if (reflow)
{
nsCOMPtr<nsIContentViewer> contentViewer;
- result = DocShell->GetContentViewer (getter_AddRefs(contentViewer));
+ result = GetContentViewer (getter_AddRefs(contentViewer));
if (!NS_SUCCEEDED (result) || !contentViewer) return NS_ERROR_FAILURE;
nsCOMPtr<nsIMarkupDocumentViewer> mdv = do_QueryInterface(contentViewer,
@@ -327,6 +279,10 @@ nsresult EphyWrapper::SetZoom (float aZoom, PRBool reflow)
}
else
{
+ nsCOMPtr<nsIDocShell> DocShell;
+ DocShell = do_GetInterface (mWebBrowser);
+ if (!DocShell) return NS_ERROR_FAILURE;
+
SetZoomOnDocshell (aZoom, DocShell);
nsCOMPtr<nsIDocShellTreeNode> docShellNode(do_QueryInterface(DocShell));
@@ -366,16 +322,19 @@ nsresult EphyWrapper::SetZoomOnDocshell (float aZoom, nsIDocShell *DocShell)
return DeviceContext->SetTextZoom (aZoom);
}
+nsresult EphyWrapper::GetContentViewer (nsIContentViewer **aViewer)
+{
+ nsCOMPtr<nsIDocShell> ourDocShell(do_GetInterface(mWebBrowser));
+ NS_ENSURE_TRUE(ourDocShell, NS_ERROR_FAILURE);
+ return ourDocShell->GetContentViewer(aViewer);
+}
+
nsresult EphyWrapper::GetZoom (float *aZoom)
{
nsresult result;
- nsCOMPtr<nsIDocShell> DocShell;
- result = GetDocShell (getter_AddRefs(DocShell));
- if (NS_FAILED(result) || !DocShell) return NS_ERROR_FAILURE;
-
nsCOMPtr<nsIContentViewer> contentViewer;
- result = DocShell->GetContentViewer (getter_AddRefs(contentViewer));
+ result = GetContentViewer (getter_AddRefs(contentViewer));
if (!NS_SUCCEEDED (result) || !contentViewer) return NS_ERROR_FAILURE;
nsCOMPtr<nsIMarkupDocumentViewer> mdv = do_QueryInterface(contentViewer,
@@ -385,29 +344,12 @@ nsresult EphyWrapper::GetZoom (float *aZoom)
return mdv->GetTextZoom (aZoom);
}
-nsresult EphyWrapper::GetFocusedDOMWindow (nsIDOMWindow **aDOMWindow)
+nsresult EphyWrapper::GetDocument (nsIDOMDocument **aDOMDocument)
{
- nsresult rv;
-
- nsCOMPtr<nsIWebBrowserFocus> focus = do_GetInterface(mWebBrowser, &rv);
- if (NS_FAILED(rv) || !focus) return NS_ERROR_FAILURE;
-
- rv = focus->GetFocusedWindow (aDOMWindow);
- if (NS_FAILED(rv))
- rv = mWebBrowser->GetContentDOMWindow (aDOMWindow);
- return rv;
+ return mDOMWindow->GetDocument (aDOMDocument);
}
-nsresult EphyWrapper::GetDOMWindow (nsIDOMWindow **aDOMWindow)
-{
- nsresult rv;
-
- rv = mWebBrowser->GetContentDOMWindow (aDOMWindow);
-
- return rv;
-}
-
-nsresult EphyWrapper::GetDOMDocument (nsIDOMDocument **aDOMDocument)
+nsresult EphyWrapper::GetTargetDocument (nsIDOMDocument **aDOMDocument)
{
nsresult result;
@@ -422,30 +364,19 @@ nsresult EphyWrapper::GetDOMDocument (nsIDOMDocument **aDOMDocument)
}
/* Use the focused document */
+ nsCOMPtr<nsIWebBrowserFocus> webBrowserFocus;
+ webBrowserFocus = do_QueryInterface (mWebBrowser);
+ if (!webBrowserFocus) return NS_ERROR_FAILURE;
+
nsCOMPtr<nsIDOMWindow> DOMWindow;
- result = GetFocusedDOMWindow (getter_AddRefs(DOMWindow));
+ result = webBrowserFocus->GetFocusedWindow (getter_AddRefs(DOMWindow));
if (NS_SUCCEEDED(result) && DOMWindow)
{
return DOMWindow->GetDocument (aDOMDocument);
}
/* Use the main document */
- return GetMainDOMDocument (aDOMDocument);
-}
-
-nsresult EphyWrapper::GetMainDOMDocument (nsIDOMDocument **aDOMDocument)
-{
- nsresult result;
-
- nsCOMPtr<nsIDocShell> DocShell;
- result = GetDocShell (getter_AddRefs(DocShell));
- if (NS_FAILED(result) || !DocShell) return NS_ERROR_FAILURE;
-
- nsCOMPtr<nsIContentViewer> contentViewer;
- result = DocShell->GetContentViewer (getter_AddRefs(contentViewer));
- if (!NS_SUCCEEDED (result) || !contentViewer) return NS_ERROR_FAILURE;
-
- return contentViewer->GetDOMDocument (aDOMDocument);
+ return mDOMWindow->GetDocument (aDOMDocument);
}
nsresult EphyWrapper::GetSHInfo (PRInt32 *count, PRInt32 *index)
@@ -527,36 +458,14 @@ nsresult EphyWrapper::Find (PRBool backwards,
return finder->FindNext(didFind);
}
-nsresult EphyWrapper::GetWebNavigation(nsIWebNavigation **aWebNavigation)
-{
- nsresult result;
-
- nsCOMPtr<nsIDOMWindow> DOMWindow;
- result = GetFocusedDOMWindow (getter_AddRefs(DOMWindow));
- if (NS_FAILED(result) || !DOMWindow) return NS_ERROR_FAILURE;
-
- nsCOMPtr<nsIScriptGlobalObject> scriptGlobal = do_QueryInterface(DOMWindow);
- if (!scriptGlobal) return NS_ERROR_FAILURE;
-
- nsCOMPtr<nsIDocShell> docshell;
- if (NS_FAILED(scriptGlobal->GetDocShell(getter_AddRefs(docshell))))
- return NS_ERROR_FAILURE;
-
- nsCOMPtr<nsIWebNavigation> wn = do_QueryInterface (docshell, &result);
- if (!wn || !NS_SUCCEEDED (result)) return NS_ERROR_FAILURE;
-
- NS_IF_ADDREF(*aWebNavigation = wn);
- return NS_OK;
-}
-
nsresult EphyWrapper::LoadDocument(nsISupports *aPageDescriptor,
PRUint32 aDisplayType)
{
nsresult rv;
nsCOMPtr<nsIWebNavigation> wn;
- rv = GetWebNavigation(getter_AddRefs(wn));
- if (!wn || !NS_SUCCEEDED(rv)) return NS_ERROR_FAILURE;
+ wn = do_QueryInterface (mWebBrowser);
+ if (!wn) return NS_ERROR_FAILURE;
nsCOMPtr<nsIWebPageDescriptor> wpd = do_QueryInterface(wn, &rv);
if (!wpd || !NS_SUCCEEDED(rv)) return NS_ERROR_FAILURE;
@@ -569,8 +478,8 @@ nsresult EphyWrapper::GetPageDescriptor(nsISupports **aPageDescriptor)
nsresult rv;
nsCOMPtr<nsIWebNavigation> wn;
- rv = GetWebNavigation(getter_AddRefs(wn));
- if (!wn || !NS_SUCCEEDED(rv)) return NS_ERROR_FAILURE;
+ wn = do_QueryInterface (mWebBrowser);
+ if (!wn) return NS_ERROR_FAILURE;
nsCOMPtr<nsIWebPageDescriptor> wpd = do_QueryInterface(wn, &rv);
if (!wpd || !NS_SUCCEEDED(rv)) return NS_ERROR_FAILURE;
@@ -578,13 +487,13 @@ nsresult EphyWrapper::GetPageDescriptor(nsISupports **aPageDescriptor)
return wpd->GetCurrentDescriptor(aPageDescriptor);
}
-nsresult EphyWrapper::GetMainDocumentUrl (nsCString &url)
+nsresult EphyWrapper::GetDocumentUrl (nsCString &url)
{
nsresult result;
nsCOMPtr<nsIDOMDocument> DOMDocument;
- result = GetMainDOMDocument (getter_AddRefs(DOMDocument));
+ result = mDOMWindow->GetDocument (getter_AddRefs(DOMDocument));
if (NS_FAILED(result) || !DOMDocument) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDocument> doc = do_QueryInterface(DOMDocument);
@@ -601,13 +510,13 @@ nsresult EphyWrapper::GetMainDocumentUrl (nsCString &url)
return uri->GetSpec (url);
}
-nsresult EphyWrapper::GetDocumentUrl (nsCString &url)
+nsresult EphyWrapper::GetTargetDocumentUrl (nsCString &url)
{
nsresult result;
nsCOMPtr<nsIDOMDocument> DOMDocument;
- result = GetDOMDocument (getter_AddRefs(DOMDocument));
+ result = GetTargetDocument (getter_AddRefs(DOMDocument));
if (NS_FAILED(result) || !DOMDocument) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDocument> doc = do_QueryInterface(DOMDocument);
@@ -626,88 +535,18 @@ nsresult EphyWrapper::GetDocumentUrl (nsCString &url)
return NS_OK;
}
-nsresult EphyWrapper::CopyHistoryTo (EphyWrapper *dest)
-{
- nsresult result;
- int count,index;
-
- nsCOMPtr<nsIDocShell> DocShell;
- result = GetDocShell (getter_AddRefs(DocShell));
- if (NS_FAILED(result) || !DocShell) return NS_ERROR_FAILURE;
-
- nsCOMPtr<nsIWebNavigation> wn_src = do_QueryInterface (DocShell,
- &result);
- if (!wn_src) return NS_ERROR_FAILURE;
-
- nsCOMPtr<nsISHistory> h_src;
- result = wn_src->GetSessionHistory (getter_AddRefs (h_src));
- if (!NS_SUCCEEDED(result) || (!h_src)) return NS_ERROR_FAILURE;
-
- nsCOMPtr<nsIDocShell> destDocShell;
- result = dest->GetDocShell (getter_AddRefs(destDocShell));
- if (NS_FAILED(result) || !DocShell) return NS_ERROR_FAILURE;
-
- nsCOMPtr<nsIWebNavigation> wn_dest = do_QueryInterface (destDocShell,
- &result);
- if (!wn_dest) return NS_ERROR_FAILURE;
-
- nsCOMPtr<nsISHistory> h_dest;
- result = wn_dest->GetSessionHistory (getter_AddRefs (h_dest));
- if (!NS_SUCCEEDED (result) || (!h_dest)) return NS_ERROR_FAILURE;
-
- nsCOMPtr<nsISHistoryInternal> hi_dest = do_QueryInterface (h_dest);
- if (!hi_dest) return NS_ERROR_FAILURE;
-
- h_src->GetCount (&count);
- h_src->GetIndex (&index);
-
- if (count) {
- nsCOMPtr<nsIHistoryEntry> he;
- nsCOMPtr<nsISHEntry> she;
-
- for (PRInt32 i = 0; i < count; i++) {
-
- result = h_src->GetEntryAtIndex (i, PR_FALSE,
- getter_AddRefs (he));
- if (!NS_SUCCEEDED(result) || (!he))
- return NS_ERROR_FAILURE;
-
- she = do_QueryInterface (he);
- if (!she) return NS_ERROR_FAILURE;
-
- result = hi_dest->AddEntry (she, PR_TRUE);
- if (!NS_SUCCEEDED(result) || (!she))
- return NS_ERROR_FAILURE;
- }
-
- result = wn_dest->GotoIndex(index);
- if (!NS_SUCCEEDED(result)) return NS_ERROR_FAILURE;
- }
-
- return NS_OK;
-}
-
nsresult EphyWrapper::ForceEncoding (const char *encoding)
{
nsresult result;
- nsCOMPtr<nsIDocShell> DocShell;
- result = GetDocShell (getter_AddRefs(DocShell));
- if (NS_FAILED(result) || !DocShell) return NS_ERROR_FAILURE;
-
- nsCOMPtr<nsIContentViewer> contentViewer;
- result = DocShell->GetContentViewer (getter_AddRefs(contentViewer));
- if (!NS_SUCCEEDED (result) || !contentViewer) return NS_ERROR_FAILURE;
+ nsCOMPtr<nsIDocShell> docShell;
+ docShell = do_GetInterface (mWebBrowser);
+ if (!docShell) return NS_ERROR_FAILURE;
- nsCOMPtr<nsIMarkupDocumentViewer> mdv = do_QueryInterface(contentViewer,
- &result);
- if (NS_FAILED(result) || !mdv) return NS_ERROR_FAILURE;
+ nsCOMPtr<nsIDocCharset> docCharset;
+ docCharset = do_QueryInterface (docShell);
-#if MOZILLA_SNAPSHOT > 9
- result = mdv->SetForceCharacterSet (nsDependentCString(encoding));
-#else
- result = mdv->SetForceCharacterSet (NS_ConvertUTF8toUCS2(encoding).get());
-#endif
+ result = docCharset->SetCharset (encoding);
return result;
}
@@ -732,7 +571,7 @@ nsresult EphyWrapper::GetEncodingInfo (EphyEncodingInfo **infoptr)
EphyEncodingInfo *info;
nsCOMPtr<nsIDOMDocument> domDoc;
- result = GetDOMDocument (getter_AddRefs(domDoc));
+ result = GetTargetDocument (getter_AddRefs(domDoc));
if (NS_FAILED (result) || !domDoc) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc, &result);
@@ -751,8 +590,8 @@ nsresult EphyWrapper::GetEncodingInfo (EphyEncodingInfo **infoptr)
info->encoding_source = (EphyEncodingSource) source;
nsCOMPtr<nsIDocShell> ds;
- result = GetDocShell (getter_AddRefs(ds));
- if (NS_FAILED(result) || !ds) return NS_ERROR_FAILURE;
+ ds = do_GetInterface (mWebBrowser);
+ if (!ds) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDocumentCharsetInfo> ci;
result = ds->GetDocumentCharsetInfo (getter_AddRefs (ci));
diff --git a/embed/mozilla/EphyWrapper.h b/embed/mozilla/EphyWrapper.h
index 3867d053d..6178c21a3 100644
--- a/embed/mozilla/EphyWrapper.h
+++ b/embed/mozilla/EphyWrapper.h
@@ -65,35 +65,28 @@ public:
nsresult Find (PRBool bacwards,
PRBool *didFind);
- nsresult GetMainDocumentUrl (nsCString &url);
- nsresult GetDocumentUrl (nsCString &url);
-
nsresult LoadDocument(nsISupports *aPageDescriptor, PRUint32 aDisplayType);
nsresult GetPageDescriptor(nsISupports **aPageDescriptor);
nsresult GetSHInfo (PRInt32 *count, PRInt32 *index);
nsresult GetSHTitleAtIndex (PRInt32 index, PRUnichar **title);
nsresult GetSHUrlAtIndex (PRInt32 index, nsCString &url);
-
- nsresult CopyHistoryTo (EphyWrapper *embed);
-
nsresult GoToHistoryIndex (PRInt16 index);
nsresult ForceEncoding (const char *encoding);
nsresult GetEncodingInfo (EphyEncodingInfo **infoptr);
- nsresult GetMainDOMDocument (nsIDOMDocument **aDOMDocument);
-
nsresult PushTargetDocument (nsIDOMDocument *domDoc);
nsresult PopTargetDocument ();
- nsresult GetDOMDocument (nsIDOMDocument **aDOMDocument);
- nsresult GetDOMWindow (nsIDOMWindow **aDOMWindow);
-
- nsCOMPtr<nsIWebBrowser> mWebBrowser;
+ nsresult GetDocument (nsIDOMDocument **aDOMDocument);
+ nsresult GetTargetDocument (nsIDOMDocument **aDOMDocument);
+ nsresult GetDocumentUrl (nsCString &url);
+ nsresult GetTargetDocumentUrl (nsCString &url);
- nsCOMPtr<nsIWebNavigation> mChromeNav;
+ nsCOMPtr<nsIWebBrowser> mWebBrowser;
+ nsCOMPtr<nsIDOMWindow> mDOMWindow;
GtkMozEmbed *mGtkMozEmbed;
private:
@@ -108,10 +101,10 @@ private:
nsresult SetZoomOnDocshell (float aZoom, nsIDocShell *DocShell);
nsresult GetDocShell (nsIDocShell **aDocShell);
nsresult GetCSSBackground (nsIDOMNode *node, nsAutoString& url);
- nsresult GetFocusedDOMWindow (nsIDOMWindow **aDOMWindow);
nsresult GetSHistory (nsISHistory **aSHistory);
nsresult GetPIDOMWindow(nsPIDOMWindow **aPIWin);
nsresult GetWebNavigation(nsIWebNavigation **aWebNavigation);
+ nsresult GetContentViewer (nsIContentViewer **aViewer);
};
#endif
diff --git a/embed/mozilla/EventContext.cpp b/embed/mozilla/EventContext.cpp
index bfce49e2e..061448aa8 100644
--- a/embed/mozilla/EventContext.cpp
+++ b/embed/mozilla/EventContext.cpp
@@ -771,7 +771,7 @@ nsresult EventContext::IsPageFramed (nsIDOMNode *node, PRBool *Framed)
nsresult result;
nsCOMPtr<nsIDOMDocument> mainDocument;
- result = mWrapper->GetMainDOMDocument (getter_AddRefs(mainDocument));
+ result = mWrapper->GetDocument (getter_AddRefs(mainDocument));
if (NS_FAILED(result) || !mainDocument) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMDocument> nodeDocument;
diff --git a/embed/mozilla/mozilla-embed-persist.cpp b/embed/mozilla/mozilla-embed-persist.cpp
index 53443246f..3aef38c89 100644
--- a/embed/mozilla/mozilla-embed-persist.cpp
+++ b/embed/mozilla/mozilla-embed-persist.cpp
@@ -235,11 +235,11 @@ impl_save (EphyEmbedPersist *persist)
{
if (flags & EMBED_PERSIST_MAINDOC)
{
- rv = wrapper->GetMainDOMDocument (getter_AddRefs(DOMDocument));
+ rv = wrapper->GetDocument (getter_AddRefs(DOMDocument));
}
else
{
- rv = wrapper->GetDOMDocument (getter_AddRefs(DOMDocument));
+ rv = wrapper->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 defa2fc12..7313fd3eb 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -124,9 +124,6 @@ impl_shistory_get_pos (EphyEmbed *embed,
static gresult
impl_shistory_go_nth (EphyEmbed *embed,
int nth);
-static gboolean
-impl_shistory_copy (EphyEmbed *source,
- EphyEmbed *dest);
static gresult
impl_get_security_level (EphyEmbed *embed,
EmbedSecurityLevel *level,
@@ -402,7 +399,6 @@ ephy_embed_init (EphyEmbedClass *embed_class)
embed_class->shistory_get_nth = impl_shistory_get_nth;
embed_class->shistory_get_pos = impl_shistory_get_pos;
embed_class->shistory_go_nth = impl_shistory_go_nth;
- embed_class->shistory_copy = impl_shistory_copy;
embed_class->get_security_level = impl_get_security_level;
embed_class->find_next = impl_find_next;
embed_class->activate = impl_activate;
@@ -765,13 +761,13 @@ impl_get_location (EphyEmbed *embed,
if (toplevel)
{
- rv = wrapper->GetMainDocumentUrl (url);
+ rv = wrapper->GetDocumentUrl (url);
l = (NS_SUCCEEDED (rv) && !url.IsEmpty()) ?
g_strdup (url.get()) : NULL;
}
else
{
- rv = wrapper->GetDocumentUrl (url);
+ rv = wrapper->GetTargetDocumentUrl (url);
l = (NS_SUCCEEDED (rv) && !url.IsEmpty()) ?
g_strdup (url.get()) : NULL;
}
@@ -981,25 +977,6 @@ impl_shistory_go_nth (EphyEmbed *embed,
return NS_SUCCEEDED(rv) ? G_OK : G_FAILED;
}
-static gboolean
-impl_shistory_copy (EphyEmbed *source,
- EphyEmbed *dest)
-{
- nsresult rv;
- EphyWrapper *s_wrapper;
- EphyWrapper *d_wrapper;
-
- s_wrapper = MOZILLA_EMBED(source)->priv->wrapper;
- g_return_val_if_fail (s_wrapper != NULL, G_FAILED);
-
- d_wrapper = MOZILLA_EMBED(dest)->priv->wrapper;
- g_return_val_if_fail (d_wrapper != NULL, G_FAILED);
-
- rv = s_wrapper->CopyHistoryTo (d_wrapper);
-
- return NS_SUCCEEDED(rv) ? G_OK : G_FAILED;
-}
-
static gresult
impl_get_security_level (EphyEmbed *embed,
EmbedSecurityLevel *level,
@@ -1264,22 +1241,6 @@ mozilla_embed_visibility_cb (GtkMozEmbed *embed, gboolean visibility,
MozillaEmbed *membed)
{
g_signal_emit_by_name (membed, "ge_visibility", visibility);
-
- nsresult rv;
- nsCOMPtr<nsIWindowWatcher> wwatch
- (do_GetService(WINDOWWATCHER_CONTRACTID, &rv));
- if (NS_FAILED(rv) || !wwatch) return;
-
- EphyWrapper *wrapper = membed->priv->wrapper;
-
- if (wrapper)
- {
- nsCOMPtr<nsIDOMWindow> domWindow;
- rv = wrapper->GetDOMWindow(getter_AddRefs(domWindow));
- if(NS_FAILED(rv) || !domWindow) return;
-
- rv = wwatch->SetActiveWindow(domWindow);
- }
}
static gint