[gnome-online-accounts/wip/rishi/pocket-firefox: 7/8] oauth2: split headers



commit 70e75315d5e51e8e671084c91f3228cc4cfc78d1
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Jul 20 16:05:12 2016 +0200

    oauth2: split headers

 src/goabackend/Makefile.am                       |    5 +-
 src/goabackend/goafacebookprovider.c             |    1 +
 src/goabackend/goafoursquareprovider.c           |    1 +
 src/goabackend/goagoogleprovider.c               |    1 +
 src/goabackend/goalastfmprovider.c               |    1 +
 src/goabackend/goaoauth2provider-priv.h          |  122 ++++++++++++++++++++++
 src/goabackend/goaoauth2provider-web-extension.h |   40 +++++++
 src/goabackend/goaoauth2provider-web-view.h      |   36 +++++++
 src/goabackend/goaoauth2provider.c               |    3 +
 src/goabackend/goaoauth2provider.h               |   98 +-----------------
 src/goabackend/goapocketprovider.c               |    1 +
 src/goabackend/goawebextension.c                 |    1 +
 src/goabackend/goawindowsliveprovider.c          |    1 +
 13 files changed, 214 insertions(+), 97 deletions(-)
---
diff --git a/src/goabackend/Makefile.am b/src/goabackend/Makefile.am
index 81029b8..6aaf2d8 100644
--- a/src/goabackend/Makefile.am
+++ b/src/goabackend/Makefile.am
@@ -81,7 +81,10 @@ libgoa_backend_1_0_la_SOURCES =                                              \
        goamailclient.h                 goamailclient.c                 \
        goaexchangeprovider.h           goaexchangeprovider.c           \
        goaoauthprovider.h              goaoauthprovider.c              \
-       goaoauth2provider.h             goaoauth2provider.c             \
+       goaoauth2provider.h             goaoauth2provider-priv.h        \
+       goaoauth2provider-web-extension.h                               \
+       goaoauth2provider-web-view.h                                    \
+       goaoauth2provider.c                                             \
        goagoogleprovider.h             goagoogleprovider.c             \
        goafacebookprovider.h           goafacebookprovider.c           \
        goaimapsmtpprovider.h           goaimapsmtpprovider.c           \
diff --git a/src/goabackend/goafacebookprovider.c b/src/goabackend/goafacebookprovider.c
index 80fa9cd..471d7a9 100644
--- a/src/goabackend/goafacebookprovider.c
+++ b/src/goabackend/goafacebookprovider.c
@@ -25,6 +25,7 @@
 #include "goaprovider.h"
 #include "goaprovider-priv.h"
 #include "goaoauth2provider.h"
+#include "goaoauth2provider-priv.h"
 #include "goafacebookprovider.h"
 #include "goaobjectskeletonutils.h"
 
diff --git a/src/goabackend/goafoursquareprovider.c b/src/goabackend/goafoursquareprovider.c
index 6aa4859..6e89c6a 100644
--- a/src/goabackend/goafoursquareprovider.c
+++ b/src/goabackend/goafoursquareprovider.c
@@ -26,6 +26,7 @@
 #include "goaprovider.h"
 #include "goaprovider-priv.h"
 #include "goaoauth2provider.h"
+#include "goaoauth2provider-priv.h"
 #include "goafoursquareprovider.h"
 #include "goaobjectskeletonutils.h"
 
diff --git a/src/goabackend/goagoogleprovider.c b/src/goabackend/goagoogleprovider.c
index 7f5863d..21c03bf 100644
--- a/src/goabackend/goagoogleprovider.c
+++ b/src/goabackend/goagoogleprovider.c
@@ -25,6 +25,7 @@
 #include "goaprovider.h"
 #include "goaprovider-priv.h"
 #include "goaoauth2provider.h"
+#include "goaoauth2provider-priv.h"
 #include "goagoogleprovider.h"
 #include "goaobjectskeletonutils.h"
 
diff --git a/src/goabackend/goalastfmprovider.c b/src/goabackend/goalastfmprovider.c
index 7918965..971149c 100644
--- a/src/goabackend/goalastfmprovider.c
+++ b/src/goabackend/goalastfmprovider.c
@@ -26,6 +26,7 @@
 #include "goaprovider.h"
 #include "goaprovider-priv.h"
 #include "goaoauth2provider.h"
+#include "goaoauth2provider-priv.h"
 #include "goalastfmprovider.h"
 #include "goautils.h"
 
