aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
};