aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-05-15 04:19:51 +0800
committerChristian Persch <chpe@src.gnome.org>2005-05-15 04:19:51 +0800
commit26c0657a5dbb31e1e380645dffef2f71adcfe566 (patch)
tree007e5763a82701c0d1755597e4850597b35085aa
parent4a770ac2d3e35cfc5a32333001ebef8d45bce77f (diff)
downloadgsoc2013-epiphany-26c0657a5dbb31e1e380645dffef2f71adcfe566.tar
gsoc2013-epiphany-26c0657a5dbb31e1e380645dffef2f71adcfe566.tar.gz
gsoc2013-epiphany-26c0657a5dbb31e1e380645dffef2f71adcfe566.tar.bz2
gsoc2013-epiphany-26c0657a5dbb31e1e380645dffef2f71adcfe566.tar.lz
gsoc2013-epiphany-26c0657a5dbb31e1e380645dffef2f71adcfe566.tar.xz
gsoc2013-epiphany-26c0657a5dbb31e1e380645dffef2f71adcfe566.tar.zst
gsoc2013-epiphany-26c0657a5dbb31e1e380645dffef2f71adcfe566.zip
No need to have Init on the event listener classes, move that
2005-05-14 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/EphyBrowser.cpp: * embed/mozilla/EphyBrowser.h: No need to have Init on the event listener classes, move that
-rw-r--r--ChangeLog8
-rw-r--r--embed/mozilla/EphyBrowser.cpp61
-rw-r--r--embed/mozilla/EphyBrowser.h26
3 files changed, 27 insertions, 68 deletions
diff --git a/ChangeLog b/ChangeLog
index bb484a964..23141db86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2005-05-14 Christian Persch <chpe@cvs.gnome.org>
+ * embed/mozilla/EphyBrowser.cpp:
+ * embed/mozilla/EphyBrowser.h:
+
+ No need to have Init on the event listener classes, move that
+ code to ctor.
+
+2005-05-14 Christian Persch <chpe@cvs.gnome.org>
+
* configure.ac:
* embed/mozilla/EphyBrowser.cpp:
diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp
index 819f7269c..e20bb86b0 100644
--- a/embed/mozilla/EphyBrowser.cpp
+++ b/embed/mozilla/EphyBrowser.cpp
@@ -111,26 +111,8 @@ const static PRUnichar kTypeAttr[] = { 't', 'y', 'p', 'e', '\0' };
const static PRUnichar kTitleAttr[] = { 't', 'i', 't', 'l', 'e', '\0' };
const static PRUnichar kRelAttr[] = { 'r', 'e', 'l', '\0' };
-EphyEventListener::EphyEventListener()
-: mOwner(nsnull)
-{
- LOG ("EphyEventListener ctor (%p)", this);
-}
-
-EphyEventListener::~EphyEventListener()
-{
- LOG ("EphyEventListener dtor (%p)", this);
-}
-
NS_IMPL_ISUPPORTS1(EphyEventListener, nsIDOMEventListener)
-nsresult
-EphyEventListener::Init (EphyBrowser *aOwner)
-{
- mOwner = aOwner;
- return NS_OK;
-}
-
NS_IMETHODIMP
EphyDOMLinkEventListener::HandleEvent (nsIDOMEvent* aDOMEvent)
{
@@ -406,26 +388,8 @@ EphyModalAlertEventListener::HandleEvent (nsIDOMEvent * aDOMEvent)
return NS_OK;
}
-EphyContextMenuListener::EphyContextMenuListener()
-: mOwner(nsnull)
-{
- LOG ("EphyContextMenuListener ctor (%p)", this);
-}
-
-EphyContextMenuListener::~EphyContextMenuListener()
-{
- LOG ("EphyContextMenuListener dtor (%p)", this);
-}
-
NS_IMPL_ISUPPORTS1(EphyContextMenuListener, nsIDOMContextMenuListener)
-nsresult
-EphyContextMenuListener::Init(EphyBrowser *aOwner)
-{
- mOwner = aOwner;
- return NS_OK;
-}
-
NS_IMETHODIMP
EphyContextMenuListener::ContextMenu (nsIDOMEvent* aDOMEvent)
{
@@ -534,36 +498,21 @@ nsresult EphyBrowser::Init (GtkMozEmbed *mozembed)
rv = mDOMWindow->GetDocument (getter_AddRefs (domDocument));
NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
- mDOMLinkEventListener = new EphyDOMLinkEventListener();
+ mDOMLinkEventListener = new EphyDOMLinkEventListener(this);
if (!mDOMLinkEventListener) return NS_ERROR_OUT_OF_MEMORY;
- rv = mDOMLinkEventListener->Init (this);
- NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
-
- mDOMContentLoadedEventListener = new EphyDOMContentLoadedEventListener();
+ mDOMContentLoadedEventListener = new EphyDOMContentLoadedEventListener(this);
if (!mDOMContentLoadedEventListener) return NS_ERROR_OUT_OF_MEMORY;
- rv = mDOMContentLoadedEventListener->Init (this);
- NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
-
- mPopupBlockEventListener = new EphyPopupBlockEventListener();
+ mPopupBlockEventListener = new EphyPopupBlockEventListener(this);
if (!mPopupBlockEventListener) return NS_ERROR_OUT_OF_MEMORY;
- rv = mPopupBlockEventListener->Init (this);
- NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
-
- mModalAlertListener = new EphyModalAlertEventListener ();
+ mModalAlertListener = new EphyModalAlertEventListener (this);
if (!mModalAlertListener) return NS_ERROR_OUT_OF_MEMORY;
- rv = mModalAlertListener->Init (this);
- NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
-
- mContextMenuListener = new EphyContextMenuListener();
+ mContextMenuListener = new EphyContextMenuListener(this);
if (!mContextMenuListener) return NS_ERROR_OUT_OF_MEMORY;
- rv = mContextMenuListener->Init (this);
- NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
-
rv = GetListener();
NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
diff --git a/embed/mozilla/EphyBrowser.h b/embed/mozilla/EphyBrowser.h
index 31c2699e1..55b02e942 100644
--- a/embed/mozilla/EphyBrowser.h
+++ b/embed/mozilla/EphyBrowser.h
@@ -52,17 +52,14 @@ class EphyBrowser;
class EphyEventListener : public nsIDOMEventListener
{
public:
- EphyEventListener();
- virtual ~EphyEventListener();
-
- nsresult Init (EphyBrowser *aOwner);
-
NS_DECL_ISUPPORTS
// nsIDOMEventListener
-
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) = 0;
+ EphyEventListener(EphyBrowser *aOwner) : mOwner(aOwner) { };
+ virtual ~EphyEventListener() { };
+
protected:
EphyBrowser *mOwner;
};
@@ -71,6 +68,8 @@ class EphyDOMLinkEventListener : public EphyEventListener
{
public:
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
+
+ EphyDOMLinkEventListener(EphyBrowser *aOwner) : EphyEventListener(aOwner) { };
private:
nsresult GetDocURI (nsIDOMElement *aElement,
nsIURI **aDocURI);
@@ -81,18 +80,24 @@ class EphyPopupBlockEventListener : public EphyEventListener
{
public:
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
+
+ EphyPopupBlockEventListener(EphyBrowser *aOwner) : EphyEventListener(aOwner) { };
};
class EphyModalAlertEventListener : public EphyEventListener
{
public:
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
+
+ EphyModalAlertEventListener(EphyBrowser *aOwner) : EphyEventListener(aOwner) { };
};
class EphyDOMContentLoadedEventListener : public EphyEventListener
{
public:
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
+
+ EphyDOMContentLoadedEventListener(EphyBrowser *aOwner) : EphyEventListener(aOwner) { };
};
class EphyContextMenuListener : public nsIDOMContextMenuListener
@@ -100,16 +105,13 @@ class EphyContextMenuListener : public nsIDOMContextMenuListener
public:
NS_DECL_ISUPPORTS
- EphyContextMenuListener();
- virtual ~EphyContextMenuListener();
-
- nsresult Init(EphyBrowser *aOwner);
-
// nsIDOMContextMenuListener
-
NS_IMETHOD ContextMenu(nsIDOMEvent *aEvent);
NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent);
+ EphyContextMenuListener(EphyBrowser *aOwner) : mOwner(aOwner) { };
+ virtual ~EphyContextMenuListener() { };
+
protected:
EphyBrowser *mOwner;
};