diff --git a/src/goabackend/goaoauth2provider-priv.h b/src/goabackend/goaoauth2provider-priv.h
new file mode 100644
index 0000000..7fb5855
--- /dev/null
+++ b/src/goabackend/goaoauth2provider-priv.h
@@ -0,0 +1,122 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/*
+ * Copyright (C) 2011, 2012, 2014, 2015 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#if !defined (__GOA_BACKEND_INSIDE_GOA_BACKEND_H__) && !defined (GOA_BACKEND_COMPILATION)
+#error "Only <goabackend/goabackend.h> can be included directly."
+#endif
+
+#ifndef __GOA_OAUTH2_PROVIDER_PRIV_H__
+#define __GOA_OAUTH2_PROVIDER_PRIV_H__
+
+#include <gio/gio.h>
+#include <goabackend/goaoauth2provider.h>
+#include <goabackend/goaprovider-priv.h>
+#include <goabackend/goabackendtypes.h>
+#include <webkit2/webkit2.h>
+#include <webkitdom/webkitdom.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GoaOAuth2Provider:
+ *
+ * The #GoaOAuth2Provider structure contains only private data and should
+ * only be accessed using the provided API.
+ */
+struct _GoaOAuth2Provider
+{
+  /*< private >*/
+  GoaProvider parent_instance;
+  GoaOAuth2ProviderPrivate *priv;
+};
+
+/**
+ * GoaOAuth2ProviderClass:
+ * @parent_class: The parent class.
+ * @get_authorization_uri: Virtual function for goa_oauth2_provider_get_authorization_uri().
+ * @get_token_uri: Virtual function for goa_oauth2_provider_get_token_uri().
+ * @get_redirect_uri: Virtual function for goa_oauth2_provider_get_redirect_uri().
+ * @get_scope: Virtual function for goa_oauth2_provider_get_scope().
+ * @get_client_id: Virtual function for goa_oauth2_provider_get_client_id().
+ * @get_client_secret: Virtual function for goa_oauth2_provider_get_client_secret().
+ * @get_authentication_cookie: Virtual function for goa_oauth2_provider_get_authentication_cookie().
+ * @get_identity_sync: Virtual function for goa_oauth2_provider_get_identity_sync().
+ * @build_authorization_uri: Virtual function for goa_oauth2_provider_build_authorization_uri().
+ * @get_use_mobile_browser: Virtual function for goa_oauth2_provider_get_use_mobile_browser().
+ * @add_account_key_values: Virtual function for goa_oauth2_provider_add_account_key_values().
+ * @decide_navigation_policy: Virtual function for goa_oauth2_provider_decide_navigation_policy().
+ * @process_redirect_url: Virtual function for goa_oauth2_provider_process_redirect_url().
+ * @is_deny_node: Virtual function for goa_oauth2_provider_is_deny_node().
+ * @is_identity_node: Virtual function for goa_oauth2_provider_is_identity_node().
+ * @is_password_node: Virtual function for goa_oauth2_provider_is_password_node().
+ *
+ * Class structure for #GoaOAuth2Provider.
+ */
+struct _GoaOAuth2ProviderClass
+{
+  GoaProviderClass parent_class;
+
+  /* pure virtual */
+  const gchar *(*get_authorization_uri)        (GoaOAuth2Provider            *provider);
+  const gchar *(*get_redirect_uri)             (GoaOAuth2Provider            *provider);
+  const gchar *(*get_client_id)                (GoaOAuth2Provider            *provider);
+  const gchar *(*get_client_secret)            (GoaOAuth2Provider            *provider);
+  const gchar *(*get_authentication_cookie)    (GoaOAuth2Provider            *provider);
+  gchar       *(*get_identity_sync)            (GoaOAuth2Provider            *provider,
+                                                const gchar                  *access_token,
+                                                gchar                       **out_presentation_identity,
+                                                GCancellable                 *cancellable,
+                                                GError                      **error);
+
+  /* virtual but with default implementation */
+  gchar       *(*build_authorization_uri)      (GoaOAuth2Provider            *provider,
+                                                const gchar                  *authorization_uri,
+                                                const gchar                  *escaped_redirect_uri,
+                                                const gchar                  *escaped_client_id,
+                                                const gchar                  *escaped_scope);
+  const gchar *(*get_token_uri)                (GoaOAuth2Provider            *provider);
+  const gchar *(*get_scope)                    (GoaOAuth2Provider            *provider);
+  gboolean     (*get_use_mobile_browser)       (GoaOAuth2Provider            *provider);
+  void         (*add_account_key_values)       (GoaOAuth2Provider            *provider,
+                                                GVariantBuilder              *builder);
+
+  /* pure virtual */
+  gboolean     (*is_identity_node)             (GoaOAuth2Provider            *provider,
+                                                WebKitDOMHTMLInputElement    *element);
+
+  /* virtual but with default implementation */
+  gboolean     (*is_deny_node)                 (GoaOAuth2Provider            *provider,
+                                                WebKitDOMNode                *node);
+  gboolean     (*is_password_node)             (GoaOAuth2Provider            *provider,
+                                                WebKitDOMHTMLInputElement    *element);
+  gboolean     (*decide_navigation_policy)     (GoaOAuth2Provider              *provider,
+                                                WebKitNavigationPolicyDecision *decision);
+  gboolean     (*process_redirect_url)         (GoaOAuth2Provider            *provider,
+                                                const gchar                  *redirect_url,
+                                                gchar                       **access_token,
+                                                GError                      **error);
+
+
+  /*< private >*/
+  /* Padding for future expansion */
+  gpointer goa_reserved[28];
+};
+
+G_END_DECLS
+
+#endif /* __GOA_OAUTH2_PROVIDER_PRIV_H__ */
diff --git a/src/goabackend/goaoauth2provider-web-extension.h 
b/src/goabackend/goaoauth2provider-web-extension.h
new file mode 100644
index 0000000..b69549a
--- /dev/null
+++ b/src/goabackend/goaoauth2provider-web-extension.h
@@ -0,0 +1,40 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/*
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#if !defined (__GOA_BACKEND_INSIDE_GOA_BACKEND_H__) && !defined (GOA_BACKEND_COMPILATION)
+#error "Only <goabackend/goabackend.h> can be included directly."
+#endif
+
+#ifndef __GOA_OAUTH2_PROVIDER_WEB_EXTENSION_H__
+#define __GOA_OAUTH2_PROVIDER_WEB_EXTENSION_H__
+
+#include <goabackend/goaoauth2provider.h>
+#include <webkitdom/webkitdom.h>
+
+G_BEGIN_DECLS
+
+gboolean     goa_oauth2_provider_is_deny_node                 (GoaOAuth2Provider             *provider,
+                                                               WebKitDOMNode                 *node);
+gboolean     goa_oauth2_provider_is_identity_node             (GoaOAuth2Provider             *provider,
+                                                               WebKitDOMHTMLInputElement     *element);
+gboolean     goa_oauth2_provider_is_password_node             (GoaOAuth2Provider             *provider,
+                                                               WebKitDOMHTMLInputElement     *element);
+
+G_END_DECLS
+
+#endif /* __GOA_OAUTH2_PROVIDER_WEB_EXTENSION_H__ */
diff --git a/src/goabackend/goaoauth2provider-web-view.h b/src/goabackend/goaoauth2provider-web-view.h
new file mode 100644
index 0000000..f94eae4
--- /dev/null
+++ b/src/goabackend/goaoauth2provider-web-view.h
@@ -0,0 +1,36 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/*
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#if !defined (__GOA_BACKEND_INSIDE_GOA_BACKEND_H__) && !defined (GOA_BACKEND_COMPILATION)
+#error "Only <goabackend/goabackend.h> can be included directly."
+#endif
+
+#ifndef __GOA_OAUTH2_PROVIDER_WEB_VIEW_H__
+#define __GOA_OAUTH2_PROVIDER_WEB_VIEW_H__
+
+#include <goabackend/goaoauth2provider.h>
+#include <webkit2/webkit2.h>
+
+G_BEGIN_DECLS
+
+gboolean     goa_oauth2_provider_decide_navigation_policy     (GoaOAuth2Provider              *provider,
+                                                               WebKitNavigationPolicyDecision *decision);
+
+G_END_DECLS
+
+#endif /* __GOA_OAUTH2_PROVIDER_WEB_VIEW_H__ */
diff --git a/src/goabackend/goaoauth2provider.c b/src/goabackend/goaoauth2provider.c
index 4b32c8d..e19e8e1 100644
--- a/src/goabackend/goaoauth2provider.c
+++ b/src/goabackend/goaoauth2provider.c
@@ -29,6 +29,9 @@
 #include "goautils.h"
 #include "goawebview.h"
 #include "goaoauth2provider.h"
