[gnome-online-accounts: 2/7] oauth2: Split the WebKitDOM* symbols out of the main header
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts: 2/7] oauth2: Split the WebKitDOM* symbols out of the main header
- Date: Thu, 21 Jul 2016 18:19:05 +0000 (UTC)
commit 44ed2d6082b2216fb35850108d10ba8f4d0f40a5
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Jul 20 16:05:12 2016 +0200
oauth2: Split the WebKitDOM* symbols out of the main header
GoaOAuth2Provider is special in the sense that some of the virtual
functions are used from the WebKit web process (via the web extension),
while the rest of the code is used from the UI process. Now, one
cannot include webkit2.h and webkit-web-extension.h in the same
translation unit. However, this hasn't been an issue so far because
goaoauth2provider.h only has WebKitDOM* symbols from webkitdom.h, and
you can mix those with webkit2.h and webkit-web-extension.h.
In the subsequent commit we are planning to add a new virtual function
that will use symbols from webkit2.h. Due to the aforementioned
reasons, this will cause problems when trying to include
goaoauth2provider.h from the web extension.
To deal with this, we split the definition of the structs into a
goaoauth2provider-priv.h header, and the declaration of the methods
using WebKitDOM* into a goaoauth2provider-web-extension.h header. We
will similarly use a separate header for webkit2.h in future. Since
the GOAuth2Provider users don't need the structure definitions, they
can just use goaoauth2provider.h and whichever other header they need
depending on whether they are in the UI or web process.
https://bugzilla.gnome.org/show_bug.cgi?id=755386
src/goabackend/Makefile.am | 4 +-
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 | 118 ++++++++++++++++++++++
src/goabackend/goaoauth2provider-web-extension.h | 40 ++++++++
src/goabackend/goaoauth2provider.c | 2 +
src/goabackend/goaoauth2provider.h | 94 +-----------------
src/goabackend/goapocketprovider.c | 1 +
src/goabackend/goawebextension.c | 1 +
src/goabackend/goawindowsliveprovider.c | 1 +
12 files changed, 172 insertions(+), 93 deletions(-)
---
diff --git a/src/goabackend/Makefile.am b/src/goabackend/Makefile.am
index 81029b8..f4fbe5d 100644
--- a/src/goabackend/Makefile.am
+++ b/src/goabackend/Makefile.am
@@ -81,7 +81,9 @@ 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.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..898255b
--- /dev/null
+++ b/src/goabackend/goaoauth2provider-priv.h
@@ -0,0 +1,118 @@
+/* -*- 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 <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().
+ * @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 (*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.c b/src/goabackend/goaoauth2provider.c
index 7948ec4..5d94a96 100644
--- a/src/goabackend/goaoauth2provider.c
+++ b/src/goabackend/goaoauth2provider.c
@@ -29,6 +29,8 @@
#include "goautils.h"
#include "goawebview.h"
#include "goaoauth2provider.h"
+#include "goaoauth2provider-priv.h"
+#include "goaoauth2provider-web-extension.h"
/**
* SECTION:goaoauth2provider
diff --git a/src/goabackend/goaoauth2provider.h b/src/goabackend/goaoauth2provider.h
index a2a66e6..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,89 +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().
- * @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 (*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);
@@ -137,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,
diff --git a/src/goabackend/goapocketprovider.c b/src/goabackend/goapocketprovider.c
index 690ff34..54643c6 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]