[epiphany] Track the currently committed address
- From: Gustavo Noronha Silva <gns src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Track the currently committed address
- Date: Tue, 24 Oct 2017 17:32:56 +0000 (UTC)
commit 34216ae096a296e29c5176a704f076434214d1ed
Author: Gustavo Noronha Silva <gns gnome org>
Date: Sat Oct 7 11:47:00 2017 -0300
Track the currently committed address
While doing a load, some policy decisions may depend on where we are coming
from. Both WebKitWebView's uri and EphyWebView's address change even for ongoing
loads, so we track the last committed uri.
https://bugzilla.gnome.org/show_bug.cgi?id=788845
embed/ephy-web-view.c | 21 +++++++++++++++++++++
embed/ephy-web-view.h | 1 +
2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index b6ad010..77f688a 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -80,6 +80,7 @@ struct _EphyWebView {
guint history_frozen : 1;
guint ever_committed : 1;
+ char *last_committed_address;
char *address;
char *display_address;
char *typed_address;
@@ -923,6 +924,7 @@ ephy_web_view_finalize (GObject *object)
ephy_web_view_popups_manager_reset (view);
+ g_free (view->last_committed_address);
g_free (view->address);
g_free (view->display_address);
g_free (view->typed_address);
@@ -1680,6 +1682,9 @@ ephy_web_view_set_committed_location (EphyWebView *view,
ephy_web_view_set_loading_message (view, location);
}
+ g_clear_pointer (&view->last_committed_address, g_free);
+ view->last_committed_address = g_strdup (ephy_web_view_get_address (view));
+
ephy_web_view_set_link_message (view, NULL);
_ephy_web_view_update_icon (view);
@@ -2788,6 +2793,22 @@ ephy_web_view_get_address (EphyWebView *view)
}
/**
+ * ephy_web_view_get_last_committed_address:
+ * @view: an #EphyWebView
+ *
+ * Returns the address of the last committed page, percent-encoded.
+ * This URI should not be displayed to the user; to do that, use
+ * ephy_web_view_get_display_address().
+ *
+ * Return value: @view's address. Will never be %NULL.
+ **/
+const char *
+ephy_web_view_get_last_committed_address (EphyWebView *view)
+{
+ return view->last_committed_address ? view->last_committed_address : "about:blank";
+}
+
+/**
* ephy_web_view_get_display_address:
* @view: an #EphyWebView
*
diff --git a/embed/ephy-web-view.h b/embed/ephy-web-view.h
index 765a27f..b4a3df3 100644
--- a/embed/ephy-web-view.h
+++ b/embed/ephy-web-view.h
@@ -109,6 +109,7 @@ void ephy_web_view_get_security_level (EphyWebView
GTlsCertificateFlags *errors);
void ephy_web_view_print (EphyWebView *view);
const char * ephy_web_view_get_address (EphyWebView *view);
+const char * ephy_web_view_get_last_committed_address (EphyWebView *view);
const char * ephy_web_view_get_display_address (EphyWebView *view);
void ephy_web_view_set_placeholder (EphyWebView *view,
const char *uri,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]