+#include "goaoauth2provider-priv.h"
+#include "goaoauth2provider-web-extension.h"
+#include "goaoauth2provider-web-view.h"
 
 /**
  * SECTION:goaoauth2provider
diff --git a/src/goabackend/goaoauth2provider.h b/src/goabackend/goaoauth2provider.h
index d6fb1b5..192aceb 100644
--- a/src/goabackend/goaoauth2provider.h
+++ b/src/goabackend/goaoauth2provider.h
@@ -23,9 +23,8 @@
 #ifndef __GOA_OAUTH2_PROVIDER_H__
 #define __GOA_OAUTH2_PROVIDER_H__
 
-#include <goabackend/goaprovider.h>
-#include <goabackend/goaprovider-priv.h>
-#include <webkitdom/webkitdom.h>
+#include <gio/gio.h>
+#include <goabackend/goabackendtypes.h>
 
 G_BEGIN_DECLS
 
@@ -41,91 +40,6 @@ typedef struct _GoaOAuth2Provider GoaOAuth2Provider;
 typedef struct _GoaOAuth2ProviderClass GoaOAuth2ProviderClass;
 typedef struct _GoaOAuth2ProviderPrivate GoaOAuth2ProviderPrivate;
 
-/**
- * GoaOAuth2Provider:
- *
- * The #GoaOAuth2Provider structure contains only private data and should
- * only be accessed using the provided API.
- */
-struct _GoaOAuth2Provider
-{
-  /*< private >*/
-  GoaProvider parent_instance;
-  GoaOAuth2ProviderPrivate *priv;
-};
-
-/**
- * GoaOAuth2ProviderClass:
- * @parent_class: The parent class.
- * @get_authorization_uri: Virtual function for goa_oauth2_provider_get_authorization_uri().
- * @get_token_uri: Virtual function for goa_oauth2_provider_get_token_uri().
- * @get_redirect_uri: Virtual function for goa_oauth2_provider_get_redirect_uri().
- * @get_scope: Virtual function for goa_oauth2_provider_get_scope().
- * @get_client_id: Virtual function for goa_oauth2_provider_get_client_id().
- * @get_client_secret: Virtual function for goa_oauth2_provider_get_client_secret().
- * @get_authentication_cookie: Virtual function for goa_oauth2_provider_get_authentication_cookie().
- * @get_identity_sync: Virtual function for goa_oauth2_provider_get_identity_sync().
- * @build_authorization_uri: Virtual function for goa_oauth2_provider_build_authorization_uri().
- * @get_use_mobile_browser: Virtual function for goa_oauth2_provider_get_use_mobile_browser().
- * @add_account_key_values: Virtual function for goa_oauth2_provider_add_account_key_values().
- * @decide_navigation_policy: Virtual function for goa_oauth2_provider_decide_navigation_policy().
- * @process_redirect_url: Virtual function for goa_oauth2_provider_process_redirect_url().
- * @is_deny_node: Virtual function for goa_oauth2_provider_is_deny_node().
- * @is_identity_node: Virtual function for goa_oauth2_provider_is_identity_node().
- * @is_password_node: Virtual function for goa_oauth2_provider_is_password_node().
- *
- * Class structure for #GoaOAuth2Provider.
- */
-struct _GoaOAuth2ProviderClass
-{
-  GoaProviderClass parent_class;
-
-  /* pure virtual */
-  const gchar *(*get_authorization_uri)        (GoaOAuth2Provider            *provider);
-  const gchar *(*get_redirect_uri)             (GoaOAuth2Provider            *provider);
-  const gchar *(*get_client_id)                (GoaOAuth2Provider            *provider);
-  const gchar *(*get_client_secret)            (GoaOAuth2Provider            *provider);
-  const gchar *(*get_authentication_cookie)    (GoaOAuth2Provider            *provider);
-  gchar       *(*get_identity_sync)            (GoaOAuth2Provider            *provider,
-                                                const gchar                  *access_token,
-                                                gchar                       **out_presentation_identity,
-                                                GCancellable                 *cancellable,
-                                                GError                      **error);
-
-  /* virtual but with default implementation */
-  gchar       *(*build_authorization_uri)      (GoaOAuth2Provider            *provider,
-                                                const gchar                  *authorization_uri,
-                                                const gchar                  *escaped_redirect_uri,
-                                                const gchar                  *escaped_client_id,
-                                                const gchar                  *escaped_scope);
-  const gchar *(*get_token_uri)                (GoaOAuth2Provider            *provider);
-  const gchar *(*get_scope)                    (GoaOAuth2Provider            *provider);
-  gboolean     (*get_use_mobile_browser)       (GoaOAuth2Provider            *provider);
-  void         (*add_account_key_values)       (GoaOAuth2Provider            *provider,
-                                                GVariantBuilder              *builder);
-
-  /* pure virtual */
-  gboolean     (*is_identity_node)             (GoaOAuth2Provider            *provider,
-                                                WebKitDOMHTMLInputElement    *element);
-
-  /* virtual but with default implementation */
-  gboolean     (*is_deny_node)                 (GoaOAuth2Provider            *provider,
-                                                WebKitDOMNode                *node);
-  gboolean     (*is_password_node)             (GoaOAuth2Provider            *provider,
-                                                WebKitDOMHTMLInputElement    *element);
-  gboolean     (*decide_navigation_policy)     (GoaOAuth2Provider              *provider,
-                                                WebKitNavigationPolicyDecision *decision);
-  gboolean     (*process_redirect_url)         (GoaOAuth2Provider            *provider,
-                                                const gchar                  *redirect_url,
-                                                gchar                       **access_token,
-                                                GError                      **error);
-
-
-  /*< private >*/
-  /* Padding for future expansion */
-  gpointer goa_reserved[28];
-};
-
 GType        goa_oauth2_provider_get_type                     (void) G_GNUC_CONST;
 const gchar *goa_oauth2_provider_get_authorization_uri        (GoaOAuth2Provider             *provider);
 const gchar *goa_oauth2_provider_get_token_uri                (GoaOAuth2Provider             *provider);
