[gnome-online-accounts/wip/rishi/pocket-firefox: 5/6] pocket: Implement GoaOAuth2Provider:decide_navigation_policy
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts/wip/rishi/pocket-firefox: 5/6] pocket: Implement GoaOAuth2Provider:decide_navigation_policy
- Date: Wed, 20 Jul 2016 13:22:39 +0000 (UTC)
commit df470088c0d000c8fbe3354b676cadf387bf3bc7
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Jul 19 18:37:28 2016 +0200
pocket: Implement GoaOAuth2Provider:decide_navigation_policy
https://bugzilla.gnome.org/show_bug.cgi?id=755386
src/goabackend/goapocketprovider.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/goabackend/goapocketprovider.c b/src/goabackend/goapocketprovider.c
index af5f247..7585a13 100644
--- a/src/goabackend/goapocketprovider.c
+++ b/src/goabackend/goapocketprovider.c
@@ -184,6 +184,28 @@ build_authorization_uri (GoaOAuth2Provider *oauth2_provider,
}
static gboolean
+decide_navigation_policy (GoaOAuth2Provider *oauth2_provider,
+ WebkitNavigationPolicyDecision *decision)
+{
+ WebKitNavigationAction *action;
+ WebKitURIRequest *request;
+ gboolean ret = FALSE;
+ const gchar *uri;
+
+ action = webkit_navigation_policy_decision_get_navigation_action (decision);
+ request = webkit_navigation_action_get_request (action);
+ uri = webkit_uri_request_get_uri (request);
+ if (!g_str_has_prefix (uri, "https://getpocket.com/a/"))
+ goto out;
+
+ webkit_uri_request_set_uri (request, self->authorization_uri);
+ ret = TRUE;
+
+ out:
+ return ret;
+}
+
+static gboolean
process_redirect_url (GoaOAuth2Provider *oauth2_provider,
const gchar *redirect_url,
gchar **access_token,
@@ -407,6 +429,7 @@ goa_pocket_provider_class_init (GoaPocketProviderClass *klass)
provider_class->build_object = build_object;
oauth2_class->build_authorization_uri = build_authorization_uri;
+ oauth2_class->decide_navigation_policy = decide_navigation_policy;
oauth2_class->get_authorization_uri = get_authorization_uri;
oauth2_class->get_token_uri = get_token_uri;
oauth2_class->get_redirect_uri = get_redirect_uri;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]