aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Berg <benjamin@sipsolutions.net>2007-03-03 07:35:44 +0800
committerBenjamin Berg <bberg@src.gnome.org>2007-03-03 07:35:44 +0800
commitf0fbbefd8192d3fce4023ebdbe67ac897d7fde17 (patch)
tree396e5f918f9c1cc5828fd3a4cfe8149b4d45771d
parente6f2af1ed2c57cc3cce5df8f234a4c242c4aac82 (diff)
downloadgsoc2013-epiphany-f0fbbefd8192d3fce4023ebdbe67ac897d7fde17.tar.gz
gsoc2013-epiphany-f0fbbefd8192d3fce4023ebdbe67ac897d7fde17.tar.zst
gsoc2013-epiphany-f0fbbefd8192d3fce4023ebdbe67ac897d7fde17.zip
Move ephy-adblock.* to embed. Change the API to pass EphyEmbed to
2007-03-03 Benjamin Berg <benjamin@sipsolutions.net> * embed/Makefile.am: * embed/ephy-adblock-manager.c: (ephy_adblock_manager_should_load): * embed/ephy-adblock-manager.h: * embed/ephy-adblock.c: (ephy_adblock_should_load): * embed/ephy-adblock.h: * embed/mozilla/EphyContentPolicy.cpp: * lib/Makefile.am: * lib/ephy-adblock.c: * lib/ephy-adblock.h: Move ephy-adblock.* to embed. Change the API to pass EphyEmbed to should_load. This is needed to fix bug #348331. svn path=/trunk/; revision=6931
-rw-r--r--ChangeLog15
-rw-r--r--embed/Makefile.am2
-rw-r--r--embed/ephy-adblock-manager.c2
-rw-r--r--embed/ephy-adblock-manager.h2
-rw-r--r--embed/ephy-adblock.c (renamed from lib/ephy-adblock.c)4
-rw-r--r--embed/ephy-adblock.h (renamed from lib/ephy-adblock.h)5
-rw-r--r--embed/mozilla/EphyContentPolicy.cpp19
-rw-r--r--lib/Makefile.am3
8 files changed, 38 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 1d5d9156a..1fb64494e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2007-03-03 Benjamin Berg <benjamin@sipsolutions.net>
+
+ * embed/Makefile.am:
+ * embed/ephy-adblock-manager.c: (ephy_adblock_manager_should_load):
+ * embed/ephy-adblock-manager.h:
+ * embed/ephy-adblock.c: (ephy_adblock_should_load):
+ * embed/ephy-adblock.h:
+ * embed/mozilla/EphyContentPolicy.cpp:
+ * lib/Makefile.am:
+ * lib/ephy-adblock.c:
+ * lib/ephy-adblock.h:
+
+ Move ephy-adblock.* to embed. Change the API to pass EphyEmbed to
+ should_load. This is needed to fix bug #348331.
+
2007-03-02 Christian Persch <chpe@svn.gnome.org>
* data/mime-types-permissions.xml:
diff --git a/embed/Makefile.am b/embed/Makefile.am
index 26ef039ea..d92b27c00 100644
--- a/embed/Makefile.am
+++ b/embed/Makefile.am
@@ -16,6 +16,7 @@ NOINST_H_FILES = \
ephy-favicon-cache.h
INST_H_FILES = \
+ ephy-adblock.h \
ephy-adblock-manager.h \
ephy-command-manager.h \
ephy-cookie-manager.h \
@@ -35,6 +36,7 @@ BUILT_SOURCES = \
ephy-embed-type-builtins.h
libephyembed_la_SOURCES = \
+ ephy-adblock.c \
ephy-adblock-manager.c \
downloader-view.c \
ephy-command-manager.c \
diff --git a/embed/ephy-adblock-manager.c b/embed/ephy-adblock-manager.c
index dd627fddf..dacf7c8da 100644
--- a/embed/ephy-adblock-manager.c
+++ b/embed/ephy-adblock-manager.c
@@ -66,12 +66,14 @@ ephy_adblock_manager_set_blocker (EphyAdBlockManager *self,
**/
gboolean
ephy_adblock_manager_should_load (EphyAdBlockManager *self,
+ EphyEmbed *embed,
const char *url,
AdUriCheckType check_type)
{
if (self->priv->blocker != NULL)
{
return ephy_adblock_should_load (self->priv->blocker,
+ embed,
url,
check_type);
}
diff --git a/embed/ephy-adblock-manager.h b/embed/ephy-adblock-manager.h
index d6889e39f..d7c8cb95a 100644
--- a/embed/ephy-adblock-manager.h
+++ b/embed/ephy-adblock-manager.h
@@ -24,6 +24,7 @@
#define EPHY_ADBLOCK_MANAGER_H
#include <glib-object.h>
+#include "ephy-embed.h"
#include "ephy-adblock.h"
G_BEGIN_DECLS
@@ -56,6 +57,7 @@ struct _EphyAdBlockManagerClass {
GType ephy_adblock_manager_get_type (void);
gboolean ephy_adblock_manager_should_load (EphyAdBlockManager *self,
+ EphyEmbed *embed,
const char *url,
AdUriCheckType check_type);
diff --git a/lib/ephy-adblock.c b/embed/ephy-adblock.c
index 77e51ba1f..4f5be6731 100644
--- a/lib/ephy-adblock.c
+++ b/embed/ephy-adblock.c
@@ -48,13 +48,15 @@ ephy_adblock_get_type (void)
gboolean
ephy_adblock_should_load (EphyAdBlock *adblock,
+ EphyEmbed *embed,
const char *url,
AdUriCheckType check_type)
{
EphyAdBlockIface *iface = EPHY_ADBLOCK_GET_IFACE (adblock);
+
if (iface->should_load)
{
- return iface->should_load (adblock, url, check_type);
+ return iface->should_load (adblock, embed, url, check_type);
}
return TRUE;
diff --git a/lib/ephy-adblock.h b/embed/ephy-adblock.h
index cc0dfa91e..693c386b9 100644
--- a/lib/ephy-adblock.h
+++ b/embed/ephy-adblock.h
@@ -23,6 +23,7 @@
#ifndef EPHY_ADBLOCK_H
#define EPHY_ADBLOCK_H
+#include "ephy-embed.h"
#include <glib-object.h>
G_BEGIN_DECLS
@@ -64,9 +65,10 @@ struct _EphyAdBlockIface
GTypeInterface base_iface;
gboolean (* should_load) (EphyAdBlock *adblock,
+ EphyEmbed *embed,
const char *url,
AdUriCheckType check_type);
-
+
void (* edit_rule) (EphyAdBlock *adblock,
const char *url,
gboolean allowed);
@@ -75,6 +77,7 @@ struct _EphyAdBlockIface
GType ephy_adblock_get_type (void);
gboolean ephy_adblock_should_load (EphyAdBlock *adblock,
+ EphyEmbed *embed,
const char *url,
AdUriCheckType check_type);
diff --git a/embed/mozilla/EphyContentPolicy.cpp b/embed/mozilla/EphyContentPolicy.cpp
index 77a519154..7d55a6971 100644
--- a/embed/mozilla/EphyContentPolicy.cpp
+++ b/embed/mozilla/EphyContentPolicy.cpp
@@ -151,22 +151,23 @@ EphyContentPolicy::ShouldLoad(PRUint32 aContentType,
PR_TRUE /* TYPE_REFRESH */
};
- if (kBlockType[aContentType < G_N_ELEMENTS (kBlockType) ? aContentType : 0] &&
- !ephy_adblock_manager_should_load (adblock_manager,
- contentSpec.get (),
- AdUriCheckType (aContentType)))
+ if (kBlockType[aContentType < G_N_ELEMENTS (kBlockType) ? aContentType : 0])
{
- *aDecision = nsIContentPolicy::REJECT_REQUEST;
-
- GtkWidget *embed = GetEmbedFromContext (aContext);
+ GtkWidget *embed = GetEmbedFromContext (aContext);
- if (embed)
+ if (embed &&
+ !ephy_adblock_manager_should_load (adblock_manager,
+ EPHY_EMBED (embed),
+ contentSpec.get (),
+ AdUriCheckType (aContentType)))
{
+ *aDecision = nsIContentPolicy::REJECT_REQUEST;
+
g_signal_emit_by_name (embed,
"content-blocked",
contentSpec.get ());
+ return NS_OK;
}
- return NS_OK;
}
PRBool isHttp = PR_FALSE;
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 90841f14a..b1e644ab6 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -30,13 +30,11 @@ NOINST_H_FILES = \
ephy-zoom.h
TYPES_H_FILES = \
- ephy-adblock.h \
ephy-node.h \
ephy-password-dialog.h \
ephy-state.h
INST_H_FILES = \
- ephy-adblock.h \
ephy-dialog.h \
ephy-loader.h \
ephy-node.h \
@@ -45,7 +43,6 @@ INST_H_FILES = \
libephymisc_la_SOURCES = \
eel-gconf-extensions.c \
- ephy-adblock.c \
ephy-debug.c \
ephy-dialog.c \
ephy-dnd.c \