@@ -139,12 +53,6 @@ gchar       *goa_oauth2_provider_get_identity_sync            (GoaOAuth2Provider
                                                                gchar                   
**out_presentation_identity,
                                                                GCancellable             *cancellable,
                                                                GError                  **error);
-gboolean     goa_oauth2_provider_is_deny_node                 (GoaOAuth2Provider             *provider,
-                                                               WebKitDOMNode                 *node);
-gboolean     goa_oauth2_provider_is_identity_node             (GoaOAuth2Provider             *provider,
-                                                               WebKitDOMHTMLInputElement     *element);
-gboolean     goa_oauth2_provider_is_password_node             (GoaOAuth2Provider             *provider,
-                                                               WebKitDOMHTMLInputElement     *element);
 gchar       *goa_oauth2_provider_get_access_token_sync        (GoaOAuth2Provider        *provider,
                                                                GoaObject                *object,
                                                                gboolean                 force_refresh,
@@ -163,8 +71,6 @@ gboolean     goa_oauth2_provider_process_redirect_url         (GoaOAuth2Provider
                                                                const gchar                   *redirect_url,
                                                                gchar                        
**authorization_code,
                                                                GError                       **error);
-gboolean     goa_oauth2_provider_decide_navigation_policy     (GoaOAuth2Provider              *provider,
-                                                               WebKitNavigationPolicyDecision *decision);
 
 G_END_DECLS
 
diff --git a/src/goabackend/goapocketprovider.c b/src/goabackend/goapocketprovider.c
index 193f89f..03da1f8 100644
--- a/src/goabackend/goapocketprovider.c
+++ b/src/goabackend/goapocketprovider.c
@@ -26,6 +26,7 @@
 #include "goaprovider.h"
 #include "goaprovider-priv.h"
 #include "goaoauth2provider.h"
+#include "goaoauth2provider-priv.h"
 #include "goapocketprovider.h"
 #include "goaobjectskeletonutils.h"
 
diff --git a/src/goabackend/goawebextension.c b/src/goabackend/goawebextension.c
index 2bfcae8..7e8d6c1 100644
--- a/src/goabackend/goawebextension.c
+++ b/src/goabackend/goawebextension.c
@@ -23,6 +23,7 @@
 
 #include "goaoauthprovider.h"
 #include "goaoauth2provider.h"
+#include "goaoauth2provider-web-extension.h"
 #include "goaprovider.h"
 #include "goawebextension.h"
 
diff --git a/src/goabackend/goawindowsliveprovider.c b/src/goabackend/goawindowsliveprovider.c
index 1b25793..94d7a02 100644
--- a/src/goabackend/goawindowsliveprovider.c
+++ b/src/goabackend/goawindowsliveprovider.c
@@ -26,6 +26,7 @@
 #include "goaprovider.h"
 #include "goaprovider-priv.h"
 #include "goaoauth2provider.h"
+#include "goaoauth2provider-priv.h"
 #include "goawindowsliveprovider.h"
 #include "goaobjectskeletonutils.h"
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]