diff options
author | Xan Lopez <xan@gnome.org> | 2007-07-28 04:27:56 +0800 |
---|---|---|
committer | Xan Lopez <xan@src.gnome.org> | 2007-07-28 04:27:56 +0800 |
commit | c75bf8633191306efc4120fd589d0c375f286e71 (patch) | |
tree | e573b99549ca95c38ef67c9dd5d53829cb545a30 /embed/webkit | |
parent | ec7067fd30fe1bd5d0b69a648359d8085328f398 (diff) | |
download | gsoc2013-epiphany-c75bf8633191306efc4120fd589d0c375f286e71.tar gsoc2013-epiphany-c75bf8633191306efc4120fd589d0c375f286e71.tar.gz gsoc2013-epiphany-c75bf8633191306efc4120fd589d0c375f286e71.tar.bz2 gsoc2013-epiphany-c75bf8633191306efc4120fd589d0c375f286e71.tar.lz gsoc2013-epiphany-c75bf8633191306efc4120fd589d0c375f286e71.tar.xz gsoc2013-epiphany-c75bf8633191306efc4120fd589d0c375f286e71.tar.zst gsoc2013-epiphany-c75bf8633191306efc4120fd589d0c375f286e71.zip |
Add support for the WebKit engine, compile with --with-engine=webkit to
2007-07-27 Xan Lopez <xan@gnome.org>
* Makefile.am:
* configure.ac:
* doc/reference/Makefile.am:
* embed/Makefile.am:
* embed/ephy-embed-factory.c: (ephy_embed_factory_new_object):
* embed/ephy-embed-persist.c:
* embed/ephy-embed-shell.c:
* embed/ephy-embed.c:
* embed/webkit/Makefile.am:
* embed/webkit/webkit-embed-find.cpp:
* embed/webkit/webkit-embed-find.h:
* embed/webkit/webkit-embed-persist.cpp:
* embed/webkit/webkit-embed-persist.h:
* embed/webkit/webkit-embed-single.cpp:
* embed/webkit/webkit-embed-single.h:
* embed/webkit/webkit-embed.cpp:
* embed/webkit/webkit-embed.h:
* src/Makefile.am:
Add support for the WebKit engine, compile with
--with-engine=webkit to activate.
* embed/mozilla/mozilla-embed-single.cpp:
Move to the G_DEFINE_TYPE_WITH_CODE macro.
svn path=/trunk/; revision=7208
Diffstat (limited to 'embed/webkit')
-rw-r--r-- | embed/webkit/Makefile.am | 23 | ||||
-rw-r--r-- | embed/webkit/webkit-embed-find.cpp | 105 | ||||
-rw-r--r-- | embed/webkit/webkit-embed-find.h | 57 | ||||
-rw-r--r-- | embed/webkit/webkit-embed-persist.cpp | 89 | ||||
-rw-r--r-- | embed/webkit/webkit-embed-persist.h | 60 | ||||
-rw-r--r-- | embed/webkit/webkit-embed-single.cpp | 342 | ||||
-rw-r--r-- | embed/webkit/webkit-embed-single.h | 57 | ||||
-rw-r--r-- | embed/webkit/webkit-embed.cpp | 441 | ||||
-rw-r--r-- | embed/webkit/webkit-embed.h | 59 |
9 files changed, 1233 insertions, 0 deletions
diff --git a/embed/webkit/Makefile.am b/embed/webkit/Makefile.am new file mode 100644 index 000000000..41d6fb98a --- /dev/null +++ b/embed/webkit/Makefile.am @@ -0,0 +1,23 @@ +noinst_LTLIBRARIES = libephywebkitembed.la + +libephywebkitembed_la_SOURCES = \ + webkit-embed.cpp \ + webkit-embed.h \ + webkit-embed-find.cpp \ + webkit-embed-find.h \ + webkit-embed-persist.cpp \ + webkit-embed-persist.h \ + webkit-embed-single.cpp \ + webkit-embed-single.h + +libephywebkitembed_la_CPPFLAGS = \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/embed \ + -I$(top_srcdir) \ + $(WEBKIT_CFLAGS) \ + -DSHARE_DIR=\"$(pkgdatadir)\" \ + -DBUILDING_GDK__=1 \ + -DBUILDING_CAIRO__=1 \ + $(DEPENDENCIES_CFLAGS) \ + $(AM_CPPFLAGS) + diff --git a/embed/webkit/webkit-embed-find.cpp b/embed/webkit/webkit-embed-find.cpp new file mode 100644 index 000000000..f38b0125e --- /dev/null +++ b/embed/webkit/webkit-embed-find.cpp @@ -0,0 +1,105 @@ +/* + * Copyright © 2000-2004 Marco Pesenti Gritti + * Copyright © 2003, 2004 Christian Persch + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#include "config.h" + +#include "ephy-debug.h" +#include "ephy-embed-find.h" +#include "ephy-embed-shell.h" + +#include "webkit-embed-find.h" + +#define WEBKIT_EMBED_FIND_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), WEBKIT_TYPE_EMBED_FIND, WebkitEmbedFindPrivate)) + +struct _WebkitEmbedFindPrivate +{ + +}; + +static void +impl_set_embed (EphyEmbedFind *efind, + EphyEmbed *embed) +{ +} + +static void +impl_set_properties (EphyEmbedFind *efind, + const char *find_string, + gboolean case_sensitive) +{ +} + +static EphyEmbedFindResult +impl_find (EphyEmbedFind *efind, + const char *find_string, + gboolean links_only) +{ + return EPHY_EMBED_FIND_FOUND; +} + +static EphyEmbedFindResult +impl_find_again (EphyEmbedFind *efind, + gboolean forward, + gboolean links_only) +{ + return EPHY_EMBED_FIND_FOUND; +} + +static void +impl_set_selection (EphyEmbedFind *efind, + gboolean attention) +{ +} + +static gboolean +impl_activate_link (EphyEmbedFind *efind, + GdkModifierType mask) +{ + return FALSE; +} + +static void +ephy_find_iface_init (EphyEmbedFindIface *iface) +{ + iface->set_embed = impl_set_embed; + iface->set_properties = impl_set_properties; + iface->find = impl_find; + iface->find_again = impl_find_again; + iface->set_selection = impl_set_selection; + iface->activate_link = impl_activate_link; +} + +static void +webkit_embed_find_init (WebkitEmbedFind *find) +{ +} + +static void +webkit_embed_find_class_init (WebkitEmbedFindClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + g_type_class_add_private (object_class, sizeof (WebkitEmbedFindPrivate)); +} + +G_DEFINE_TYPE_WITH_CODE (WebkitEmbedFind, webkit_embed_find, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (EPHY_TYPE_EMBED_FIND, + ephy_find_iface_init)) diff --git a/embed/webkit/webkit-embed-find.h b/embed/webkit/webkit-embed-find.h new file mode 100644 index 000000000..2999890dd --- /dev/null +++ b/embed/webkit/webkit-embed-find.h @@ -0,0 +1,57 @@ +/* + * Copyright © 2000-2004 Marco Pesenti Gritti + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#ifndef WEBKIT_EMBED_FIND_H +#define WEBKIT_EMBED_FIND_H + +#include <glib.h> +#include <glib-object.h> + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_EMBED_FIND (webkit_embed_find_get_type ()) +#define WEBKIT_EMBED_FIND(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), WEBKIT_TYPE_EMBED_FIND, WebkitEmbedFind)) +#define WEBKIT_EMBED_FIND_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), WEBKIT_TYPE_EMBED_FIND, WebkitEmbedFindClass)) +#define WEBKIT_IS_EMBED_FIND(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), WEBKIT_TYPE_EMBED_FIND)) +#define WEBKIT_IS_EMBED_FIND_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), WEBKIT_TYPE_EMBED_FIND)) +#define WEBKIT_EMBED_FIND_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), WEBKIT_TYPE_EMBED_FIND, WebkitEmbedFindClass)) + +typedef struct _WebkitEmbedFindClass WebkitEmbedFindClass; +typedef struct _WebkitEmbedFind WebkitEmbedFind; +typedef struct _WebkitEmbedFindPrivate WebkitEmbedFindPrivate; + +struct _WebkitEmbedFind +{ + GObject parent_instance; + + /*< private >*/ + WebkitEmbedFindPrivate *priv; +}; + +struct _WebkitEmbedFindClass +{ + GObjectClass parent_class; +}; + +GType webkit_embed_find_get_type (void); + +G_END_DECLS + +#endif diff --git a/embed/webkit/webkit-embed-persist.cpp b/embed/webkit/webkit-embed-persist.cpp new file mode 100644 index 000000000..98093f5a0 --- /dev/null +++ b/embed/webkit/webkit-embed-persist.cpp @@ -0,0 +1,89 @@ +/* + * Copyright © 2007 Xan Lopez <xan@gnome.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#include "webkit-embed-persist.h" + +static void +webkit_embed_persist_class_init (WebkitEmbedPersistClass *klass); +static void +webkit_embed_persist_init (WebkitEmbedPersist *ges); +static void +webkit_embed_persist_finalize (GObject *object); + +#define WEBKIT_EMBED_PERSIST_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), WEBKIT_TYPE_EMBED_PERSIST, WebkitEmbedPersistPrivate)) + +G_DEFINE_TYPE (WebkitEmbedPersist, webkit_embed_persist, EPHY_TYPE_EMBED_PERSIST) + +static void +webkit_embed_persist_init (WebkitEmbedPersist *persist) +{ +} + +static void +webkit_embed_persist_finalize (GObject *object) +{ + G_OBJECT_CLASS (webkit_embed_persist_parent_class)->finalize (object); +} + +void +webkit_embed_persist_completed (WebkitEmbedPersist *persist) +{ + g_signal_emit_by_name (persist, "completed"); + g_object_unref (persist); +} + +void +webkit_embed_persist_cancelled (WebkitEmbedPersist *persist) +{ + g_signal_emit_by_name (persist, "cancelled"); + g_object_unref (persist); +} + +static void +impl_cancel (EphyEmbedPersist *persist) +{ + g_object_unref (persist); +} + +static gboolean +impl_save (EphyEmbedPersist *persist) +{ + g_object_ref (persist); +} + +static char * +impl_to_string (EphyEmbedPersist *persist) +{ +} + +static void +webkit_embed_persist_class_init (WebkitEmbedPersistClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + EphyEmbedPersistClass *persist_class = EPHY_EMBED_PERSIST_CLASS (klass); + + object_class->finalize = webkit_embed_persist_finalize; + + persist_class->save = impl_save; + persist_class->cancel = impl_cancel; + persist_class->to_string = impl_to_string; + + // g_type_class_add_private (object_class, sizeof(WebkitEmbedPersistPrivate)); +} diff --git a/embed/webkit/webkit-embed-persist.h b/embed/webkit/webkit-embed-persist.h new file mode 100644 index 000000000..b1728fb1d --- /dev/null +++ b/embed/webkit/webkit-embed-persist.h @@ -0,0 +1,60 @@ +/* + * Copyright © 2007 Xan Lopez <xan@gnome.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#ifndef WEBKIT_EMBED_PERSIST_H +#define WEBKIT_EMBED_PERSIST_H + +#include <glib.h> +#include <glib-object.h> + +#include "ephy-embed-persist.h" + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_EMBED_PERSIST (webkit_embed_persist_get_type ()) +#define WEBKIT_EMBED_PERSIST(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), WEBKIT_TYPE_EMBED_PERSIST, WebkitEmbedPersist)) +#define WEBKIT_EMBED_PERSIST_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), WEBKIT_TYPE_EMBED_PERSIST, WebkitEmbedPersistClass)) +#define WEBKIT_IS_EMBED_PERSIST(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), WEBKIT_TYPE_EMBED_PERSIST)) +#define WEBKIT_IS_EMBED_PERSIST_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), WEBKIT_TYPE_EMBED_PERSIST)) +#define WEBKIT_EMBED_PERSIST_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), WEBKIT_TYPE_EMBED_PERSIST, WebkitEmbedPersistClass)) + +typedef struct WebkitEmbedPersistClass WebkitEmbedPersistClass; +typedef struct WebkitEmbedPersist WebkitEmbedPersist; +typedef struct WebkitEmbedPersistPrivate WebkitEmbedPersistPrivate; + +struct WebkitEmbedPersist +{ + EphyEmbedPersist parent; +}; + +struct WebkitEmbedPersistClass +{ + EphyEmbedPersistClass parent_class; +}; + +GType webkit_embed_persist_get_type (void); + +void webkit_embed_persist_completed (WebkitEmbedPersist *persist); + +void webkit_embed_persist_cancelled (WebkitEmbedPersist *persist); + +G_END_DECLS + +#endif diff --git a/embed/webkit/webkit-embed-single.cpp b/embed/webkit/webkit-embed-single.cpp new file mode 100644 index 000000000..12491776a --- /dev/null +++ b/embed/webkit/webkit-embed-single.cpp @@ -0,0 +1,342 @@ +/* Copyright © 2007 Xan Lopez <xan@gnome.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#include "config.h" + +#include <glib/gi18n.h> +#include <libgnomevfs/gnome-vfs-utils.h> + +#include "webkit-embed-single.h" +#include "ephy-embed-single.h" +#include "ephy-cookie-manager.h" +#include "ephy-password-manager.h" +#include "ephy-permission-manager.h" + +#ifdef ENABLE_CERTIFICATE_MANAGER +#include "ephy-certificate-manager.h" +#endif + +#define WEBKIT_EMBED_SINGLE_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), WEBKIT_TYPE_EMBED_SINGLE, WebkitEmbedSinglePrivate)) + +struct WebkitEmbedSinglePrivate +{ + guint online : 1; +}; + +enum +{ + PROP_0, + PROP_NETWORK_STATUS +}; + +static void webkit_embed_single_class_init (WebkitEmbedSingleClass *klass); +static void webkit_embed_single_init (WebkitEmbedSingle *ges); +static void ephy_embed_single_iface_init (EphyEmbedSingleIface *iface); +static void ephy_cookie_manager_iface_init (EphyCookieManagerIface *iface); +static void ephy_password_manager_iface_init (EphyPasswordManagerIface *iface); +static void ephy_permission_manager_iface_init (EphyPermissionManagerIface *iface); + +#ifdef ENABLE_CERTIFICATE_MANAGER +static void ephy_certificate_manager_iface_init (EphyCertificateManagerIface *iface); +#endif + + +G_DEFINE_TYPE_WITH_CODE (WebkitEmbedSingle, webkit_embed_single, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (EPHY_TYPE_EMBED_SINGLE, + ephy_embed_single_iface_init) + G_IMPLEMENT_INTERFACE (EPHY_TYPE_COOKIE_MANAGER, + ephy_cookie_manager_iface_init) + G_IMPLEMENT_INTERFACE (EPHY_TYPE_PASSWORD_MANAGER, + ephy_password_manager_iface_init) +#ifdef ENABLE_CERTIFICATE_MANAGER + G_IMPLEMENT_INTERFACE (EPHY_TYPE_CERTIFICATE_MANAGER, + ephy_certificate_manager_iface_init) +#endif + G_IMPLEMENT_INTERFACE (EPHY_TYPE_PERMISSION_MANAGER, + ephy_permission_manager_iface_init)) + + +static void +webkit_embed_single_init (WebkitEmbedSingle *mes) +{ + mes->priv = WEBKIT_EMBED_SINGLE_GET_PRIVATE (mes); +} + +static void +webkit_embed_single_dispose (GObject *object) +{ + G_OBJECT_CLASS (webkit_embed_single_parent_class)->dispose (object); +} + +static void +webkit_embed_single_finalize (GObject *object) +{ + G_OBJECT_CLASS (webkit_embed_single_parent_class)->finalize (object); +} + +static void +impl_clear_cache (EphyEmbedSingle *shell) +{ +} + +static void +impl_clear_auth_cache (EphyEmbedSingle *shell) +{ +} + +static void +impl_set_network_status (EphyEmbedSingle *single, + gboolean online) +{ +} + +static gboolean +impl_get_network_status (EphyEmbedSingle *esingle) +{ + return FALSE; +} + +static const char* +impl_get_backend_name (EphyEmbedSingle *esingle) +{ + /* If you alter the return values here, remember to update + * the docs in ephy-embed-single.c */ + return "webkit"; +} + +static GList * +impl_get_font_list (EphyEmbedSingle *shell, + const char *langGroup) +{ + return NULL; +} + +static GList * +impl_list_cookies (EphyCookieManager *manager) +{ + return NULL; +} + +static void +impl_remove_cookie (EphyCookieManager *manager, + const EphyCookie *cookie) +{ +} + +static void +impl_clear_cookies (EphyCookieManager *manager) +{ +} + +static GList * +impl_list_passwords (EphyPasswordManager *manager) +{ + return NULL; +} + +static void +impl_remove_password (EphyPasswordManager *manager, + EphyPasswordInfo *info) +{ +} + +static void +impl_add_password (EphyPasswordManager *manager, + EphyPasswordInfo *info) +{ +} + +static void +impl_permission_manager_add (EphyPermissionManager *manager, + const char *host, + const char *type, + EphyPermission permission) +{ +} + +static void +impl_permission_manager_remove (EphyPermissionManager *manager, + const char *host, + const char *type) +{ +} + +static void +impl_permission_manager_clear (EphyPermissionManager *manager) +{ +} + +EphyPermission +impl_permission_manager_test (EphyPermissionManager *manager, + const char *host, + const char *type) +{ + g_return_val_if_fail (type != NULL && type[0] != '\0', EPHY_PERMISSION_DEFAULT); + + return (EphyPermission)0; +} + +static gboolean +impl_init (EphyEmbedSingle *esingle) +{ + return TRUE; +} + +GList * +impl_permission_manager_list (EphyPermissionManager *manager, + const char *type) +{ + GList *list = NULL; + return list; +} + +static GtkWidget * +impl_open_window (EphyEmbedSingle *single, + EphyEmbed *parent, + const char *address, + const char *name, + const char *features) +{ + return NULL; +} + +#ifdef ENABLE_CERTIFICATE_MANAGER + +static gboolean +impl_remove_certificate (EphyCertificateManager *manager, + EphyX509Cert *cert) +{ + return TRUE; +} + +#define NICK_DELIMITER PRUnichar('\001') +static GList * +impl_get_certificates (EphyCertificateManager *manager, + EphyX509CertType type) +{ + return NULL; +} + +static gboolean +impl_import (EphyCertificateManager *manager, + const gchar *file) +{ + return TRUE; +} + +#endif /* ENABLE_CERTIFICATE_MANAGER */ + +static void +webkit_embed_single_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + EphyEmbedSingle *single = EPHY_EMBED_SINGLE (object); + + switch (prop_id) + { + case PROP_NETWORK_STATUS: + g_value_set_boolean (value, ephy_embed_single_get_network_status (single)); + break; + } +} + +static void +webkit_embed_single_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + EphyEmbedSingle *single = EPHY_EMBED_SINGLE (object); + + switch (prop_id) + { + case PROP_NETWORK_STATUS: + ephy_embed_single_set_network_status (single, g_value_get_boolean (value)); + break; + } +} +static void +webkit_embed_single_class_init (WebkitEmbedSingleClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + webkit_embed_single_parent_class = (GObjectClass *) g_type_class_peek_parent (klass); + + object_class->dispose = webkit_embed_single_dispose; + object_class->finalize = webkit_embed_single_finalize; + object_class->get_property = webkit_embed_single_get_property; + object_class->set_property = webkit_embed_single_set_property; + + g_object_class_override_property (object_class, PROP_NETWORK_STATUS, "network-status"); + + g_type_class_add_private (object_class, sizeof (WebkitEmbedSinglePrivate)); +} + +static void +ephy_embed_single_iface_init (EphyEmbedSingleIface *iface) +{ + iface->init = impl_init; + iface->clear_cache = impl_clear_cache; + iface->clear_auth_cache = impl_clear_auth_cache; + iface->set_network_status = impl_set_network_status; + iface->get_network_status = impl_get_network_status; + iface->get_font_list = impl_get_font_list; + iface->open_window = impl_open_window; + iface->get_backend_name = impl_get_backend_name; +} + +static void +ephy_cookie_manager_iface_init (EphyCookieManagerIface *iface) +{ + iface->list = impl_list_cookies; + iface->remove = impl_remove_cookie; + iface->clear = impl_clear_cookies; +} + +static void +ephy_password_manager_iface_init (EphyPasswordManagerIface *iface) +{ + iface->add = impl_add_password; + iface->remove = impl_remove_password; + iface->list = impl_list_passwords; +} + +static void +ephy_permission_manager_iface_init (EphyPermissionManagerIface *iface) +{ + iface->add = impl_permission_manager_add; + iface->remove = impl_permission_manager_remove; + iface->clear = impl_permission_manager_clear; + iface->test = impl_permission_manager_test; + iface->list = impl_permission_manager_list; +} + +#ifdef ENABLE_CERTIFICATE_MANAGER + +static void +ephy_certificate_manager_iface_init (EphyCertificateManagerIface *iface) +{ + iface->get_certificates = impl_get_certificates; + iface->remove_certificate = impl_remove_certificate; + iface->import = impl_import; +} + +#endif /* ENABLE_CERTIFICATE_MANAGER */ diff --git a/embed/webkit/webkit-embed-single.h b/embed/webkit/webkit-embed-single.h new file mode 100644 index 000000000..5dcaf2444 --- /dev/null +++ b/embed/webkit/webkit-embed-single.h @@ -0,0 +1,57 @@ +/* + * Copyright © 2000-2003 Marco Pesenti Gritti + * Copyright © 2003 Christian Persch + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#ifndef WEBKIT_EMBED_SINGLE_H +#define WEBKIT_EMBED_SINGLE_H + +#include <glib-object.h> + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_EMBED_SINGLE (webkit_embed_single_get_type ()) +#define WEBKIT_EMBED_SINGLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), WEBKIT_TYPE_EMBED_SINGLE, WebkitEmbedSingle)) +#define WEBKIT_EMBED_SINGLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), WEBKIT_TYPE_EMBED_SINGLE, WebkitEmbedSingleClass)) +#define WEBKIT_IS_EMBED_SINGLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), WEBKIT_TYPE_EMBED_SINGLE)) +#define WEBKIT_IS_EMBED_SINGLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), WEBKIT_TYPE_EMBED_SINGLE)) +#define WEBKIT_EMBED_SINGLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), WEBKIT_TYPE_EMBED_SINGLE, WebkitEmbedSingleClass)) + +typedef struct WebkitEmbedSingle WebkitEmbedSingle; +typedef struct WebkitEmbedSingleClass WebkitEmbedSingleClass; +typedef struct WebkitEmbedSinglePrivate WebkitEmbedSinglePrivate; + +struct WebkitEmbedSingle +{ + GObject parent; + + /*< private >*/ + WebkitEmbedSinglePrivate *priv; +}; + +struct WebkitEmbedSingleClass +{ + GObjectClass parent_class; +}; + +GType webkit_embed_single_get_type (void); + +G_END_DECLS + +#endif diff --git a/embed/webkit/webkit-embed.cpp b/embed/webkit/webkit-embed.cpp new file mode 100644 index 000000000..009706b3e --- /dev/null +++ b/embed/webkit/webkit-embed.cpp @@ -0,0 +1,441 @@ +/* + * Copyright © 2007 Xan Lopez + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#include "config.h" + +#include "ephy-command-manager.h" +#include "ephy-debug.h" +#include "ephy-embed-shell.h" +#include "ephy-embed-single.h" +#include "ephy-string.h" +#include "ephy-embed-event.h" + +#include <webkitgtkpage.h> +#include <webkitgtkglobal.h> +#include <string.h> + +#include "webkit-embed.h" +#include "ephy-embed.h" + +static void webkit_embed_class_init (WebkitEmbedClass *klass); +static void webkit_embed_init (WebkitEmbed *gs); +static void webkit_embed_destroy (GtkObject *object); +static void webkit_embed_finalize (GObject *object); +static void ephy_embed_iface_init (EphyEmbedIface *iface); + +#if 0 +static void webkit_embed_location_changed_cb (GtkMozEmbed *embed, + WebkitEmbed *membed); +static void webkit_embed_net_state_all_cb (GtkMozEmbed *embed, + const char *aURI, + gint state, + guint status, + WebkitEmbed *membed); +static gboolean webkit_embed_dom_mouse_click_cb(GtkMozEmbed *embed, + gpointer dom_event, + WebkitEmbed *membed); +static gboolean webkit_embed_dom_mouse_down_cb (GtkMozEmbed *embed, + + + WebkitEmbed *membed); +static gboolean webkit_embed_dom_key_press_cb (GtkMozEmbed *embed, + gpointer dom_event, + WebkitEmbed *membed); +static void webkit_embed_new_window_cb (GtkMozEmbed *embed, + GtkMozEmbed **newEmbed, + guint chrome_mask, + WebkitEmbed *membed); +#endif + +#define WEBKIT_EMBED_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), WEBKIT_TYPE_EMBED, WebkitEmbedPrivate)) + +typedef enum + { + WEBKIT_EMBED_LOAD_STARTED, + WEBKIT_EMBED_LOAD_REDIRECTING, + WEBKIT_EMBED_LOAD_LOADING, + WEBKIT_EMBED_LOAD_STOPPED + } WebkitEmbedLoadState; + +struct WebkitEmbedPrivate +{ + WebKitGtkPage *page; + WebkitEmbedLoadState load_state; +}; + +static void +impl_manager_do_command (EphyCommandManager *manager, + const char *command) +{ +} + +static gboolean +impl_manager_can_do_command (EphyCommandManager *manager, + const char *command) +{ +} + +static void +ephy_command_manager_iface_init (EphyCommandManagerIface *iface) +{ + iface->do_command = impl_manager_do_command; + iface->can_do_command = impl_manager_can_do_command; +} + +G_DEFINE_TYPE_WITH_CODE (WebkitEmbed, webkit_embed, GTK_TYPE_SCROLLED_WINDOW, + G_IMPLEMENT_INTERFACE (EPHY_TYPE_EMBED, + ephy_embed_iface_init) + G_IMPLEMENT_INTERFACE (EPHY_TYPE_COMMAND_MANAGER, + ephy_command_manager_iface_init)) + +static void +webkit_embed_grab_focus (GtkWidget *widget) +{ +} + +static void +impl_close (EphyEmbed *embed) +{ +} + +static void +webkit_embed_class_init (WebkitEmbedClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + webkit_embed_parent_class = (GObjectClass *) g_type_class_peek_parent (klass); + + object_class->finalize = webkit_embed_finalize; + + gtk_object_class->destroy = webkit_embed_destroy; + + widget_class->grab_focus = webkit_embed_grab_focus; + + g_type_class_add_private (object_class, sizeof(WebkitEmbedPrivate)); +} + +static void +webkit_embed_init (WebkitEmbed *embed) +{ + WebKitGtkPage *page; + + embed->priv = WEBKIT_EMBED_GET_PRIVATE (embed); + + gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (embed), NULL); + gtk_scrolled_window_set_hadjustment (GTK_SCROLLED_WINDOW (embed), NULL); + + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (embed), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + webkit_gtk_init (); + page = WEBKIT_GTK_PAGE (webkit_gtk_page_new ()); + embed->priv->page = page; + gtk_container_add (GTK_CONTAINER (embed), GTK_WIDGET (page)); + gtk_widget_show (GTK_WIDGET (page)); + +#if 0 + g_signal_connect (G_OBJECT (page), "title-changed", + G_CALLBACK (title_changed_cb), page); + g_signal_connect (G_OBJECT (page), "load-progress-changed", + G_CALLBACK (load_progress_changed), page); +#endif +} + +static void +webkit_embed_destroy (GtkObject *object) +{ + GTK_OBJECT_CLASS (webkit_embed_parent_class)->destroy (object); +} + +static void +webkit_embed_finalize (GObject *object) +{ + G_OBJECT_CLASS (webkit_embed_parent_class)->finalize (object); +} + +static void +impl_load_url (EphyEmbed *embed, + const char *url) +{ + WebkitEmbed *wembed = WEBKIT_EMBED (embed); + + g_debug ("a url %s", url); + + webkit_gtk_page_open (wembed->priv->page, url); +} + +static char * impl_get_location (EphyEmbed *embed, gboolean toplevel); + +static void +impl_load (EphyEmbed *embed, + const char *url, + EphyEmbedLoadFlags flags, + EphyEmbed *preview_embed) +{ + WebkitEmbed *wembed = WEBKIT_EMBED (embed); + + g_debug ("url %s", url); + webkit_gtk_page_open (wembed->priv->page, url); +} + +static void +impl_stop_load (EphyEmbed *embed) +{ +} + +static gboolean +impl_can_go_back (EphyEmbed *embed) +{ + return FALSE; +} + +static gboolean +impl_can_go_forward (EphyEmbed *embed) +{ + return FALSE; +} + +static GSList * +impl_get_go_up_list (EphyEmbed *embed) +{ + return NULL; +} + +static void +impl_go_back (EphyEmbed *embed) +{ + WebkitEmbed *wembed = WEBKIT_EMBED (embed); + + webkit_gtk_page_go_backward (wembed->priv->page); +} + +static void +impl_go_forward (EphyEmbed *embed) +{ + WebkitEmbed *wembed = WEBKIT_EMBED (embed); + + webkit_gtk_page_go_forward (wembed->priv->page); +} + +static void +impl_go_up (EphyEmbed *embed) +{ +} + +static char * +impl_get_title (EphyEmbed *embed) +{ + return NULL; +} + +static char * +impl_get_link_message (EphyEmbed *embed) +{ + return NULL; +} + +static char * +impl_get_js_status (EphyEmbed *embed) +{ + return NULL; +} + +static char * +impl_get_location (EphyEmbed *embed, + gboolean toplevel) +{ + return NULL; +} + +static void +impl_reload (EphyEmbed *embed, + gboolean force) +{ +} + +static void +impl_set_zoom (EphyEmbed *embed, + float zoom) +{ +} + +static float +impl_get_zoom (EphyEmbed *embed) +{ + return 0.0; +} + +static void +impl_scroll_lines (EphyEmbed *embed, + int num_lines) +{ +} + +static void +impl_scroll_pages (EphyEmbed *embed, + int num_pages) +{ +} + +static void +impl_scroll_pixels (EphyEmbed *embed, + int dx, + int dy) +{ +} + +static int +impl_shistory_n_items (EphyEmbed *embed) +{ + return 0; +} + +static void +impl_shistory_get_nth (EphyEmbed *embed, + int nth, + gboolean is_relative, + char **aUrl, + char **aTitle) +{ + *aUrl = NULL; + *aTitle = NULL; +} + +static int +impl_shistory_get_pos (EphyEmbed *embed) +{ + return 0; +} + +static void +impl_shistory_go_nth (EphyEmbed *embed, + int nth) +{ +} + +static void +impl_shistory_copy (EphyEmbed *source, + EphyEmbed *dest, + gboolean copy_back, + gboolean copy_forward, + gboolean copy_current) +{ +} + +static void +impl_get_security_level (EphyEmbed *embed, + EphyEmbedSecurityLevel *level, + char **description) +{ + if (level) *level = EPHY_EMBED_STATE_IS_UNKNOWN; +} + +static void +impl_show_page_certificate (EphyEmbed *embed) +{ +} + +static void +impl_print (EphyEmbed *embed) +{ +} + +static void +impl_set_print_preview_mode (EphyEmbed *embed, gboolean preview_mode) +{ +} + +static int +impl_print_preview_n_pages (EphyEmbed *embed) +{ + return 0; +} + +static void +impl_print_preview_navigate (EphyEmbed *embed, + EphyEmbedPrintPreviewNavType type, + int page) +{ +} + +static void +impl_set_encoding (EphyEmbed *embed, + const char *encoding) +{ +} + +static char * +impl_get_encoding (EphyEmbed *embed) +{ + return NULL; +} + +static gboolean +impl_has_automatic_encoding (EphyEmbed *embed) +{ + return FALSE; +} + +static gboolean +impl_has_modified_forms (EphyEmbed *embed) +{ +} + +static void +ephy_embed_iface_init (EphyEmbedIface *iface) +{ + iface->load_url = impl_load_url; + iface->load = impl_load; + iface->stop_load = impl_stop_load; + iface->can_go_back = impl_can_go_back; + iface->can_go_forward = impl_can_go_forward; + // iface->can_go_up = impl_can_go_up; + iface->get_go_up_list = impl_get_go_up_list; + iface->go_back = impl_go_back; + iface->go_forward = impl_go_forward; + iface->go_up = impl_go_up; + iface->get_title = impl_get_title; + iface->get_location = impl_get_location; + iface->get_link_message = impl_get_link_message; + iface->get_js_status = impl_get_js_status; + iface->reload = impl_reload; + iface->set_zoom = impl_set_zoom; + iface->get_zoom = impl_get_zoom; + iface->scroll_lines = impl_scroll_lines; + iface->scroll_pages = impl_scroll_pages; + iface->scroll_pixels = impl_scroll_pixels; + iface->shistory_n_items = impl_shistory_n_items; + iface->shistory_get_nth = impl_shistory_get_nth; + iface->shistory_get_pos = impl_shistory_get_pos; + iface->shistory_go_nth = impl_shistory_go_nth; + iface->shistory_copy = impl_shistory_copy; + iface->get_security_level = impl_get_security_level; + iface->show_page_certificate = impl_show_page_certificate; + iface->close = impl_close; + iface->set_encoding = impl_set_encoding; + iface->get_encoding = impl_get_encoding; + iface->has_automatic_encoding = impl_has_automatic_encoding; + iface->print = impl_print; + iface->set_print_preview_mode = impl_set_print_preview_mode; + iface->print_preview_n_pages = impl_print_preview_n_pages; + iface->print_preview_navigate = impl_print_preview_navigate; + iface->has_modified_forms = impl_has_modified_forms; +} diff --git a/embed/webkit/webkit-embed.h b/embed/webkit/webkit-embed.h new file mode 100644 index 000000000..ee25bf444 --- /dev/null +++ b/embed/webkit/webkit-embed.h @@ -0,0 +1,59 @@ +/* + * Copyright © 2007 Xan Lopez + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#ifndef WEBKIT_EMBED_H +#define WEBKIT_EMBED_H + +#include <glib.h> +#include <glib-object.h> +#include <gtk/gtk.h> +#include "ephy-embed.h" + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_EMBED (webkit_embed_get_type ()) +#define WEBKIT_EMBED(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), WEBKIT_TYPE_EMBED, WebkitEmbed)) +#define WEBKIT_EMBED_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), WEBKIT_TYPE_EMBED, WebkitEmbedClass)) +#define WEBKIT_IS_EMBED(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), WEBKIT_TYPE_EMBED)) +#define WEBKIT_IS_EMBED_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), WEBKIT_TYPE_EMBED)) +#define WEBKIT_EMBED_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), WEBKIT_TYPE_EMBED, WebkitEmbedClass)) + +typedef struct WebkitEmbedClass WebkitEmbedClass; +typedef struct WebkitEmbed WebkitEmbed; +typedef struct WebkitEmbedPrivate WebkitEmbedPrivate; + +struct WebkitEmbed +{ + GtkScrolledWindow parent; + + /*< private >*/ + WebkitEmbedPrivate *priv; +}; + +struct WebkitEmbedClass +{ + GtkScrolledWindowClass parent_class; +}; + +GType webkit_embed_get_type (void); + +G_END_DECLS + +#endif |