aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-history.c38
-rw-r--r--embed/ephy-history.h11
-rw-r--r--embed/mozilla/GlobalHistory.cpp47
3 files changed, 68 insertions, 28 deletions
diff --git a/embed/ephy-history.c b/embed/ephy-history.c
index ce0f9e017..de8109128 100644
--- a/embed/ephy-history.c
+++ b/embed/ephy-history.c
@@ -63,6 +63,12 @@ struct _EphyHistoryPrivate
enum
{
+ REDIRECT_FLAG = 1 << 0,
+ TOPLEVEL_FLAG = 1 << 1
+};
+
+enum
+{
PROP_0,
PROP_ENABLED
};
@@ -81,7 +87,7 @@ static guint signals[LAST_SIGNAL] = { 0 };
static void ephy_history_class_init (EphyHistoryClass *klass);
static void ephy_history_init (EphyHistory *history);
static void ephy_history_finalize (GObject *object);
-static gboolean impl_add_page (EphyHistory *histroy, const char *url);
+static gboolean impl_add_page (EphyHistory *, const char *, gboolean, gboolean);
static GObjectClass *parent_class = NULL;
@@ -188,10 +194,12 @@ ephy_history_class_init (EphyHistoryClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EphyHistoryClass, add_page),
g_signal_accumulator_true_handled, NULL,
- ephy_marshal_BOOLEAN__STRING,
+ ephy_marshal_BOOLEAN__STRING_BOOLEAN_BOOLEAN,
G_TYPE_BOOLEAN,
- 1,
- G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
+ 3,
+ G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE,
+ G_TYPE_BOOLEAN,
+ G_TYPE_BOOLEAN);
signals[VISITED] =
g_signal_new ("visited",
@@ -882,18 +890,24 @@ ephy_history_get_page_visits (EphyHistory *gh,
void
ephy_history_add_page (EphyHistory *eh,
- const char *url)
+ const char *url,
+ gboolean redirect,
+ gboolean toplevel)
{
gboolean result = FALSE;
- g_signal_emit (eh, signals[ADD_PAGE], 0, url, &result);
+ g_signal_emit (eh, signals[ADD_PAGE], 0, url, redirect, toplevel, &result);
}
static gboolean
-impl_add_page (EphyHistory *eb, const char *url)
+impl_add_page (EphyHistory *eb,
+ const char *url,
+ gboolean redirect,
+ gboolean toplevel)
{
EphyNode *bm, *node, *host;
GValue value = { 0, };
+ gulong flags = 0;
if (eb->priv->enabled == FALSE)
{
@@ -917,6 +931,16 @@ impl_add_page (EphyHistory *eb, const char *url)
&value);
g_value_unset (&value);
+ if (redirect) flags |= REDIRECT_FLAG;
+ if (toplevel) flags |= TOPLEVEL_FLAG;
+
+ /* EphyNode SUCKS! */
+ g_value_init (&value, G_TYPE_LONG);
+ g_value_set_long (&value, (long) flags);
+ ephy_node_set_property (bm, EPHY_NODE_PAGE_PROP_EXTRA_FLAGS,
+ &value);
+ g_value_unset (&value);
+
host = ephy_history_add_host (eb, bm);
g_value_init (&value, G_TYPE_INT);
diff --git a/embed/ephy-history.h b/embed/ephy-history.h
index ef4b62d1e..8f7cdd3e4 100644
--- a/embed/ephy-history.h
+++ b/embed/ephy-history.h
@@ -49,7 +49,8 @@ enum
EPHY_NODE_PAGE_PROP_PRIORITY = 8,
EPHY_NODE_PAGE_PROP_ICON = 9,
EPHY_NODE_HOST_PROP_ZOOM = 10,
- EPHY_NODE_PAGE_PROP_GECKO_FLAGS = 11
+ EPHY_NODE_PAGE_PROP_GECKO_FLAGS = 11,
+ EPHY_NODE_PAGE_PROP_EXTRA_FLAGS = 12
};
struct _EphyHistory
@@ -66,7 +67,9 @@ struct _EphyHistoryClass
/* Signals */
gboolean (* add_page) (EphyHistory *history,
- const char *url);
+ const char *url,
+ gboolean redirect,
+ gboolean toplevel);
void (* visited) (EphyHistory *history,
const char *url);
void (* cleared) (EphyHistory *history);
@@ -91,7 +94,9 @@ EphyNode *ephy_history_get_page (EphyHistory *gh,
const char *url);
void ephy_history_add_page (EphyHistory *gh,
- const char *url);
+ const char *url,
+ gboolean redirect,
+ gboolean toplevel);
gboolean ephy_history_is_page_visited (EphyHistory *gh,
const char *url);
diff --git a/embed/mozilla/GlobalHistory.cpp b/embed/mozilla/GlobalHistory.cpp
index 90b65c020..909ce1de7 100644
--- a/embed/mozilla/GlobalHistory.cpp
+++ b/embed/mozilla/GlobalHistory.cpp
@@ -48,10 +48,15 @@ MozGlobalHistory::~MozGlobalHistory ()
#ifdef HAVE_GECKO_1_8
/* void addURI (in nsIURI aURI, in boolean aRedirect, in boolean aToplevel, in nsIURI aReferrer); */
-NS_IMETHODIMP MozGlobalHistory::AddURI(nsIURI *aURI, PRBool aRedirect, PRBool aToplevel, nsIURI *aReferrer)
+NS_IMETHODIMP MozGlobalHistory::AddURI(nsIURI *aURI,
+ PRBool aRedirect,
+ PRBool aToplevel,
+ nsIURI *aReferrer)
#else
/* void addURI (in nsIURI aURI, in boolean aRedirect, in boolean aToplevel); */
-NS_IMETHODIMP MozGlobalHistory::AddURI(nsIURI *aURI, PRBool aRedirect, PRBool aToplevel)
+NS_IMETHODIMP MozGlobalHistory::AddURI(nsIURI *aURI,
+ PRBool aRedirect,
+ PRBool aToplevel)
#endif
{
nsresult rv;
@@ -72,18 +77,20 @@ NS_IMETHODIMP MozGlobalHistory::AddURI(nsIURI *aURI, PRBool aRedirect, PRBool aT
if (!isHTTP && !isHTTPS)
{
- PRBool isJavascript, isAbout, isViewSource, isChrome, isData;
-
- rv = aURI->SchemeIs("javascript", &isJavascript);
- rv |= aURI->SchemeIs("about", &isAbout);
- rv |= aURI->SchemeIs("view-source", &isViewSource);
- rv |= aURI->SchemeIs("chrome", &isChrome);
- rv |= aURI->SchemeIs("data", &isData);
- NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
-
- if (isJavascript ||isAbout || isViewSource || isChrome || isData)
+ static const char *schemes[] = { "javascript",
+ "data",
+ "about",
+ "chrome",
+ "resource",
+ "view-source" };
+
+ for (PRUint32 i = 0; i < G_N_ELEMENTS (schemes); ++i)
{
- return NS_OK;
+ PRBool result = PR_FALSE;
+ if (NS_SUCCEEDED (aURI->SchemeIs (schemes[i], &result)) && result)
+ {
+ return NS_OK;
+ }
}
}
@@ -91,13 +98,14 @@ NS_IMETHODIMP MozGlobalHistory::AddURI(nsIURI *aURI, PRBool aRedirect, PRBool aT
rv = aURI->GetSpec(spec);
NS_ENSURE_TRUE (NS_SUCCEEDED(rv) && spec.Length(), rv);
- ephy_history_add_page (mGlobalHistory, spec.get());
+ ephy_history_add_page (mGlobalHistory, spec.get(), aRedirect, aToplevel);
return NS_OK;
}
/* boolean isVisited (in nsIURI aURI); */
-NS_IMETHODIMP MozGlobalHistory::IsVisited(nsIURI *aURI, PRBool *_retval)
+NS_IMETHODIMP MozGlobalHistory::IsVisited(nsIURI *aURI,
+ PRBool *_retval)
{
NS_ENSURE_ARG (aURI);
@@ -110,7 +118,8 @@ NS_IMETHODIMP MozGlobalHistory::IsVisited(nsIURI *aURI, PRBool *_retval)
}
/* void setPageTitle (in nsIURI aURI, in AString aTitle); */
-NS_IMETHODIMP MozGlobalHistory::SetPageTitle(nsIURI *aURI, const nsAString & aTitle)
+NS_IMETHODIMP MozGlobalHistory::SetPageTitle(nsIURI *aURI,
+ const nsAString & aTitle)
{
NS_ENSURE_ARG (aURI);
@@ -129,7 +138,8 @@ NS_IMETHODIMP MozGlobalHistory::SetPageTitle(nsIURI *aURI, const nsAString & aTi
#ifdef HAVE_GECKO_1_9
/* unsigned long getURIGeckoFlags(in nsIURI aURI); */
NS_IMETHODIMP
-MozGlobalHistory::GetURIGeckoFlags(nsIURI *aURI, PRUint32* aFlags)
+MozGlobalHistory::GetURIGeckoFlags(nsIURI *aURI,
+ PRUint32* aFlags)
{
nsEmbedCString spec;
aURI->GetSpec(spec);
@@ -151,7 +161,8 @@ MozGlobalHistory::GetURIGeckoFlags(nsIURI *aURI, PRUint32* aFlags)
/* void setURIGeckoFlags(in nsIURI aURI, in unsigned long aFlags); */
NS_IMETHODIMP
-MozGlobalHistory::SetURIGeckoFlags(nsIURI *aURI, PRUint32 aFlags)
+MozGlobalHistory::SetURIGeckoFlags(nsIURI *aURI,
+ PRUint32 aFlags)
{
nsEmbedCString spec;
aURI->GetSpec(spec);