[epiphany/webkit2: 1/17] Initial WebKit2 port



commit 1fe70daed8aa78dbd00f08a5335ed941f3ae3e7a
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Sun May 6 16:47:19 2012 +0200

    Initial WebKit2 port
    
    It builds and basic functionality works.

 configure.ac                          |   25 ++++-
 embed/Makefile.am                     |    4 +
 embed/ephy-download.c                 |   34 ++++++-
 embed/ephy-download.h                 |    4 +
 embed/ephy-embed-event.h              |    4 +
 embed/ephy-embed-prefs.c              |   64 ++++++++++++-
 embed/ephy-embed-single.c             |    9 ++-
 embed/ephy-embed-utils.h              |    5 +
 embed/ephy-embed.c                    |   74 +++++++++++++++
 embed/ephy-request-about.c            |    8 ++
 embed/ephy-web-view.c                 |  167 ++++++++++++++++++++++++++++++++-
 embed/ephy-web-view.h                 |    8 ++
 lib/ephy-web-app-utils.c              |    8 ++
 lib/widgets/ephy-download-widget.c    |   34 +++++++
 lib/widgets/ephy-hosts-store.c        |   32 ++++++
 lib/widgets/ephy-location-entry.c     |    4 +
 src/Makefile.am                       |    8 ++
 src/bookmarks/ephy-bookmark-action.c  |   12 +++
 src/bookmarks/ephy-bookmarks-editor.c |    8 ++
 src/bookmarks/ephy-bookmarks.c        |   17 +++-
 src/ephy-completion-model.c           |   12 +++
 src/ephy-encoding-dialog.c            |   17 ++++
 src/ephy-encoding-menu.c              |   17 ++++
 src/ephy-find-toolbar.c               |   26 +++++-
 src/ephy-history-window.c             |    4 +
 src/ephy-navigation-history-action.c  |   43 ++++++++-
 src/ephy-session.c                    |   20 ++++
 src/ephy-shell.c                      |   12 +++
 src/ephy-shell.h                      |    8 ++
 src/ephy-window.c                     |   53 +++++++++++
 src/pdm-dialog.c                      |   13 +++
 src/popup-commands.c                  |   16 +++
 src/window-commands.c                 |   66 ++++++++++++-
 tests/ephy-shell-test.c               |    4 +
 tests/ephy-web-view-test.c            |    8 ++
 35 files changed, 824 insertions(+), 24 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a1a9faf..83015e3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -90,6 +90,18 @@ GNOME_KEYRING_REQUIRED=2.26.0
 GSETTINGS_DESKTOP_SCHEMAS_REQUIRED=0.0.1
 LIBNOTIFY_REQUIRED=0.5.1
 
+AC_ARG_WITH(webkit2,
+        [AC_HELP_STRING([--with-webkit2], [build with WebKit2 [default=no]])],
+        [],[with_webkit2=no])
+
+if test "x$with_webkit2" != xno; then
+   WEBKIT_GTK_PC_NAME=webkit2gtk-3.0
+   AC_DEFINE([HAVE_WEBKIT2],[1],[Define if building with WebKit2])
+else
+   WEBKIT_GTK_PC_NAME=webkitgtk-3.0
+fi
+AM_CONDITIONAL(WITH_WEBKIT2, test "x$with_webkit2" != xno)
+
 # Tests
 
 AC_MSG_CHECKING([whether to build tests])
@@ -112,7 +124,7 @@ PKG_CHECK_MODULES([DEPENDENCIES], [
 		  sm
 		  libxml-2.0 >= $LIBXML_REQUIRED
 		  libxslt >= $LIBXSLT_REQUIRED
-		  webkitgtk-3.0 >= $WEBKIT_GTK_REQUIRED
+		  $WEBKIT_GTK_PC_NAME >= $WEBKIT_GTK_REQUIRED
 		  libsoup-gnome-2.4 >= $LIBSOUP_GNOME_REQUIRED
 		  gnome-keyring-1 >= $GNOME_KEYRING_REQUIRED
 		  gsettings-desktop-schemas >= $GSETTINGS_DESKTOP_SCHEMAS_REQUIRED
@@ -147,9 +159,13 @@ EPIPHANY_FEATURES=
 
 GOBJECT_INTROSPECTION_CHECK([0.9.5])
 
-if test "$found_introspection" = "yes"; then
-  EPIPHANY_FEATURES="$EPIPHANY_FEATURES introspection"
-  AC_DEFINE([ENABLE_INTROSPECTION], [1], [Define to enable introspection support])
+if test "$with_webkit2" = "no"; then
+   if test "$found_introspection" = "yes"; then
+      EPIPHANY_FEATURES="$EPIPHANY_FEATURES introspection"
+      AC_DEFINE([ENABLE_INTROSPECTION], [1], [Define to enable introspection support])
+   fi
+else
+   found_introspection=no
 fi
 
 # ****
@@ -350,4 +366,5 @@ Epiphany was configured with the following options:
  	Seed support               : $enable_seed
  	NSS support                : $enable_nss
 	Build tests		   : $enable_tests
+        WebKit2                    : $with_webkit2
 "
diff --git a/embed/Makefile.am b/embed/Makefile.am
index bf05190..ea7f3c2 100644
--- a/embed/Makefile.am
+++ b/embed/Makefile.am
@@ -62,6 +62,10 @@ libephyembed_la_CPPFLAGS = \
 	-I$(top_srcdir)/lib/widgets     \
 	$(AM_CPPFLAGS)
 
+if WITH_WEBKIT2
+libephyembed_la_CPPFLAGS += -DHAVE_WEBKIT2
+endif
+
 libephyembed_la_CFLAGS = \
 	-DSHARE_DIR=\"$(pkgdatadir)\"	\
 	$(DEPENDENCIES_CFLAGS) 	\
diff --git a/embed/ephy-download.c b/embed/ephy-download.c
index 85c03b2..a1821f2 100644
--- a/embed/ephy-download.c
+++ b/embed/ephy-download.c
@@ -36,7 +36,6 @@
 #include <errno.h>
 #include <glib/gi18n.h>
 #include <string.h>
-#include <webkit/webkit.h>
 
 G_DEFINE_TYPE (EphyDownload, ephy_download, G_TYPE_OBJECT)
 
@@ -153,6 +152,10 @@ ephy_download_set_property (GObject      *object,
 char *
 ephy_download_get_content_type (EphyDownload *download)
 {
+#ifdef HAVE_WEBKIT2
+  /* TODO: Downloads */
+  return NULL;
+#else
   WebKitNetworkResponse *response;
   SoupMessage *message;
   char *content_type = NULL;
@@ -192,6 +195,7 @@ ephy_download_get_content_type (EphyDownload *download)
   LOG ("ephy_download_get_content_type: %s", content_type);
 
   return content_type;
+#endif
 }
 
 
@@ -285,7 +289,12 @@ define_destination_uri (EphyDownload *download)
   char *destination_uri;
   const char *suggested_filename;
 
+#ifdef HAVE_WEBKIT2
+  /* TODO: Downloads */
+  suggested_filename = NULL;
+#else
   suggested_filename = webkit_download_get_suggested_filename (download->priv->download);
+#endif
   dest_dir = ephy_file_get_downloads_dir ();
 
   /* Make sure the download directory exists */
@@ -369,7 +378,11 @@ ephy_download_set_destination_uri (EphyDownload *download,
 
   priv->destination = g_strdup (destination);
 
+#ifdef HAVE_WEBKIT2
+  /* TODO: Downloads */
+#else
   webkit_download_set_destination_uri (priv->download, priv->destination);
+#endif
   g_object_notify (G_OBJECT (download), "destination");
 }
 
@@ -595,8 +608,11 @@ ephy_download_start (EphyDownload *download)
 
   if (priv->destination == NULL)
     ephy_download_set_auto_destination (download);
-
+#ifdef HAVE_WEBKIT2
+  /* TODO: Downloads */
+#else
   webkit_download_start (priv->download);
+#endif
 }
 
 /**
@@ -633,7 +649,9 @@ ephy_download_do_download_action (EphyDownload *download,
     const char *destination_uri;
     EphyDownloadPrivate *priv;
     gboolean ret = FALSE;
-
+#ifdef HAVE_WEBKIT2
+    /* TODO: Downloads */
+#else
     priv = download->priv;
 
     destination_uri = webkit_download_get_destination_uri (priv->download);
@@ -662,7 +680,7 @@ ephy_download_do_download_action (EphyDownload *download,
         break;
     }
     g_object_unref (destination);
-
+#endif
     return ret;
 }
 
@@ -880,6 +898,9 @@ ephy_download_init (EphyDownload *download)
   download->priv->widget = NULL;
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Downloads */
+#else
 static void
 download_status_changed_cb (GObject *object,
                             GParamSpec *pspec,
@@ -927,6 +948,7 @@ download_error_cb (WebKitDownload *download,
 
   return ret;
 }
+#endif
 
 /**
  * ephy_download_new:
@@ -949,6 +971,9 @@ _ephy_download_new (WebKitDownload *webkit_download, const char *uri)
   EphyDownload *ephy_download;
   ephy_download = ephy_download_new ();
 
+#ifdef HAVE_WEBKIT2
+  /* TODO: Downloads */
+#else
   if (webkit_download == NULL) {
     WebKitNetworkRequest *request;
 
@@ -968,6 +993,7 @@ _ephy_download_new (WebKitDownload *webkit_download, const char *uri)
 
   ephy_download->priv->download = g_object_ref (webkit_download);
   ephy_download->priv->source = g_strdup (webkit_download_get_uri (webkit_download));
+#endif
 
   return ephy_download;
 }
diff --git a/embed/ephy-download.h b/embed/ephy-download.h
index 466da40..34cbbca 100644
--- a/embed/ephy-download.h
+++ b/embed/ephy-download.h
@@ -30,7 +30,11 @@
 #define _EPHY_DOWNLOAD_H
 
 #include <glib-object.h>
+#ifdef HAVE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
 #include <webkit/webkit.h>
+#endif
 
 #include "ephy-embed.h"
 
diff --git a/embed/ephy-embed-event.h b/embed/ephy-embed-event.h
index 633104c..128c74a 100644
--- a/embed/ephy-embed-event.h
+++ b/embed/ephy-embed-event.h
@@ -29,7 +29,11 @@
 
 #include <glib-object.h>
 #include <glib.h>
+#ifdef HAVE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
 #include <webkit/webkit.h>
+#endif
 
 G_BEGIN_DECLS
 
diff --git a/embed/ephy-embed-prefs.c b/embed/ephy-embed-prefs.c
index e16c066..0666197 100644
--- a/embed/ephy-embed-prefs.c
+++ b/embed/ephy-embed-prefs.c
@@ -29,7 +29,11 @@
 #include "ephy-settings.h"
 
 #include <glib.h>
+#ifdef HAVE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
 #include <webkit/webkit.h>
+#endif
 
 typedef struct
 {
@@ -39,7 +43,11 @@ typedef struct
   void (*callback) (GSettings *settings, char *key, gpointer data);
 } PrefData;
 
+#ifdef HAVE_WEBKIT2
+/* TODO: WebKitSettings */
+#else
 static WebKitWebSettings *webkit_settings = NULL;
+#endif
 
 static void
 webkit_pref_callback_user_stylesheet (GSettings *settings,
@@ -60,8 +68,11 @@ webkit_pref_callback_user_stylesheet (GSettings *settings,
                        G_DIR_SEPARATOR_S,
                        USER_STYLESHEET_FILENAME,
                        NULL);
-
+#ifdef HAVE_WEBKIT2
+  /* TODO: WebKitSettings */
+#else
   g_object_set (webkit_settings, webkit_pref, uri, NULL);
+#endif
   g_free (uri);
 }
 
@@ -106,6 +117,10 @@ webkit_pref_get_internal_user_agent (void)
 
   g_key_file_free (branding_keyfile);
 
+#ifdef HAVE_WEBKIT2
+  /* TODO: User agent */
+  return g_strup ("");
+#else
   g_object_get (webkit_settings, "user-agent", &webkit_user_agent, NULL);
 
   user_agent = g_strconcat (webkit_user_agent, " ",
@@ -118,6 +133,7 @@ webkit_pref_get_internal_user_agent (void)
   g_free (webkit_user_agent);
 
   return user_agent;
+#endif
 }
 
 static void
@@ -125,6 +141,9 @@ webkit_pref_callback_user_agent (GSettings *settings,
                                  char *key,
                                  gpointer data)
 {
+#ifdef HAVE_WEBKIT2
+  /* TODO: User agent */
+#else
   char *value = NULL;
   static char *internal_user_agent = NULL;
   char *webkit_pref = data;
@@ -140,6 +159,7 @@ webkit_pref_callback_user_agent (GSettings *settings,
     g_object_set (webkit_settings, webkit_pref, value, NULL);
 
   g_free (value);
+#endif
 }
 
 static void
@@ -175,8 +195,11 @@ webkit_pref_callback_font_size (GSettings *settings,
       size /= PANGO_SCALE;
     pango_font_description_free (desc);
   }
-
+#ifdef HAVE_WEBKIT2
+  /* TODO: WebKitSettings */
+#else
   g_object_set (webkit_settings, webkit_pref, size, NULL);
+#endif
   g_free (value);
 }
 
@@ -209,7 +232,11 @@ webkit_pref_callback_font_family (GSettings *settings,
 
     desc = pango_font_description_from_string (value);
     family = pango_font_description_get_family (desc);
+#ifdef HAVE_WEBKIT2
+    /* TODO: WEbKitSettings */
+#else
     g_object_set (webkit_settings, webkit_pref, family, NULL);
+#endif
     pango_font_description_free (desc);
   }
 
@@ -266,6 +293,9 @@ webkit_pref_callback_accept_languages (GSettings *settings,
                                        char *key,
                                        gpointer data)
 {
+#ifdef HAVE_WEBKIT2
+  /* TODO: Languages */
+#else
   SoupSession *session;
   GArray *array;
   char **languages;
@@ -299,6 +329,7 @@ webkit_pref_callback_accept_languages (GSettings *settings,
   g_strfreev (languages);
   g_free (langs_str);
   g_array_free (array, TRUE);
+#endif
 }
 
 void
@@ -329,6 +360,9 @@ webkit_pref_callback_cookie_accept_policy (GSettings *settings,
                                            char *key,
                                            gpointer data)
 {
+#ifdef HAVE_WEBKIT2
+  /* TODO: Cookies */
+#else
   SoupSession *session;
   char *value = NULL;
 
@@ -348,6 +382,7 @@ webkit_pref_callback_cookie_accept_policy (GSettings *settings,
   }
 
   g_free (value);
+#endif
 }
 
 static void
@@ -355,6 +390,9 @@ webkit_pref_callback_gnome_fonts (GSettings *ephy_settings,
                                   char *key,
                                   gpointer data)
 {
+#ifdef HAVE_WEBKIT2
+  /* TODO: WebKitSettings */
+#else
   GSettings *settings;
 
   if (g_settings_get_boolean (ephy_settings, key)) {
@@ -383,6 +421,7 @@ webkit_pref_callback_gnome_fonts (GSettings *ephy_settings,
     webkit_pref_callback_font_family (settings, EPHY_PREFS_WEB_SERIF_FONT,
                                       "serif-font-family");
   }
+#endif
 }
 
 static void
@@ -422,8 +461,12 @@ webkit_pref_callback_enable_spell_checking (GSettings *settings,
     g_strfreev (languages);
   }
 
+#ifdef HAVE_WEBKIT2
+  /* TODO: WebKitSettings */
+#else
   g_object_set (webkit_settings, "enable-spell-checking", value, NULL);
   g_object_set (webkit_settings, "spell-checking-languages", langs, NULL);
+#endif
 
   g_free (langs);
 }
@@ -484,18 +527,24 @@ static const PrefData webkit_pref_entries[] =
       webkit_pref_callback_cookie_accept_policy },
   };
 
+#ifdef HAVE_WEBKIT2
+/* TODO: WebKitSettings */
+#else
 static void
 ephy_embed_prefs_apply (EphyEmbed *embed, WebKitWebSettings *settings)
 {
   webkit_web_view_set_settings (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed),
                                 settings);
 }
+#endif
 
 void
 ephy_embed_prefs_init (void)
 {
   int i;
-
+#ifdef HAVE_WEBKIT2
+  /* TODO: WebKitSettings */
+#else
   webkit_settings = webkit_web_settings_new ();
 
   /* Hardcoded settings */
@@ -552,17 +601,26 @@ ephy_embed_prefs_init (void)
                    EPHY_PREFS_WEB_ENABLE_WEBGL,
                    webkit_settings, "enable-webgl",
                    G_SETTINGS_BIND_GET);
+#endif
 }
 
 void
 ephy_embed_prefs_shutdown (void)
 {
+#ifdef HAVE_WEBKIT2
+  /* TODO: WebKitSettings */
+#else
   g_object_unref (webkit_settings);
+#endif
 }
 
 void
 ephy_embed_prefs_add_embed (EphyEmbed *embed)
 {
+#ifdef HAVE_WEBKIT2
+  /* TODO: WebKitSettings */
+#else
   ephy_embed_prefs_apply (embed, webkit_settings);
+#endif
 }
 
diff --git a/embed/ephy-embed-single.c b/embed/ephy-embed-single.c
index 8eb52da..e2280be 100644
--- a/embed/ephy-embed-single.c
+++ b/embed/ephy-embed-single.c
@@ -37,7 +37,11 @@
 #include "ephy-settings.h"
 #include "ephy-request-about.h"
 
+#ifdef HAVE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
 #include <webkit/webkit.h>
+#endif
 #include <glib/gi18n.h>
 #include <libsoup/soup-gnome.h>
 #include <libsoup/soup-cache.h>
@@ -343,6 +347,9 @@ cache_size_cb (GSettings *settings,
 gboolean
 ephy_embed_single_initialize (EphyEmbedSingle *single)
 {
+#ifdef HAVE_WEBKIT2
+  /* TODO: Network features */
+#else
   SoupSession *session;
   SoupCookieJar *jar;
   char *filename;
@@ -413,7 +420,7 @@ ephy_embed_single_initialize (EphyEmbedSingle *single)
   favicon_db_path = g_build_filename (g_get_user_data_dir (), g_get_prgname (), NULL);
   webkit_favicon_database_set_path (webkit_get_favicon_database (), favicon_db_path);
   g_free (favicon_db_path);
-
+#endif
   return TRUE;
 }
 
diff --git a/embed/ephy-embed-utils.h b/embed/ephy-embed-utils.h
index ded63a5..5f7cd95 100644
--- a/embed/ephy-embed-utils.h
+++ b/embed/ephy-embed-utils.h
@@ -34,7 +34,12 @@
 G_BEGIN_DECLS
 
 #define EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED(embed) (WEBKIT_WEB_VIEW (ephy_embed_get_web_view (embed)))
+#ifdef HAVE_WEBKIT2
+/* There's no scrolled window widget in WebKit2 */
+#define EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW(view) (EPHY_EMBED (gtk_widget_get_parent (gtk_widget_get_parent (gtk_widget_get_parent ((GTK_WIDGET (view)))))))
+#else
 #define EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW(view) (EPHY_EMBED (gtk_widget_get_parent (gtk_widget_get_parent (gtk_widget_get_parent (gtk_widget_get_parent ((GTK_WIDGET (view))))))))
+#endif
 
 #define EPHY_WEBKIT_BACK_FORWARD_LIMIT 100
 
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 46366b4..a458f17 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -37,13 +37,21 @@
 #include "nautilus-floating-bar.h"
 
 #include <glib/gi18n.h>
+#ifdef HAVE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
 #include <webkit/webkit.h>
+#endif
 
 static void     ephy_embed_constructed      (GObject *object);
+#ifdef HAVE_WEBKIT2
+/* TODO: Inspector */
+#else
 static gboolean ephy_embed_inspect_show_cb  (WebKitWebInspector *inspector,
                                              EphyEmbed *embed);
 static gboolean ephy_embed_inspect_close_cb (WebKitWebInspector *inspector,
                                              EphyEmbed *embed);
+#endif
 
 #define EPHY_EMBED_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_EMBED, EphyEmbedPrivate))
 
@@ -58,7 +66,9 @@ typedef struct {
 struct _EphyEmbedPrivate
 {
   GtkBox *top_widgets_vbox;
+#ifndef HAVE_WEBKIT2
   GtkScrolledWindow *scrolled_window;
+#endif
   GtkPaned *paned;
   WebKitWebView *web_view;
   GtkWidget *inspector_window;
@@ -220,6 +230,9 @@ ephy_embed_statusbar_pop (EphyEmbed *embed, guint context_id)
   ephy_embed_statusbar_update (embed, msg ? msg->text : NULL);
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: WebKitWebResource::send-request */
+#else
 static void
 resource_request_starting_cb (WebKitWebView *web_view,
                               WebKitWebFrame *web_frame,
@@ -242,6 +255,7 @@ resource_request_starting_cb (WebKitWebView *web_view,
     webkit_network_request_set_uri (request, "about:blank");
   }
 }
+#endif
 
 static void
 ephy_embed_destroy_top_widgets (EphyEmbed *embed)
@@ -262,6 +276,9 @@ remove_from_destroy_list_cb (GtkWidget *widget, EphyEmbed *embed)
   embed->priv->destroy_on_transition_list = list;
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Loader */
+#else
 static void
 load_status_changed_cb (WebKitWebView *web_view,
                         GParamSpec *spec,
@@ -272,6 +289,7 @@ load_status_changed_cb (WebKitWebView *web_view,
   if (status == WEBKIT_LOAD_COMMITTED)
     ephy_embed_destroy_top_widgets (embed);
 }
+#endif
 
 static void
 ephy_embed_grab_focus (GtkWidget *widget)
@@ -323,6 +341,9 @@ ephy_embed_dispose (GObject *object)
   EphyEmbedPrivate *priv = embed->priv;
 
   if (priv->inspector_window) {
+#ifdef HAVE_WEBKIT2
+    /* TODO: Inspector */
+#else
     WebKitWebInspector *inspector;
 
     inspector = webkit_web_view_get_inspector (priv->web_view);
@@ -334,6 +355,7 @@ ephy_embed_dispose (GObject *object)
     g_signal_handlers_disconnect_by_func (inspector,
                                           ephy_embed_inspect_close_cb,
                                           priv->inspector_window);
+#endif
 
     gtk_widget_destroy (GTK_WIDGET (priv->inspector_window));
     priv->inspector_window = NULL;
@@ -419,6 +441,9 @@ ephy_embed_class_init (EphyEmbedClass *klass)
   g_type_class_add_private (G_OBJECT_CLASS (klass), sizeof(EphyEmbedPrivate));
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Inspector */
+#else
 static WebKitWebView *
 ephy_embed_inspect_web_view_cb (WebKitWebInspector *inspector,
                                 WebKitWebView *web_view,
@@ -507,6 +532,7 @@ ephy_embed_inspect_close_cb (WebKitWebInspector *inspector,
 
   return TRUE;
 }
+#endif
 
 void
 ephy_embed_auto_download_url (EphyEmbed *embed, const char *url)
@@ -518,6 +544,9 @@ ephy_embed_auto_download_url (EphyEmbed *embed, const char *url)
   ephy_download_set_action (download, EPHY_DOWNLOAD_ACTION_OPEN);
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Downloads */
+#else
 static gboolean
 download_requested_cb (WebKitWebView *web_view,
                        WebKitDownload *download,
@@ -539,6 +568,7 @@ download_requested_cb (WebKitWebView *web_view,
 
   return TRUE;
 }
+#endif
 
 static void
 ephy_embed_set_fullscreen_message (EphyEmbed *embed,
@@ -610,6 +640,9 @@ status_message_notify_cb (EphyWebView *view, GParamSpec *pspec, EphyEmbed *embed
   }
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: WebKitWindowProperties */
+#else
 static void
 window_resize_requested (WebKitWebWindowFeatures *features, GParamSpec *pspec, EphyEmbed *embed)
 {
@@ -638,6 +671,7 @@ window_resize_requested (WebKitWebWindowFeatures *features, GParamSpec *pspec, E
   g_object_get (features, "width", &width, "height", &height, NULL);
   gtk_window_resize (GTK_WINDOW (window), width, height);
 }
+#endif
 
 static gboolean
 clear_progress_cb (EphyEmbed *embed)
@@ -648,6 +682,9 @@ clear_progress_cb (EphyEmbed *embed)
   return FALSE;
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Load progress */
+#else
 static void
 progress_update (EphyWebView *view, GParamSpec *pspec, EphyEmbed *embed)
 {
@@ -679,22 +716,29 @@ progress_update (EphyWebView *view, GParamSpec *pspec, EphyEmbed *embed)
   gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->progress),
                                  (loading || progress == 1.0) ? progress : 0.0);
 }
+#endif
 
 static void
 ephy_embed_constructed (GObject *object)
 {
   EphyEmbed *embed = (EphyEmbed*)object;
   EphyEmbedPrivate *priv = embed->priv;
+#ifndef HAVE_WEBKIT2
   GtkWidget *scrolled_window;
+#endif
   GtkWidget *paned;
   WebKitWebView *web_view;
+#ifndef HAVE_WEBKIT2
   WebKitWebWindowFeatures *window_features;
   WebKitWebInspector *inspector;
+#endif
   GtkWidget *overlay;
 
   /* Skeleton */
   web_view = WEBKIT_WEB_VIEW (ephy_web_view_new ());
+#ifndef HAVE_WEBKIT2
   scrolled_window = GTK_WIDGET (priv->scrolled_window);
+#endif
   overlay = gtk_overlay_new ();
   gtk_style_context_add_class (gtk_widget_get_style_context (overlay),
                                GTK_STYLE_CLASS_OSD);
@@ -702,7 +746,11 @@ ephy_embed_constructed (GObject *object)
   gtk_widget_add_events (overlay, 
                          GDK_ENTER_NOTIFY_MASK |
                          GDK_LEAVE_NOTIFY_MASK);
+#ifdef HAVE_WEBKIT2
+  gtk_container_add (GTK_CONTAINER (overlay), GTK_WIDGET (web_view));
+#else
   gtk_container_add (GTK_CONTAINER (overlay), scrolled_window);
+#endif
 
   /* Floating message popup for fullscreen mode. */
   priv->fullscreen_message_label = gtk_label_new (NULL);
@@ -729,11 +777,17 @@ ephy_embed_constructed (GObject *object)
   paned = GTK_WIDGET (priv->paned);
 
   priv->web_view = web_view;
+#ifdef HAVE_WEBKIT2
+  /* TODO: Load progress */
+#else
   priv->progress_update_handler_id =  g_signal_connect (web_view, "notify::progress",
                                                         G_CALLBACK (progress_update), object);
+#endif
 
+#ifndef HAVE_WEBKIT2
   gtk_container_add (GTK_CONTAINER (scrolled_window),
                      GTK_WIDGET (web_view));
+#endif
   gtk_paned_pack1 (GTK_PANED (paned), GTK_WIDGET (overlay),
                    TRUE, FALSE);
 
@@ -746,6 +800,9 @@ ephy_embed_constructed (GObject *object)
   gtk_widget_show (GTK_WIDGET (web_view));
   gtk_widget_show_all (paned);
 
+#ifdef HAVE_WEBKIT2
+  /* TODO: Loader, WebKitWebResource::send-request, Downloads */
+#else
   g_object_connect (web_view,
                     "signal::notify::load-status", G_CALLBACK (load_status_changed_cb), embed,
                     "signal::resource-request-starting", G_CALLBACK (resource_request_starting_cb), embed,
@@ -753,11 +810,19 @@ ephy_embed_constructed (GObject *object)
                     "signal::entering-fullscreen", G_CALLBACK (entering_fullscreen_cb), embed,
                     "signal::leaving-fullscreen", G_CALLBACK (leaving_fullscreen_cb), embed,
                     NULL);
+#endif
 
+#ifdef HAVE_WEBKIT2
+  /* TODO: status message? */
+#else
   priv->status_handler_id = g_signal_connect (web_view, "notify::status-message",
                                               G_CALLBACK (status_message_notify_cb),
                                               embed);
+#endif
 
+#ifdef HAVE_WEBKIT2
+  /* TODO: WebKitWindowProperties */
+#else
   /* Window features */
   window_features = webkit_web_view_get_window_features (web_view);
   g_object_connect (window_features,
@@ -766,9 +831,13 @@ ephy_embed_constructed (GObject *object)
                     "signal::notify::width", G_CALLBACK (window_resize_requested), embed,
                     "signal::notify::height", G_CALLBACK (window_resize_requested), embed,
                     NULL);
+#endif
 
   /* The inspector */
   priv->inspector_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+#ifdef HAVE_WEBKIT2
+  /* TODO: Inspector */
+#else
   inspector = webkit_web_view_get_inspector (web_view);
 
   priv->inspector_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
@@ -798,6 +867,7 @@ ephy_embed_constructed (GObject *object)
                     "signal::detach-window", G_CALLBACK (ephy_embed_detach_inspector_cb),
                     embed,
                     NULL);
+#endif
 
   ephy_embed_prefs_add_embed (embed);
 }
@@ -810,15 +880,19 @@ ephy_embed_init (EphyEmbed *embed)
   gtk_orientable_set_orientation (GTK_ORIENTABLE (embed),
                                   GTK_ORIENTATION_VERTICAL);
 
+#ifndef HAVE_WEBKIT2
   embed->priv->scrolled_window = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new (NULL, NULL));
+#endif
   embed->priv->paned = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_VERTICAL));
   embed->priv->top_widgets_vbox = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 0));
   embed->priv->seq_context_id = 1;
   embed->priv->seq_message_id = 1;
   embed->priv->tab_message_id = ephy_embed_statusbar_get_context_id (embed, EPHY_EMBED_STATUSBAR_TAB_MESSAGE_CONTEXT_DESCRIPTION);
 
+#ifndef HAVE_WEBKIT2
   gtk_scrolled_window_set_policy (embed->priv->scrolled_window,
                                   GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+#endif
 }
 
 /**
diff --git a/embed/ephy-request-about.c b/embed/ephy-request-about.c
index bfff22f..cddb9d1 100644
--- a/embed/ephy-request-about.c
+++ b/embed/ephy-request-about.c
@@ -30,7 +30,11 @@
 #include <gio/gio.h>
 #include <glib/gi18n.h>
 #include <libsoup/soup-uri.h>
+#ifdef HAVE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
 #include <webkit/webkit.h>
+#endif
 
 G_DEFINE_TYPE (EphyRequestAbout, ephy_request_about, SOUP_TYPE_REQUEST)
 
@@ -93,6 +97,9 @@ ephy_request_about_send (SoupRequest          *request,
     read_css_style (about);
 
   if (!g_strcmp0 (uri->path, "plugins")) {
+#ifdef HAVE_WEBKIT2
+    /* TODO: SoupRequest and Plugins */
+#else
     WebKitWebPluginDatabase* database = webkit_get_web_plugin_database ();
     GSList *plugin_list, *p;
 
@@ -136,6 +143,7 @@ ephy_request_about_send (SoupRequest          *request,
     }
 
     webkit_web_plugin_database_plugins_list_free (plugin_list);
+#endif
     g_string_append (data_str, "</body>");
   } else if (!g_strcmp0 (uri->path, "memory")) {
     char *memory = ephy_smaps_to_html (EPHY_REQUEST_ABOUT (request)->priv->smaps);
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 5aa5bff..c0350a3 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -72,7 +72,11 @@ struct _EphyWebViewPrivate {
   EphyWebViewSecurityLevel security_level;
   EphyWebViewDocumentType document_type;
   EphyWebViewNavigationFlags nav_flags;
+#ifdef HAVE_WEBKIT2
+  /* TODO: Loader */
+#else
   WebKitLoadStatus load_status;
+#endif
 
   /* Flags */
   guint is_blank : 1;
@@ -560,6 +564,9 @@ ephy_web_view_dispose (GObject *object)
   G_OBJECT_CLASS (ephy_web_view_parent_class)->dispose (object);
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: DOM bindings */
+#else
 typedef struct {
   WebKitDOMNode *username_node;
   WebKitDOMNode *password_node;
@@ -665,6 +672,7 @@ find_username_and_password_elements (WebKitDOMNode *form_node,
 
   g_object_unref(elements);
 }
+#endif
 
 typedef struct {
   EphyEmbed *embed;
@@ -835,6 +843,9 @@ should_store_cb (GnomeKeyringResult retval,
   request_decision_on_storing (store_data);
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: DOM bindings */
+#else
 static gboolean
 form_submitted_cb (WebKitDOMHTMLFormElement *dom_form,
                    WebKitDOMEvent *dom_event,
@@ -1040,6 +1051,7 @@ _ephy_web_view_hook_into_links (EphyWebView *web_view)
 
   g_object_unref(links);
 }
+#endif
 
 static void
 update_navigation_flags (EphyWebView *view)
@@ -1064,6 +1076,9 @@ update_navigation_flags (EphyWebView *view)
 static void
 ephy_web_view_clear_history (EphyWebView *view)
 {
+#ifdef HAVE_WEBKIT2
+  /* TODO: History */
+#else
   WebKitWebBackForwardList *history_list;
 
   g_return_if_fail (EPHY_IS_WEB_VIEW (view));
@@ -1083,6 +1098,7 @@ ephy_web_view_clear_history (EphyWebView *view)
 
     update_navigation_flags (view);
   }
+#endif
 }
 
 static void
@@ -1141,11 +1157,15 @@ title_changed_cb (WebKitWebView *web_view,
 {
   const char *uri;
   char *title;
-  WebKitWebFrame *frame;
   EphyHistoryService *history = EPHY_WEB_VIEW (web_view)->priv->history_service;
+#ifndef HAVE_WEBKIT2
+  WebKitWebFrame *frame;
 
   frame = webkit_web_view_get_main_frame (web_view);
   uri = webkit_web_frame_get_uri (frame);
+#else
+  uri = webkit_web_view_get_uri (web_view);
+#endif
 
   g_object_get (web_view, "title", &title, NULL);
 
@@ -1181,6 +1201,9 @@ uri_changed_cb (WebKitWebView *web_view,
   g_free (uri);
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Mouse target changed */
+#else
 static void
 hovering_over_link_cb (EphyWebView *web_view,
                        char *title,
@@ -1189,6 +1212,7 @@ hovering_over_link_cb (EphyWebView *web_view,
 {
   ephy_web_view_set_link_message (web_view, location);
 }
+#endif
 
 static void
 ephy_web_view_constructed (GObject *object)
@@ -1201,7 +1225,10 @@ ephy_web_view_constructed (GObject *object)
    * different keys for text and full content zooming. AFAIK you can
    * have both enabled at the same time in WebKit now (although our
    * API does not reflect this atm). See r67274 in WebKit. */
+#ifndef HAVE_WEBKIT2
+  /* This is the default behaviour in WebKit2 */
   webkit_web_view_set_full_content_zoom (WEBKIT_WEB_VIEW (object), TRUE);
+#endif
 }
 
 static void
@@ -1589,6 +1616,9 @@ ephy_web_view_class_init (EphyWebViewClass *klass)
   g_type_class_add_private (gobject_class, sizeof (EphyWebViewPrivate));
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Favicons */
+#else
 static void
 _ephy_web_view_load_icon (EphyWebView *view)
 {
@@ -1630,6 +1660,7 @@ favicon_cb (EphyWebView *view,
 {
   _ephy_web_view_set_icon_address (view, address);
 }
+#endif
 
 static void
 new_window_cb (EphyWebView *view,
@@ -1656,6 +1687,9 @@ ge_popup_blocked_cb (EphyWebView *view,
   popups_manager_add (view, url, name, features);
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Policy Client */
+#else
 static gboolean
 mime_type_policy_decision_requested_cb (WebKitWebView *web_view,
                                         WebKitWebFrame *frame,
@@ -1740,7 +1774,11 @@ mime_type_policy_decision_requested_cb (WebKitWebView *web_view,
 
   return FALSE;
 }
+#endif
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Geolocation */
+#else
 static void
 decide_on_geolocation_policy_request (GtkWidget *info_bar,
                                       int response,
@@ -1822,7 +1860,11 @@ geolocation_policy_decision_requested_cb (WebKitWebView *web_view,
 
   return TRUE;
 }
+#endif
 
+#ifdef HAVE_WEBKIT2
+/* TODO: DOM Bindings */
+#else
 static gboolean
 delete_web_app_cb (WebKitDOMHTMLElement *button,
                    WebKitDOMEvent *dom_event,
@@ -1838,6 +1880,7 @@ delete_web_app_cb (WebKitDOMHTMLElement *button,
 
   return FALSE;
 }
+#endif
 
 static void
 get_host_for_url_cb (gpointer service,
@@ -1876,6 +1919,9 @@ restore_zoom_level (EphyWebView *view,
                                            (EphyHistoryJobCallback)get_host_for_url_cb, view);
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Loader */
+#else
 static void
 load_status_cb (WebKitWebView *web_view,
                 GParamSpec *pspec,
@@ -2046,6 +2092,7 @@ load_status_cb (WebKitWebView *web_view,
 
   g_object_thaw_notify (object);
 }
+#endif
 
 /**
  * ephy_web_view_load_error_page:
@@ -2144,7 +2191,11 @@ ephy_web_view_load_error_page (EphyWebView *view,
   g_file_get_contents (html_file, &template, NULL, NULL);
 
   ephy_web_view_set_title (view, page_title);
+#ifdef HAVE_WEBKIT2
+  /* TODO: Favicons */
+#else
   _ephy_web_view_set_icon_address (view, NULL);
+#endif
 
   g_string_printf (html, template,
                    lang, lang,
@@ -2162,11 +2213,18 @@ ephy_web_view_load_error_page (EphyWebView *view,
   g_free (button_label);
   g_free (image_data);
 
+#ifdef HAVE_WEBKIT2
+  webkit_web_view_load_html (WEBKIT_WEB_VIEW (view), html->str, uri);
+#else
   webkit_web_view_load_string (WEBKIT_WEB_VIEW (view),
                                html->str, "text/html", "utf8", uri);
+#endif
   g_string_free (html, TRUE);
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Load error */
+#else
 static gboolean
 load_error_cb (WebKitWebView *web_view,
                WebKitWebFrame *frame,
@@ -2228,7 +2286,11 @@ load_error_cb (WebKitWebView *web_view,
 
   return FALSE;
 }
+#endif
 
+#ifdef HAVE_WEBKIT2
+/* TODO: WebKitWebView::close */
+#else
 static gboolean
 close_web_view_cb (WebKitWebView *web_view,
                    gpointer user_data)
@@ -2245,6 +2307,7 @@ close_web_view_cb (WebKitWebView *web_view,
 
   return TRUE;
 }
+#endif
 
 static void
 zoom_changed_cb (WebKitWebView *web_view,
@@ -2270,6 +2333,9 @@ zoom_changed_cb (WebKitWebView *web_view,
   g_free (address);
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: WebKitWebResource::send-request */
+#else
 static void
 add_do_not_track_header_cb (WebKitWebView *view, WebKitWebFrame *frame,
                             WebKitWebResource *resource, WebKitNetworkRequest *request,
@@ -2306,6 +2372,7 @@ do_not_track_setting_changed_cb (GSettings *settings,
     priv->do_not_track_handler = 0;
   }
 }
+#endif
 
 static void
 ephy_web_view_init (EphyWebView *web_view)
@@ -2316,7 +2383,9 @@ ephy_web_view_init (EphyWebView *web_view)
 
   priv->expire_address_now = TRUE;
   priv->is_blank = TRUE;
+#ifndef HAVE_WEBKIT2
   priv->load_status = WEBKIT_LOAD_PROVISIONAL;
+#endif
   priv->title = g_strdup (EMPTY_PAGE);
   priv->document_type = EPHY_WEB_VIEW_DOCUMENT_HTML;
   priv->security_level = EPHY_WEB_VIEW_STATE_IS_UNKNOWN;
@@ -2332,25 +2401,45 @@ ephy_web_view_init (EphyWebView *web_view)
                     "cleared", G_CALLBACK (ephy_web_view_history_cleared_cb),
                     web_view);
 
+#ifdef HAVE_WEBKIT2
+  /* TODO: Policy Client */
+#else
   g_signal_connect (web_view, "mime-type-policy-decision-requested",
                     G_CALLBACK (mime_type_policy_decision_requested_cb),
                     NULL);
+#endif
 
+#ifdef HAVE_WEBKIT2
+  /* TODO: Geolocation */
+#else
   g_signal_connect (web_view, "geolocation-policy-decision-requested",
                     G_CALLBACK (geolocation_policy_decision_requested_cb),
                     NULL);
+#endif
 
+#ifdef HAVE_WEBKIT2
+  /* TODO: Loader */
+#else
   g_signal_connect (web_view, "notify::load-status",
                     G_CALLBACK (load_status_cb),
                     NULL);
+#endif
 
+#ifdef HAVE_WEBKIT2
+  /* TODO: WebKitWebView::close */
+#else
   g_signal_connect (web_view, "close-web-view",
                     G_CALLBACK (close_web_view_cb),
                     NULL);
+#endif
 
+#ifdef HAVE_WEBKIT2
+  /* TODO: Load errors */
+#else
   g_signal_connect (web_view, "load-error",
                     G_CALLBACK (load_error_cb),
                     NULL);
+#endif
 
   g_signal_connect (web_view, "notify::zoom-level",
                     G_CALLBACK (zoom_changed_cb),
@@ -2364,13 +2453,21 @@ ephy_web_view_init (EphyWebView *web_view)
                     G_CALLBACK (uri_changed_cb),
                     NULL);
 
+#ifdef HAVE_WEBKIT2
+  /* TODO: Mouse target changed */
+#else
   g_signal_connect (web_view, "hovering-over-link",
                     G_CALLBACK (hovering_over_link_cb),
                     NULL);
+#endif
 
+#ifdef HAVE_WEBKIT2
+  /* TODO: Favicons */
+#else
   g_signal_connect (web_view, "icon-loaded",
                     G_CALLBACK (favicon_cb),
                     NULL);
+#endif
 
   g_signal_connect (web_view, "new-window",
                     G_CALLBACK (new_window_cb),
@@ -2379,7 +2476,9 @@ ephy_web_view_init (EphyWebView *web_view)
   g_signal_connect (web_view, "ge_popup_blocked",
                     G_CALLBACK (ge_popup_blocked_cb),
                     NULL);
-
+#ifdef HAVE_WEBKIT2
+  /* TODO: WebKitWebResource::send-request */
+#else
   if (g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_DO_NOT_TRACK))
     priv->do_not_track_handler = g_signal_connect (web_view, "resource-request-starting",
                                                    G_CALLBACK (add_do_not_track_header_cb), NULL);
@@ -2387,6 +2486,7 @@ ephy_web_view_init (EphyWebView *web_view)
   g_signal_connect (EPHY_SETTINGS_WEB,
                     "changed::" EPHY_PREFS_WEB_DO_NOT_TRACK,
                     G_CALLBACK (do_not_track_setting_changed_cb), web_view);
+#endif
 }
 
 /**
@@ -2456,15 +2556,33 @@ normalize_or_autosearch_url (EphyWebView *view, const char *url)
  *
  * Loads the given #WebKitNetworkRequest in the given #EphyWebView.
  **/
+#ifdef HAVE_WEBKIT2
+void
+ephy_web_view_load_request (EphyWebView *view,
+                            WebKitURIRequest *request)
+#else
 void
 ephy_web_view_load_request (EphyWebView *view,
                             WebKitNetworkRequest *request)
+#endif
 {
+#ifndef HAVE_WEBKIT2
   WebKitWebFrame *main_frame;
+#endif
   const char *url;
   char *effective_url;
 
   g_return_if_fail (EPHY_IS_WEB_VIEW(view));
+#ifdef HAVE_WEBKIT2
+  g_return_if_fail (WEBKIT_IS_URI_REQUEST(request));
+
+  url = webkit_uri_request_get_uri (request);
+  effective_url = normalize_or_autosearch_url (view, url);
+
+  // TODO: webkit_uri_request_set_uri?
+  webkit_web_view_load_uri (WEBKIT_WEB_VIEW(view), effective_url);
+  g_free (effective_url);
+#else
   g_return_if_fail (WEBKIT_IS_NETWORK_REQUEST(request));
 
   url = webkit_network_request_get_uri (request);
@@ -2474,6 +2592,7 @@ ephy_web_view_load_request (EphyWebView *view,
 
   main_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW(view));
   webkit_web_frame_load_request(main_frame, request);
+#endif
 }
 
 typedef struct {
@@ -2544,6 +2663,9 @@ ephy_web_view_load_url (EphyWebView *view,
    * typed in the location entry, which uses this method to do the
    * load. */
   if (!ephy_embed_utils_address_has_web_scheme (effective_url)) {
+#ifdef HAVE_WEBKIT2
+    /* TODO: Network features */
+#else
     SoupMessage *message;
     SoupSession *session;
     char *temp_url;
@@ -2569,12 +2691,17 @@ ephy_web_view_load_url (EphyWebView *view,
     }
 
     g_free (temp_url);
+#endif
   } else if (g_str_has_prefix (effective_url, "javascript:")) {
+#ifdef HAVE_WEBKIT2
+    /* TODO: Run JavaScript */
+#else
     char *decoded_url;
 
     decoded_url = soup_uri_decode (effective_url);
     webkit_web_view_execute_script (WEBKIT_WEB_VIEW (view), decoded_url);
     g_free (decoded_url);
+#endif
   } else
     webkit_web_view_load_uri (WEBKIT_WEB_VIEW (view), effective_url);
 
@@ -2596,6 +2723,9 @@ void
 ephy_web_view_copy_back_history (EphyWebView *source,
                                  EphyWebView *dest)
 {
+#ifdef HAVE_WEBKIT2
+  /* TODO: BackForwardList */
+#else
   WebKitWebView *source_view, *dest_view;
   WebKitWebBackForwardList* source_bflist, *dest_bflist;
   WebKitWebHistoryItem *item;
@@ -2626,6 +2756,7 @@ ephy_web_view_copy_back_history (EphyWebView *source,
   item = webkit_web_back_forward_list_get_current_item (source_bflist);
   if (item)
     webkit_web_back_forward_list_add_item (dest_bflist, item);
+#endif
 }
 
 static void
@@ -2976,7 +3107,12 @@ ephy_web_view_location_changed (EphyWebView *view,
   }
 
   ephy_web_view_set_link_message (view, NULL);
+#ifdef HAVE_WEBKIT2
+  /* TODO: Favicons */
+#else
   _ephy_web_view_set_icon_address (view, NULL);
+#endif
+
   update_navigation_flags (view);
 
   g_object_notify (object, "embed-title");
@@ -2998,6 +3134,10 @@ ephy_web_view_location_changed (EphyWebView *view,
 gboolean
 ephy_web_view_is_loading (EphyWebView *view)
 {
+#ifdef HAVE_WEBKIT2
+  /* Loader */
+  return FALSE;
+#else
   WebKitLoadStatus status;
 
   status = webkit_web_view_get_load_status (WEBKIT_WEB_VIEW (view));
@@ -3016,6 +3156,7 @@ ephy_web_view_is_loading (EphyWebView *view)
   view->priv->load_status = status;
 
   return status != WEBKIT_LOAD_FINISHED && status != WEBKIT_LOAD_FAILED;
+#endif
 }
 
 /**
@@ -3258,6 +3399,9 @@ ephy_web_view_set_typed_address (EphyWebView *view,
 gboolean
 ephy_web_view_has_modified_forms (EphyWebView *view)
 {
+#ifdef HAVE_WEBKIT2
+  /* TODO: DOM Bindings */
+#else
   WebKitDOMHTMLCollection *forms = NULL;
   WebKitDOMDocument *document = NULL;
   gulong forms_n;
@@ -3309,7 +3453,7 @@ ephy_web_view_has_modified_forms (EphyWebView *view)
         }
     }
   }
-
+#endif
   return FALSE;
 }
 
@@ -3332,8 +3476,12 @@ ephy_web_view_get_location (EphyWebView *view,
                             gboolean toplevel)
 {
   /* FIXME: follow the toplevel parameter */
+#ifdef HAVE_WEBKIT2
+  return g_strdup (webkit_web_view_get_uri (WEBKIT_WEB_VIEW (view)));
+#else
   WebKitWebFrame *web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view));
   return g_strdup (webkit_web_frame_get_uri (web_frame));
+#endif
 }
 
 /**
@@ -3363,6 +3511,9 @@ ephy_web_view_get_security_level (EphyWebView *view,
 static void
 ephy_web_view_run_print_action (EphyWebView *view, GtkPrintOperationAction action)
 {
+#ifdef HAVE_WEBKIT2
+  /* TODO: Printing */
+#else
   WebKitWebFrame *main_frame;
   GtkPrintOperation *operation;
   GError *error;
@@ -3400,6 +3551,7 @@ ephy_web_view_run_print_action (EphyWebView *view, GtkPrintOperationAction actio
     ephy_embed_shell_set_page_setup (shell, gtk_print_operation_get_default_page_setup (operation));
 
   g_object_unref (operation);
+#endif
 }
 
 /**
@@ -3451,6 +3603,9 @@ ephy_web_view_get_title_composite (EphyWebView *view)
   return title != NULL ? title : "";
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: webkit_web_view_save() */
+#else
 static void
 ephy_web_view_save_sub_resource_start (GList *subresources, char *destination_uri);
 
@@ -3671,7 +3826,7 @@ ephy_web_view_save_sub_resources (EphyWebView *view, const char *uri, GList *sub
   /* Now, let's start saving sub resources */
   ephy_web_view_save_sub_resource_start (subresources, destination_uri);
 }
-
+#endif
 /**
  * ephy_web_view_save:
  * @view: an #EphyWebView
@@ -3682,6 +3837,9 @@ ephy_web_view_save_sub_resources (EphyWebView *view, const char *uri, GList *sub
 void
 ephy_web_view_save (EphyWebView *view, const char *uri)
 {
+#ifdef HAVE_WEBKIT2
+  /* TODO: webkit_web_view_save() */
+#else
   WebKitWebFrame *frame;
   WebKitWebDataSource *data_source;
   GList *subresources;
@@ -3708,6 +3866,7 @@ ephy_web_view_save (EphyWebView *view, const char *uri)
     return;
 
   ephy_web_view_save_sub_resources (view, uri, subresources);
+#endif
 }
 
 /**
diff --git a/embed/ephy-web-view.h b/embed/ephy-web-view.h
index dd8235a..28203b2 100644
--- a/embed/ephy-web-view.h
+++ b/embed/ephy-web-view.h
@@ -28,7 +28,11 @@
 #define EPHY_WEB_VIEW_H
 
 #include <gtk/gtk.h>
+#ifdef HAVE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
 #include <webkit/webkit.h>
+#endif
 
 G_BEGIN_DECLS
 
@@ -123,7 +127,11 @@ GType                      ephy_web_view_chrome_get_type          (void);
 GType                      ephy_web_view_security_level_get_type  (void);
 GtkWidget *                ephy_web_view_new                      (void);
 void                       ephy_web_view_load_request             (EphyWebView               *view,
+#ifdef HAVE_WEBKIT2
+                                                                   WebKitURIRequest          *request);
+#else
                                                                    WebKitNetworkRequest      *request);
+#endif
 void                       ephy_web_view_load_url                 (EphyWebView               *view,
                                                                    const char                *url);
 void                       ephy_web_view_copy_back_history        (EphyWebView               *source,
diff --git a/lib/ephy-web-app-utils.c b/lib/ephy-web-app-utils.c
index 51f3599..bd47171 100644
--- a/lib/ephy-web-app-utils.c
+++ b/lib/ephy-web-app-utils.c
@@ -27,7 +27,11 @@
 
 #include <glib/gstdio.h>
 #include <libsoup/soup-gnome.h>
+#ifdef HAVE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
 #include <webkit/webkit.h>
+#endif
 
 #define EPHY_WEB_APP_DESKTOP_FILE_PREFIX "epiphany-"
 
@@ -256,6 +260,9 @@ out:
 static void
 create_cookie_jar_for_domain (const char *address, const char *directory)
 {
+#ifdef HAVE_WEBKIT2
+  /* TODO: Cookies */
+#else
   SoupSession *session;
   GSList *cookies, *p;
   SoupCookieJar *current_jar, *new_jar;
@@ -295,6 +302,7 @@ create_cookie_jar_for_domain (const char *address, const char *directory)
 
   soup_uri_free (uri);
   g_slist_free (cookies);
+#endif
 }
 
 /**
diff --git a/lib/widgets/ephy-download-widget.c b/lib/widgets/ephy-download-widget.c
index f2013ac..936c930 100644
--- a/lib/widgets/ephy-download-widget.c
+++ b/lib/widgets/ephy-download-widget.c
@@ -31,7 +31,11 @@
 #include "totem-glow-button.h"
 
 #include <glib/gi18n.h>
+#ifdef HAVE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
 #include <webkit/webkit.h>
+#endif
 
 G_DEFINE_TYPE (EphyDownloadWidget, ephy_download_widget, GTK_TYPE_BOX)
 
@@ -99,6 +103,10 @@ format_interval (gdouble interval)
 static gdouble
 get_remaining_time (WebKitDownload *download)
 {
+#ifdef HAVE_WEBKIT2
+  /* TODO: Downloads */
+  return -1.0;
+#else
   gint64 total, cur;
   gdouble elapsed_time;
   gdouble remaining_time;
@@ -115,12 +123,16 @@ get_remaining_time (WebKitDownload *download)
   remaining_time = per_byte_time * (total - cur);
 
   return remaining_time;
+#endif
 }
 
 static void
 download_clicked_cb (GtkButton *button,
                      EphyDownloadWidget *widget)
 {
+#ifdef HAVE_WEBKIT2
+  /* TODO: Downloads */
+#else
   WebKitDownloadStatus status;
   EphyDownload *download;
 
@@ -132,8 +144,12 @@ download_clicked_cb (GtkButton *button,
 
   if (ephy_download_do_download_action (download, EPHY_DOWNLOAD_ACTION_AUTO))
     gtk_widget_destroy (GTK_WIDGET (widget));
+#endif
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Downloads */
+#else
 static void
 update_download_icon (EphyDownloadWidget *widget)
 {
@@ -257,6 +273,7 @@ widget_error_cb (WebKitDownload *download,
 
   return FALSE;
 }
+#endif
 
 static void
 open_activate_cb (GtkMenuItem *item, EphyDownloadWidget *widget)
@@ -284,6 +301,9 @@ download_menu_clicked_cb (GtkWidget *button,
                           GdkEventButton *event,
                           EphyDownloadWidget *widget)
 {
+#ifdef HAVE_WEBKIT2
+  /* TODO: Downloads */
+#else
   WebKitDownloadStatus status;
   gboolean finished;
   GtkWidget *item;
@@ -340,6 +360,7 @@ download_menu_clicked_cb (GtkWidget *button,
   gtk_menu_attach_to_widget (GTK_MENU (menu), button, NULL);
   gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
                   event->button, event->time);
+#endif
 }
 
 static void
@@ -394,9 +415,13 @@ ephy_download_widget_dispose (GObject *object)
   if (widget->priv->download != NULL) {
     download = ephy_download_get_webkit_download (widget->priv->download);
 
+#ifdef HAVE_WEBKIT2
+    /* TODO: Downloads */
+#else
     g_signal_handlers_disconnect_by_func (download, widget_progress_cb, widget);
     g_signal_handlers_disconnect_by_func (download, widget_status_cb, widget);
     g_signal_handlers_disconnect_by_func (download, widget_error_cb, widget);
+#endif
 
     g_object_unref (widget->priv->download);
     widget->priv->download = NULL;
@@ -492,7 +517,12 @@ ephy_download_widget_new (EphyDownload *ephy_download)
                          "download", ephy_download, NULL);
   download = ephy_download_get_webkit_download (ephy_download);
 
+#ifdef HAVE_WEBKIT2
+  /* TODO: Downloads */
+  basename = g_strdup ("");
+#else
   basename = g_filename_display_basename (webkit_download_get_destination_uri (download));
+#endif
   dest = g_uri_unescape_string (basename, NULL);
 
   grid = gtk_grid_new ();
@@ -526,12 +556,16 @@ ephy_download_widget_new (EphyDownload *ephy_download)
   widget->priv->remaining = remain;
   widget->priv->menu = menu;
 
+#ifdef HAVE_WEBKIT2
+  /* TODO: Downloads */
+#else
   g_signal_connect (download, "notify::progress",
                     G_CALLBACK (widget_progress_cb), widget);
   g_signal_connect (download, "notify::status",
                     G_CALLBACK (widget_status_cb), widget);
   g_signal_connect (download, "error",
                     G_CALLBACK (widget_error_cb), widget);
+#endif
 
   gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_HALF);
   gtk_button_set_relief (GTK_BUTTON (menu), GTK_RELIEF_NORMAL);
diff --git a/lib/widgets/ephy-hosts-store.c b/lib/widgets/ephy-hosts-store.c
index 4343dff..126d313 100644
--- a/lib/widgets/ephy-hosts-store.c
+++ b/lib/widgets/ephy-hosts-store.c
@@ -28,6 +28,9 @@
 
 G_DEFINE_TYPE (EphyHostsStore, ephy_hosts_store, GTK_TYPE_LIST_STORE)
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Favicons */
+#else
 static void
 icon_loaded_cb (WebKitFaviconDatabase *database,
                 const char *address,
@@ -74,14 +77,19 @@ icon_loaded_cb (WebKitFaviconDatabase *database,
     done = cmp >= 0;
   }
 }
+#endif
 
 static void
 ephy_hosts_store_finalize (GObject *object)
 {
   EphyHostsStore *store = EPHY_HOSTS_STORE (object);
 
+#ifdef HAVE_WEBKIT2
+  /* TODO: Favicons */
+#else
   g_signal_handlers_disconnect_by_func (webkit_get_favicon_database (),
                                         icon_loaded_cb, store);
+#endif
 
   G_OBJECT_CLASS (ephy_hosts_store_parent_class)->finalize (object);
 }
@@ -112,8 +120,12 @@ ephy_hosts_store_init (EphyHostsStore *self)
                                         EPHY_HOSTS_STORE_COLUMN_ADDRESS,
                                         GTK_SORT_ASCENDING);
 
+#ifdef HAVE_WEBKIT2
+  /* TODO: Favicons */
+#else
   g_signal_connect (webkit_get_favicon_database (), "icon-loaded",
                     G_CALLBACK (icon_loaded_cb), self);
+#endif
 }
 
 EphyHostsStore *
@@ -123,6 +135,9 @@ ephy_hosts_store_new (void)
                        NULL);
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Favicons */
+#else
 typedef struct {
   GtkListStore *model;
   GtkTreeRowReference *row_reference;
@@ -153,6 +168,7 @@ async_get_favicon_cb (GObject *source, GAsyncResult *result, gpointer user_data)
   gtk_tree_row_reference_free (data->row_reference);
   g_slice_free (IconLoadData, data);
 }
+#endif
 
 void
 ephy_hosts_store_add_hosts (EphyHostsStore *store,
@@ -162,22 +178,37 @@ ephy_hosts_store_add_hosts (EphyHostsStore *store,
   GtkTreeIter treeiter;
   GtkTreePath *path;
   GList *iter;
+#ifdef HAVE_WEBKIT2
+  /* TODO: Favicons */
+#else
   GdkPixbuf *favicon;
   IconLoadData *data;
   WebKitFaviconDatabase *database = webkit_get_favicon_database ();
+#endif
 
   for (iter = hosts; iter != NULL; iter = iter->next) {
     host = (EphyHistoryHost *)iter->data;
+#ifdef HAVE_WEBKIT2
+    /* TODO: Favicons */
+#else
     favicon = webkit_favicon_database_try_get_favicon_pixbuf (database, host->url,
                                                               FAVICON_SIZE, FAVICON_SIZE);
+#endif
     gtk_list_store_insert_with_values (GTK_LIST_STORE (store),
                                        &treeiter, G_MAXINT,
                                        EPHY_HOSTS_STORE_COLUMN_ID, host->id,
                                        EPHY_HOSTS_STORE_COLUMN_TITLE, host->title,
                                        EPHY_HOSTS_STORE_COLUMN_ADDRESS, host->url,
                                        EPHY_HOSTS_STORE_COLUMN_VISIT_COUNT, host->visit_count,
+#ifdef HAVE_WEBKIT2
+                                       /* TODO: Favicons */
+#else
                                        EPHY_HOSTS_STORE_COLUMN_FAVICON, favicon,
+#endif
                                        -1);
+#ifdef HAVE_WEBKIT2
+    /* TODO: Favicons */
+#else
     if (favicon)
       g_object_unref (favicon);
     else {
@@ -191,6 +222,7 @@ ephy_hosts_store_add_hosts (EphyHostsStore *store,
                                                   FAVICON_SIZE, FAVICON_SIZE, NULL,
                                                   async_get_favicon_cb, data);
     }
+#endif
   }
 }
 
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index fa2a97f..ef57c55 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -940,9 +940,13 @@ free_prefetch_helper (PrefetchHelper *helper)
 static gboolean
 do_dns_prefetch (PrefetchHelper *helper)
 {
+#ifdef HAVE_WEBKIT2
+	/* TODO: Network Features */
+#else
 	SoupSession *session = webkit_get_default_session ();
 
 	soup_session_prepare_for_uri (session, helper->uri);
+#endif
 
 	helper->entry->priv->dns_prefetch_handler = 0;
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 41f13c9..3750c19 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -101,6 +101,10 @@ libephymain_la_CPPFLAGS = \
 	-DGNOMELOCALEDIR=\"$(datadir)/locale\"	\
 	$(AM_CPPFLAGS)
 
+if WITH_WEBKIT2
+libephymain_la_CPPFLAGS += -DHAVE_WEBKIT2
+endif
+
 libephymain_la_CFLAGS = \
 	$(DEPENDENCIES_CFLAGS) 	  \
 	$(WEBKIT_CFLAGS)	  \
@@ -179,10 +183,12 @@ epiphany_LDADD = \
 	$(DEPENDENCIES_LIBS) \
 	$(LIBINTL)
 
+if !WITH_WEBKIT2
 if HAVE_INTROSPECTION
 epiphany_CFLAGS += $(INTROSPECTION_CFLAGS)
 epiphany_LDADD += $(INTROSPECTION_LIBS)
 endif
+endif
 
 if ENABLE_SEED
 epiphany_LDADD += $(SEED_LIBS)
@@ -242,6 +248,7 @@ CLEANFILES = $(stamp_files) $(BUILT_SOURCES)
 DISTCLEANFILES = $(stamp_files) $(BUILT_SOURCES)
 MAINTAINERCLEANFILES = $(stamp_files) $(BUILT_SOURCES)
 
+if !WITH_WEBKIT2
 if HAVE_INTROSPECTION
 EPHY_GIR_H_FILES = \
 	$(top_srcdir)/embed/ephy-download.h \
@@ -336,3 +343,4 @@ Epiphany-$(EPIPHANY_API_VERSION).typelib: Epiphany-$(EPIPHANY_API_VERSION).gir $
 CLEANFILES += $(gir_DATA) $(typelibs_DATA)
 
 endif # HAVE_INTROSPECTION
+endif # !WITH_WEBKIT2
diff --git a/src/bookmarks/ephy-bookmark-action.c b/src/bookmarks/ephy-bookmark-action.c
index fe65d37..c8be7cd 100644
--- a/src/bookmarks/ephy-bookmark-action.c
+++ b/src/bookmarks/ephy-bookmark-action.c
@@ -66,6 +66,9 @@ typedef struct
 
 G_DEFINE_TYPE (EphyBookmarkAction, ephy_bookmark_action, EPHY_TYPE_LINK_ACTION)
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Favicons */
+#else
 static void
 favicon_loaded_cb (WebKitFaviconDatabase *database,
 		   const char *page_address,
@@ -90,12 +93,16 @@ favicon_loaded_cb (WebKitFaviconDatabase *database,
 
 	g_free (icon_address);
 }
+#endif
 
 static void
 ephy_bookmark_action_sync_icon (GtkAction *action,
 				GParamSpec *pspec,
 				GtkWidget *proxy)
 {
+#ifdef HAVE_WEBKIT2
+        /* TODO: Favicons */
+#else
 	EphyBookmarkAction *bma = EPHY_BOOKMARK_ACTION (action);
 	const char *page_location;
 	WebKitFaviconDatabase *database;
@@ -139,6 +146,7 @@ ephy_bookmark_action_sync_icon (GtkAction *action,
 	{
 		g_object_unref (pixbuf);
 	}
+#endif
 }
 
 void
@@ -376,9 +384,13 @@ ephy_bookmark_action_dispose (GObject *object)
 
 	if (priv->cache_handler != 0)
 	{
+#ifdef HAVE_WEBKIT2
+                /* TODO: Favicons */
+#else
 		WebKitFaviconDatabase *database = webkit_get_favicon_database ();
 		g_signal_handler_disconnect (database, priv->cache_handler);
 		priv->cache_handler = 0;
+#endif
 	}
 
 	G_OBJECT_CLASS (ephy_bookmark_action_parent_class)->dispose (object);
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index fbc6ee2..2dcee58 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -1458,6 +1458,9 @@ node_dropped_cb (EphyNodeView *view,
 	}
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Favicons */
+#else
 static gboolean
 webkit_favicon_database_has_favicon (WebKitFaviconDatabase *database, const char *page_uri)
 {
@@ -1480,10 +1483,14 @@ icon_loaded_cb (WebKitFaviconDatabase *database, GAsyncResult *result, GValue *v
 
     g_value_take_object (value, favicon);
 }
+#endif
 
 static void
 provide_favicon (EphyNode *node, GValue *value, gpointer user_data)
 {
+#ifdef HAVE_WEBKIT2
+        /* TODO: Favicons */
+#else
 	const char *page_location;
 	GdkPixbuf *favicon = NULL;
 
@@ -1508,6 +1515,7 @@ provide_favicon (EphyNode *node, GValue *value, gpointer user_data)
 
 	g_value_init (value, GDK_TYPE_PIXBUF);
 	g_value_take_object (value, favicon);
+#endif
 }
 
 static void
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index f2a5ea6..764032b 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -247,6 +247,9 @@ ephy_bookmarks_save_delayed (EphyBookmarks *bookmarks, int delay)
 	}
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Favicons */
+#else
 static void
 icon_updated_cb (WebKitFaviconDatabase *favicon_database,
 		 const char *address,
@@ -258,15 +261,20 @@ icon_updated_cb (WebKitFaviconDatabase *favicon_database,
 	ephy_bookmarks_set_icon (eb, address, icon);
 	g_free (icon);
 }
+#endif
 
 static void
 ephy_setup_history_notifiers (EphyBookmarks *eb)
 {
+#ifdef HAVE_WEBKIT2
+	/* TODO: Favicons */
+#else
 	WebKitFaviconDatabase *favicon_database;
 	
 	favicon_database = webkit_get_favicon_database ();
 	g_signal_connect (favicon_database, "icon-loaded",
 			  G_CALLBACK (icon_updated_cb), eb);
+#endif
 }
 
 static void
@@ -1166,7 +1174,11 @@ ephy_bookmarks_add (EphyBookmarks *eb,
 		    const char *url)
 {
 	EphyNode *bm;
+#ifdef HAVE_WEBKIT2
+	/* TODO: Favicons */
+#else
 	WebKitFaviconDatabase *favicon_database;
+#endif
 
 	bm = ephy_node_new (eb->priv->db);
 
@@ -1181,7 +1193,9 @@ ephy_bookmarks_add (EphyBookmarks *eb,
 	}
 	ephy_node_set_property_string (bm, EPHY_NODE_BMK_PROP_TITLE, title);
 
-
+#ifdef HAVE_WEBKIT2
+	/* TODO: Favicons */
+#else
 	favicon_database = webkit_get_favicon_database ();
 	if (favicon_database != NULL)
 	{
@@ -1193,6 +1207,7 @@ ephy_bookmarks_add (EphyBookmarks *eb,
 			g_free (icon);
 		}
 	}
+#endif
 
 	update_has_smart_address (eb, bm, url);
 	update_bookmark_keywords (eb, bm);
diff --git a/src/ephy-completion-model.c b/src/ephy-completion-model.c
index aa68bf7..373fd0c 100644
--- a/src/ephy-completion-model.c
+++ b/src/ephy-completion-model.c
@@ -166,6 +166,9 @@ typedef struct {
   gboolean is_bookmark;
 } PotentialRow;
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Favicons */
+#else
 typedef struct {
   GtkListStore *model;
   GtkTreeRowReference *row_reference;
@@ -195,6 +198,7 @@ icon_loaded_cb (GObject *source, GAsyncResult *result, gpointer user_data)
   gtk_tree_row_reference_free (data->row_reference);
   g_slice_free (IconLoadData, data);
 }
+#endif
 
 static void
 set_row_in_model (EphyCompletionModel *model, int position, PotentialRow *row)
@@ -202,8 +206,12 @@ set_row_in_model (EphyCompletionModel *model, int position, PotentialRow *row)
   GtkTreeIter iter;
   GdkPixbuf *favicon;
   GtkTreePath *path;
+#ifdef HAVE_WEBKIT2
+  /* TODO: Favicons */
+#else
   IconLoadData *data;
   WebKitFaviconDatabase* database = webkit_get_favicon_database ();
+#endif
 
   gtk_list_store_insert_with_values (GTK_LIST_STORE (model), &iter, position,
                                      EPHY_COMPLETION_TEXT_COL, row->title ? row->title : "",
@@ -214,6 +222,9 @@ set_row_in_model (EphyCompletionModel *model, int position, PotentialRow *row)
                                      EPHY_COMPLETION_RELEVANCE_COL, row->relevance,
                                      -1);
 
+#ifdef HAVE_WEBKIT2
+  /* TODO: Favicons */
+#else
   /* We try first with the try_get_favicon_pixbuf() because if the icon
      is in the DB it's faster than the async version. */
   favicon = webkit_favicon_database_try_get_favicon_pixbuf (database, row->location,
@@ -233,6 +244,7 @@ set_row_in_model (EphyCompletionModel *model, int position, PotentialRow *row)
   webkit_favicon_database_get_favicon_pixbuf (database, row->location,
                                               FAVICON_SIZE, FAVICON_SIZE, NULL,
                                               icon_loaded_cb, data);
+#endif
 }
 
 static void
diff --git a/src/ephy-encoding-dialog.c b/src/ephy-encoding-dialog.c
index 0579f45..95a0b07 100644
--- a/src/ephy-encoding-dialog.c
+++ b/src/ephy-encoding-dialog.c
@@ -36,7 +36,11 @@
 
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
+#ifdef HAVE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
 #include <webkit/webkit.h>
+#endif
 
 #define EPHY_ENCODING_DIALOG_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_ENCODING_DIALOG, EphyEncodingDialogPrivate))
 
@@ -75,6 +79,10 @@ sync_encoding_against_embed (EphyEncodingDialog *dialog)
 	g_return_if_fail (EPHY_IS_EMBED (embed));
 
 	view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+#ifdef HAVE_WEBKIT2
+	encoding = webkit_web_view_get_custom_charset (view);
+	if (encoding == NULL) return;
+#else
 	encoding = webkit_web_view_get_custom_encoding (view);
 	if (encoding == NULL)
 	{
@@ -82,6 +90,7 @@ sync_encoding_against_embed (EphyEncodingDialog *dialog)
 		if (encoding == NULL) return;
 		is_automatic = TRUE;
 	}
+#endif
 
 	node = ephy_encodings_get_node (dialog->priv->encodings, encoding, TRUE);
 	g_assert (EPHY_IS_NODE (node));
@@ -195,7 +204,11 @@ activate_choice (EphyEncodingDialog *dialog)
 
 	if (is_automatic)
 	{
+#ifdef HAVE_WEBKIT2
+		webkit_web_view_set_custom_charset (view, NULL);
+#else
 		webkit_web_view_set_custom_encoding (view, NULL);
+#endif
 	}
 	else if (dialog->priv->selected_node != NULL)
 	{
@@ -204,7 +217,11 @@ activate_choice (EphyEncodingDialog *dialog)
 		code = ephy_node_get_property_string (dialog->priv->selected_node,
 						      EPHY_NODE_ENCODING_PROP_ENCODING);
 
+#ifdef HAVE_WEBKIT2
+		webkit_web_view_set_custom_charset (view, code);
+#else
 		webkit_web_view_set_custom_encoding (view, code);
+#endif
 
 		ephy_encodings_add_recent (dialog->priv->encodings, code);
 	}
diff --git a/src/ephy-encoding-menu.c b/src/ephy-encoding-menu.c
index b55e398..86fe2c2 100644
--- a/src/ephy-encoding-menu.c
+++ b/src/ephy-encoding-menu.c
@@ -35,7 +35,11 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <string.h>
+#ifdef HAVE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
 #include <webkit/webkit.h>
+#endif
 
 #define EPHY_ENCODING_MENU_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_ENCODING_MENU, EphyEncodingMenuPrivate))
 
@@ -134,6 +138,10 @@ update_encoding_menu_cb (GtkAction *dummy, EphyEncodingMenu *menu)
 
 	embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (p->window));
 	view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+#ifdef HAVE_WEBKIT2
+	encoding = webkit_web_view_get_custom_charset (view);
+	if (encoding == NULL) goto build_menu;
+#else
 	encoding = webkit_web_view_get_custom_encoding (view);
 	if (encoding == NULL)
 	{
@@ -141,6 +149,7 @@ update_encoding_menu_cb (GtkAction *dummy, EphyEncodingMenu *menu)
 		if (encoding == NULL) goto build_menu;
 		is_automatic = TRUE;
 	}
+#endif
 
 	enc_node = ephy_encodings_get_node (p->encodings, encoding, TRUE);
 	g_assert (EPHY_IS_NODE (enc_node));
@@ -249,7 +258,11 @@ encoding_activate_cb (GtkAction *action, EphyEncodingMenu *menu)
 	embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (menu->priv->window));
 
 	view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+#ifdef HAVE_WEBKIT2
+	webkit_web_view_set_custom_charset (view, encoding);
+#else
 	webkit_web_view_set_custom_encoding (view, encoding);
+#endif
 
 	ephy_encodings_add_recent (menu->priv->encodings, encoding);
 }
@@ -322,7 +335,11 @@ ephy_encoding_menu_automatic_cb (GtkAction *action, EphyEncodingMenu *menu)
 
 	/* setting NULL will clear the forced encoding */
 	view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+#ifdef HAVE_WEBKIT2
+	webkit_web_view_set_custom_charset (view, NULL);
+#else
 	webkit_web_view_set_custom_encoding (view, NULL);
+#endif
 }
 
 static const GtkActionEntry menu_entries [] =
diff --git a/src/ephy-find-toolbar.c b/src/ephy-find-toolbar.c
index 9a6d7ab..d8ce10e 100644
--- a/src/ephy-find-toolbar.c
+++ b/src/ephy-find-toolbar.c
@@ -29,7 +29,11 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <string.h>
+#ifdef HAVE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
 #include <webkit/webkit.h>
+#endif
 
 #define EPHY_FIND_TOOLBAR_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object),EPHY_TYPE_FIND_TOOLBAR, EphyFindToolbarPrivate))
 
@@ -92,6 +96,9 @@ static void
 scroll_lines (WebKitWebView *web_view,
               int num_lines)
 {
+#ifdef HAVE_WEBKIT2
+        /* TODO: Scroll API? */
+#else
         GtkScrolledWindow *scrolled_window;
         GtkAdjustment *vadj;
         gdouble value;
@@ -101,12 +108,16 @@ scroll_lines (WebKitWebView *web_view,
 
         value = gtk_adjustment_get_value (vadj) + (num_lines * gtk_adjustment_get_step_increment (vadj));
         gtk_adjustment_set_value (vadj, value);
+#endif
 }
 
 static void
 scroll_pages (WebKitWebView *web_view,
               int num_pages)
 {
+#ifdef HAVE_WEBKIT2
+        /* TODO: Scroll API */
+#else
         GtkScrolledWindow *scrolled_window;
         GtkAdjustment *vadj;
         gdouble value;
@@ -116,6 +127,7 @@ scroll_pages (WebKitWebView *web_view,
 
         value = gtk_adjustment_get_value (vadj) + (num_pages * gtk_adjustment_get_page_increment (vadj));
         gtk_adjustment_set_value (vadj, value);
+#endif
 }
 
 static gboolean
@@ -230,6 +242,9 @@ find_prev_cb (EphyFindToolbar *toolbar)
 static void
 ephy_find_toolbar_mark_matches (EphyFindToolbar *toolbar)
 {
+#ifdef HAVE_WEBKIT2
+        /* TODO: Find */
+#else
         EphyFindToolbarPrivate *priv = toolbar->priv;
         WebKitWebView *web_view = priv->web_view;
         gboolean case_sensitive;
@@ -243,6 +258,7 @@ ephy_find_toolbar_mark_matches (EphyFindToolbar *toolbar)
                                                    case_sensitive,
                                                    0);
         webkit_web_view_set_highlight_text_matches (web_view, TRUE);
+#endif
 }
 
 static EphyFindResult
@@ -256,6 +272,10 @@ real_find (EphyFindToolbarPrivate *priv,
         if (!priv->find_string || !g_strcmp0 (priv->find_string, ""))
                 return EPHY_FIND_RESULT_NOTFOUND;
 
+#ifdef HAVE_WEBKIT2
+        /* TODO: Find */
+        return EPHY_FIND_RESULT_NOTFOUND;
+#else
         if (!webkit_web_view_search_text
             (web_view, priv->find_string, case_sensitive, forward, FALSE)) {
                 /* not found, try to wrap */
@@ -270,6 +290,7 @@ real_find (EphyFindToolbarPrivate *priv,
         }
 
         return EPHY_FIND_RESULT_FOUND;
+#endif
 }
 
 static gboolean
@@ -887,8 +908,11 @@ ephy_find_toolbar_close (EphyFindToolbar *toolbar)
 	gtk_widget_hide (GTK_WIDGET (toolbar));
 
 	if (priv->web_view == NULL) return;
-
+#ifdef HAVE_WEBKIT2
+        /* TODO: Find */
+#else
 	webkit_web_view_set_highlight_text_matches (priv->web_view, FALSE);
+#endif
 }
 
 void
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index 101b287..7e42f76 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -882,9 +882,13 @@ provide_favicon (EphyNode *node, GValue *value, gpointer user_data)
         {
 		/* No need to use the async version as this function will be
 		called many times by the treeview. */
+#ifdef HAVE_WEBKIT2
+		/* TODO: Favicons */
+#else
 		WebKitFaviconDatabase *database = webkit_get_favicon_database ();
 		pixbuf = webkit_favicon_database_get_favicon_pixbuf (database, page_location,
 								     FAVICON_SIZE, FAVICON_SIZE);
+#endif
         }
 
 	g_value_init (value, GDK_TYPE_PIXBUF);
diff --git a/src/ephy-navigation-history-action.c b/src/ephy-navigation-history-action.c
index bbf6c72..b03dad1 100644
--- a/src/ephy-navigation-history-action.c
+++ b/src/ephy-navigation-history-action.c
@@ -38,7 +38,11 @@
 #include "ephy-window.h"
 
 #include <gtk/gtk.h>
+#ifdef HAVE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
 #include <webkit/webkit.h>
+#endif
 
 #define EPHY_NAVIGATION_HISTORY_ACTION_GET_PRIVATE(object)		\
   (G_TYPE_INSTANCE_GET_PRIVATE ((object),				\
@@ -112,6 +116,9 @@ action_activate (GtkAction *action)
     if (ephy_gui_is_middle_click () ||
         ephy_link_action_get_button (EPHY_LINK_ACTION (history_action)) == 2) {
       const char *forward_uri;
+#ifdef HAVE_WEBKIT2
+      /* TODO: History */
+#else
       WebKitWebHistoryItem *forward_item;
       WebKitWebBackForwardList *history;
 
@@ -130,6 +137,7 @@ action_activate (GtkAction *action)
 
       web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
       webkit_web_view_load_uri (web_view, forward_uri);
+#endif
     } else {
       webkit_web_view_go_forward (web_view);
       gtk_widget_grab_focus (GTK_WIDGET (embed));
@@ -225,6 +233,9 @@ item_leave_notify_event_cb (GtkWidget *widget,
   return FALSE;
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: favicons */
+#else
 static void
 icon_loaded_cb (GObject *source,
                 GAsyncResult *result,
@@ -246,6 +257,7 @@ icon_loaded_cb (GObject *source,
     g_object_unref (favicon);
   }
 }
+#endif
 
 static GtkWidget *
 new_history_menu_item (EphyWebView *view,
@@ -254,8 +266,12 @@ new_history_menu_item (EphyWebView *view,
 {
   GtkWidget *item;
   GtkLabel *label;
+#ifdef HAVE_WEBKIT2
+  /* TODO: favicons */
+#else
   WebKitFaviconDatabase* database;
   GdkPixbuf *favicon;
+#endif
 
   g_return_val_if_fail (address != NULL && origtext != NULL, NULL);
 
@@ -264,7 +280,9 @@ new_history_menu_item (EphyWebView *view,
   label = GTK_LABEL (gtk_bin_get_child (GTK_BIN (item)));
   gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_END);
   gtk_label_set_max_width_chars (label, MAX_LABEL_LENGTH);
-
+#ifdef HAVE_WEBKIT2
+  /* TODO: favicons */
+#else
   database = webkit_get_favicon_database ();
   favicon = webkit_favicon_database_try_get_favicon_pixbuf (database, address,
                                                             FAVICON_SIZE, FAVICON_SIZE);
@@ -283,6 +301,7 @@ new_history_menu_item (EphyWebView *view,
                                                 (GAsyncReadyCallback) icon_loaded_cb,
                                                 GTK_IMAGE_MENU_ITEM (item));
   }
+#endif
 
   g_object_set_data (G_OBJECT (item), "link-message", g_strdup (address));
 
@@ -301,6 +320,9 @@ set_new_back_history (EphyEmbed *source,
                       EphyEmbed *dest,
                       gint offset)
 {
+#ifdef HAVE_WEBKIT2
+  /* TODO: WebKitBackForwardList */
+#else
   WebKitWebView *source_view, *dest_view;
   WebKitWebBackForwardList* source_list, *dest_list;
   WebKitWebHistoryItem *item;
@@ -338,8 +360,12 @@ set_new_back_history (EphyEmbed *source,
     items = items->next;
   }
   g_list_free (items);
+#endif
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: WebKitBackForwardList */
+#else
 static void
 middle_click_handle_on_history_menu_item (EphyNavigationHistoryAction *action,
                                           EphyEmbed *embed,
@@ -385,11 +411,15 @@ middle_click_handle_on_history_menu_item (EphyNavigationHistoryAction *action,
   url = webkit_web_history_item_get_original_uri (item);
   ephy_web_view_load_url (ephy_embed_get_web_view (new_embed), url);
 }
+#endif
 
 static void
 activate_menu_item_cb (GtkWidget *menuitem,
                        EphyNavigationHistoryAction *action)
 {
+#ifdef HAVE_WEBKIT2
+  /* TODO: WebKitBackForwardList */
+#else
   WebKitWebHistoryItem *item;
   EphyWindow *window;
   EphyEmbed *embed;
@@ -409,12 +439,17 @@ activate_menu_item_cb (GtkWidget *menuitem,
     web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
     webkit_web_view_go_to_back_forward_item (web_view, item);
   }
+#endif
 }
 static GList*
 webkit_construct_history_list (WebKitWebView *web_view,
                                WebKitHistoryType hist_type,
                                int limit)
 {
+#ifdef HAVE_WEBKIT2
+  /* TODO: WebKitBackForwardList */
+  return NULL;
+#else
   WebKitWebBackForwardList *web_back_forward_list;
   GList *webkit_items;
 
@@ -428,6 +463,7 @@ webkit_construct_history_list (WebKitWebView *web_view,
                                                                           limit);
 
   return webkit_items;
+#endif
 }
 
 static GtkWidget *
@@ -453,7 +489,9 @@ build_dropdown_menu (EphyNavigationHistoryAction *action)
   else
     list = webkit_construct_history_list (web_view,
                                           WEBKIT_HISTORY_FORWARD, 10);
-
+#ifdef HAVE_WEBKIT2
+  /* TODO: WebKitBackForwardList */
+#else
   for (l = list; l != NULL; l = l->next) {
     GtkWidget *item;
     WebKitWebHistoryItem *hitem;
@@ -481,6 +519,7 @@ build_dropdown_menu (EphyNavigationHistoryAction *action)
     gtk_menu_shell_append (menu, item);
     gtk_widget_show_all (item);
   }
+#endif
 
   g_list_free (list);
 
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 70af83c..82db6f1 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -128,6 +128,9 @@ session_delete (EphySession *session,
 	g_object_unref (file);
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Loader */
+#else
 static void
 load_status_notify_cb (EphyWebView *view,
 		       GParamSpec *pspec,
@@ -142,6 +145,7 @@ load_status_notify_cb (EphyWebView *view,
 	    status == WEBKIT_LOAD_FINISHED)
 		ephy_session_save (session, SESSION_STATE);
 }
+#endif
 
 static void
 notebook_page_added_cb (GtkWidget *notebook,
@@ -149,8 +153,12 @@ notebook_page_added_cb (GtkWidget *notebook,
 			guint position,
 			EphySession *session)
 {
+#ifdef HAVE_WEBKIT2
+	/* TODO: Loader */
+#else
 	g_signal_connect (ephy_embed_get_web_view (embed), "notify::load-status",
 			  G_CALLBACK (load_status_notify_cb), session);
+#endif
 }
 
 static void
@@ -161,9 +169,13 @@ notebook_page_removed_cb (GtkWidget *notebook,
 {
 	ephy_session_save (session, SESSION_STATE);
 
+#ifdef HAVE_WEBKIT2
+	/* TODO: Loader */
+#else
 	g_signal_handlers_disconnect_by_func
 		(ephy_embed_get_web_view (embed), G_CALLBACK (load_status_notify_cb),
 		 session);
+#endif
 }
 
 static void
@@ -325,7 +337,11 @@ session_command_open_uris (EphySession *session,
 	{
 		const char *url = uris[i];
 		EphyNewTabFlags page_flags;
+#ifdef HAVE_WEBKIT2
+		WebKitURIRequest *request = NULL;
+#else
 		WebKitNetworkRequest *request = NULL;
+#endif
 
 		if (url[0] == '\0')
 		{
@@ -334,7 +350,11 @@ session_command_open_uris (EphySession *session,
 		else
 		{
 			page_flags = EPHY_NEW_TAB_OPEN_PAGE;
+#ifdef HAVE_WEBKIT2
+			request = webkit_uri_request_new (url);
+#else
 			request = webkit_network_request_new (url);
+#endif
 		}
 
 		/* For the first URI, if we have a valid recovery
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 8e5b98c..07a646e 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -669,7 +669,11 @@ EphyEmbed *
 ephy_shell_new_tab_full (EphyShell *shell,
                          EphyWindow *parent_window,
                          EphyEmbed *previous_embed,
+#ifdef HAVE_WEBKIT2
+                         WebKitURIRequest *request,
+#else
                          WebKitNetworkRequest *request,
+#endif
                          EphyNewTabFlags flags,
                          EphyWebViewChrome chrome,
                          gboolean is_popup,
@@ -761,7 +765,11 @@ ephy_shell_new_tab_full (EphyShell *shell,
     ephy_web_view_load_request (ephy_embed_get_web_view (embed),
                                 request);
 
+#ifdef HAVE_WEBKIT2
+    is_empty = ephy_embed_utils_url_is_empty (webkit_uri_request_get_uri (request));
+#else
     is_empty = ephy_embed_utils_url_is_empty (webkit_network_request_get_uri (request));
+#endif
   }
 
   /* Make sure the initial focus is somewhere sensible and not, for
@@ -804,7 +812,11 @@ ephy_shell_new_tab (EphyShell *shell,
                     EphyNewTabFlags flags)
 {
   EphyEmbed *embed;
+#ifdef HAVE_WEBKIT2
+  WebKitURIRequest *request = url ? webkit_uri_request_new (url) : NULL;
+#else
   WebKitNetworkRequest *request = url ? webkit_network_request_new (url) : NULL;
+#endif
 
   embed = ephy_shell_new_tab_full (shell, parent_window,
                                    previous_embed, request, flags,
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index 513605b..e7dc5ef 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -32,7 +32,11 @@
 #include "ephy-window.h"
 #include "ephy-embed.h"
 
+#ifdef HAVE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
 #include <webkit/webkit.h>
+#endif
 #include <glib-object.h>
 #include <glib.h>
 
@@ -145,7 +149,11 @@ EphyEmbed      *ephy_shell_new_tab                      (EphyShell *shell,
 EphyEmbed      *ephy_shell_new_tab_full                 (EphyShell *shell,
                                                          EphyWindow *parent_window,
                                                          EphyEmbed *previous_embed,
+#ifdef HAVE_WEBKIT2
+                                                         WebKitURIRequest *request,
+#else
                                                          WebKitNetworkRequest *request,
+#endif
                                                          EphyNewTabFlags flags,
                                                          EphyWebViewChrome chrome,
                                                          gboolean is_popup,
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 544ff59..5050452 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -65,7 +65,11 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <libsoup/soup.h>
+#ifdef HAVE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
 #include <webkit/webkit.h>
+#endif
 
 #ifdef HAVE_X11_XF86KEYSYM_H
 #include <X11/XF86keysym.h>
@@ -944,6 +948,9 @@ window_has_ongoing_downloads (EphyWindow *window)
 
 	for (l = downloads; l != NULL; l = l->next)
 	{
+#ifdef HAVE_WEBKIT2
+		/* TODO: Downloads */
+#else
 		EphyDownload *download;
 		WebKitDownloadStatus status;
 
@@ -958,6 +965,7 @@ window_has_ongoing_downloads (EphyWindow *window)
 			downloading = TRUE;
 			break;
 		}
+#endif
 	}
 	g_list_free (downloads);
 
@@ -1046,6 +1054,9 @@ update_popup_actions_visibility (EphyWindow *window,
 				 WebKitWebView *view,
 				 guint context)
 {
+#ifdef HAVE_WEBKIT2
+	/* TODO: ContextMenu */
+#else
 	GtkAction *action;
 	GtkActionGroup *action_group;
 	gboolean is_image = context & WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE;
@@ -1126,6 +1137,7 @@ update_popup_actions_visibility (EphyWindow *window,
 
 	if (guesses)
 		g_strfreev (guesses);
+#endif
 }
 
 static void
@@ -1154,6 +1166,9 @@ update_edit_actions_sensitivity (EphyWindow *window, gboolean hide)
 	}
 	else
 	{
+#ifdef HAVE_WEBKIT2
+		/* TODO: Editor */
+#else
 		EphyEmbed *embed;
 		WebKitWebView *view;
 
@@ -1167,6 +1182,7 @@ update_edit_actions_sensitivity (EphyWindow *window, gboolean hide)
 		can_paste = webkit_web_view_can_paste_clipboard (view);
 		can_undo = webkit_web_view_can_undo (view);
 		can_redo = webkit_web_view_can_redo (view);
+#endif
 	}
 
 	action_group = window->priv->action_group;
@@ -1742,6 +1758,9 @@ embed_popup_deactivate_cb (GtkWidget *popup,
 	_ephy_window_unset_context_event (window);
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Context Menu */
+#else
 static void
 show_embed_popup (EphyWindow *window,
 		  WebKitWebView *view,
@@ -1821,6 +1840,7 @@ show_embed_popup (EphyWindow *window,
 				gtk_get_current_event_time ());
 	}
 }
+#endif
 
 static gboolean
 save_property_url (EphyEmbed *embed,
@@ -1879,6 +1899,10 @@ ephy_window_dom_mouse_click_cb (WebKitWebView *view,
 				GdkEventButton *event,
 				EphyWindow *window)
 {
+#ifdef HAVE_WEBKIT2
+	/* TODO: Context Menu */
+	return FALSE;
+#else
 	guint button, modifier, context;
 	gboolean handled = FALSE;
 	gboolean with_control, with_shift;
@@ -1974,6 +1998,7 @@ ephy_window_dom_mouse_click_cb (WebKitWebView *view,
 
 	g_object_unref (hit_test_result);
 	return handled;
+#endif
 }
 
 static void
@@ -2000,6 +2025,9 @@ ephy_window_set_is_popup (EphyWindow *window,
 	g_object_notify (G_OBJECT (window), "is-popup");
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: New WebView */
+#else
 static gboolean
 web_view_ready_cb (WebKitWebView *web_view,
 		   WebKitWebView *parent_web_view)
@@ -2092,7 +2120,11 @@ create_web_view_cb (WebKitWebView *web_view,
 
 	return new_web_view;
 }
+#endif
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Policy client */
+#else
 static gboolean
 policy_decision_required_cb (WebKitWebView *web_view,
 			     WebKitWebFrame *web_frame,
@@ -2227,6 +2259,7 @@ policy_decision_required_cb (WebKitWebView *web_view,
 
 	return FALSE;
 }
+#endif
 
 static void
 ephy_window_connect_active_embed (EphyWindow *window)
@@ -2266,15 +2299,23 @@ ephy_window_connect_active_embed (EphyWindow *window)
 	g_signal_connect_object (web_view, "scroll-event",
 				 G_CALLBACK (scroll_event_cb),
 				 window, 0);
+#ifdef HAVE_WEBKIT2
+	/* TODO: New WebView */
+#else
 	g_signal_connect_object (web_view, "create-web-view",
 				 G_CALLBACK (create_web_view_cb),
 				 window, 0);
+#endif
+#ifdef HAVE_WEBKIT2
+	/* TODO: Policy Client */
+#else
 	g_signal_connect_object (web_view, "navigation-policy-decision-requested",
 				 G_CALLBACK (policy_decision_required_cb),
 				 window, 0);
 	g_signal_connect_object (web_view, "new-window-policy-decision-requested",
 				 G_CALLBACK (policy_decision_required_cb),
 				 window, 0);
+#endif
 
 	g_signal_connect_object (view, "notify::hidden-popup-count",
 				 G_CALLBACK (sync_tab_popup_windows),
@@ -2341,9 +2382,16 @@ ephy_window_disconnect_active_embed (EphyWindow *window)
 	g_signal_handlers_disconnect_by_func (web_view,
 					      G_CALLBACK (scroll_event_cb),
 					      window);
+#ifdef HAVE_WEBKIT2
+	/* TODO: New WebView */
+#else
 	g_signal_handlers_disconnect_by_func (web_view,
 					      G_CALLBACK (create_web_view_cb),
 					      window);
+#endif
+#ifdef HAVE_WEBKIT2
+	/* TODO: Policy client */
+#else
 	sid = g_signal_lookup ("navigation-policy-decision-requested",
 			       WEBKIT_TYPE_WEB_VIEW);
 	g_signal_handlers_disconnect_matched (web_view,
@@ -2362,6 +2410,7 @@ ephy_window_disconnect_active_embed (EphyWindow *window)
 					      0, NULL,
 					      G_CALLBACK (policy_decision_required_cb),
 					      NULL);
+#endif
 
 	g_signal_handlers_disconnect_by_func (view,
 					      G_CALLBACK (sync_tab_popup_windows),
@@ -2847,6 +2896,9 @@ downloads_close_cb (GtkButton *button, EphyWindow *window)
 	for (l = downloads; l != NULL; l = l->next)
 	{
 		EphyDownload *download;
+#ifdef HAVE_WEBKIT2
+		/* TODO: Downloads */
+#else
 		WebKitDownloadStatus status;
 
 		if (EPHY_IS_DOWNLOAD_WIDGET (l->data) != TRUE)
@@ -2859,6 +2911,7 @@ downloads_close_cb (GtkButton *button, EphyWindow *window)
 		{
 			gtk_widget_destroy (GTK_WIDGET (l->data));
 		}
+#endif
 	}
 	g_list_free (downloads);
 
diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c
index b8cb480..928d522 100644
--- a/src/pdm-dialog.c
+++ b/src/pdm-dialog.c
@@ -39,7 +39,11 @@
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 #include <libsoup/soup.h>
+#ifdef HAVE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
 #include <webkit/webkit.h>
+#endif
 #include <gnome-keyring.h>
 #include <gnome-keyring-memory.h>
 
@@ -168,10 +172,15 @@ typedef struct
 static SoupCookieJar*
 get_cookie_jar ()
 {
+#ifdef HAVE_WEBKIT2
+	/* TODO: Cookies */
+	return soup_cookie_jar_new ();
+#else
 	SoupSession* session;
 
 	session = webkit_get_default_session ();
 	return (SoupCookieJar*)soup_session_get_feature (session, SOUP_TYPE_COOKIE_JAR);
+#endif
 }
 
 static void
@@ -290,7 +299,11 @@ clear_all_dialog_response_cb (GtkDialog *dialog,
 
 			ephy_embed_single_clear_cache (single);
 
+#ifdef HAVE_WEBKIT2
+			/* TODO: Favicons */
+#else
 			webkit_favicon_database_clear (webkit_get_favicon_database ());
+#endif
 		}
 	}
 	gtk_widget_destroy (GTK_WIDGET (dialog));
diff --git a/src/popup-commands.c b/src/popup-commands.c
index ff6ee1f..e403e96 100644
--- a/src/popup-commands.c
+++ b/src/popup-commands.c
@@ -36,7 +36,11 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <string.h>
+#ifdef HAVE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
 #include <webkit/webkit.h>
+#endif
 
 void
 popup_cmd_link_in_new_window (GtkAction *action,
@@ -89,6 +93,9 @@ void
 popup_cmd_bookmark_link (GtkAction *action,
 			 EphyWindow *window)
 {
+#ifdef HAVE_WEBKIT2
+	/* TODO: Context Menu */
+#else
 	EphyEmbedEvent *event;
 	char *title;
 	char *location = NULL;
@@ -145,6 +152,7 @@ popup_cmd_bookmark_link (GtkAction *action,
 	ephy_bookmarks_ui_add_bookmark (GTK_WINDOW (window), location, title);
 	g_free (title);
 	g_free (location);
+#endif
 }
 
 static void
@@ -448,6 +456,9 @@ void
 popup_replace_spelling (GtkAction *action,
 			EphyWindow *window)
 {
+#ifdef HAVE_WEBKIT2
+	/* TODO: Context Menu, Spellchecker */
+#else
 	EphyEmbed *embed;
 	WebKitWebView *view;
 	WebKitWebFrame *frame;
@@ -469,6 +480,7 @@ popup_replace_spelling (GtkAction *action,
 	webkit_dom_dom_selection_modify (selection, "extend", "forward", "word");
 	frame = webkit_web_view_get_focused_frame (view);
 	webkit_web_frame_replace_selection (frame, gtk_action_get_label (action));
+#endif
 }
 
 void
@@ -516,6 +528,9 @@ popup_cmd_open_image (GtkAction *action,
 void
 popup_cmd_inspect_element (GtkAction *action, EphyWindow *window)
 {
+#ifdef HAVE_WEBKIT2
+	/* TODO: Context Menu, Inspector */
+#else
 	EphyEmbedEvent *event;
 	EphyEmbed *embed;
 	WebKitWebInspector *inspector;
@@ -532,4 +547,5 @@ popup_cmd_inspect_element (GtkAction *action, EphyWindow *window)
 
 	ephy_embed_event_get_coords (event, &x, &y);
 	webkit_web_inspector_inspect_coordinates (inspector, (gdouble)x, (gdouble)y);
+#endif
 }
diff --git a/src/window-commands.c b/src/window-commands.c
index 98364d7..5fc4dfd 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -57,7 +57,11 @@
 #include <gtk/gtk.h>
 #include <libnotify/notify.h>
 #include <string.h>
+#ifdef HAVE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
 #include <webkit/webkit.h>
+#endif
 
 void
 window_cmd_file_print (GtkAction *action,
@@ -275,6 +279,10 @@ window_cmd_file_open (GtkAction *action,
 static char *
 get_suggested_filename (EphyWebView *view)
 {
+#ifdef HAVE_WEBKIT2
+	/* TODO: Resources */
+	return g_strdup ("WebPage");
+#else
 	char *suggested_filename;
 	const char *mimetype;
 	WebKitWebFrame *frame;
@@ -299,6 +307,7 @@ get_suggested_filename (EphyWebView *view)
 	}
 
 	return suggested_filename;
+#endif
 }
 
 void
@@ -364,6 +373,9 @@ take_page_snapshot_and_set_image (EphyApplicationDialogData *data)
 	g_object_unref (snapshot);
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Downloads */
+#else
 static void
 download_status_changed_cb (WebKitDownload *download,
 			    GParamSpec *spec,
@@ -389,10 +401,14 @@ download_status_changed_cb (WebKitDownload *download,
 		break;
 	}
 }
+#endif
 
 static void
 download_icon_and_set_image (EphyApplicationDialogData *data)
 {
+#ifdef HAVE_WEBKIT2
+	/* TODO: Downloads */
+#else
 	WebKitNetworkRequest *request;
 	WebKitDownload *download;
 	char *destination, *destination_uri, *tmp_filename;
@@ -412,12 +428,16 @@ download_icon_and_set_image (EphyApplicationDialogData *data)
 	g_signal_connect (download, "notify::status",
 			  G_CALLBACK (download_status_changed_cb), data);
 
-	webkit_download_start (download);	
+	webkit_download_start (download);
+#endif
 }
 
 static void
 fill_default_application_image (EphyApplicationDialogData *data)
 {
+#ifdef HAVE_WEBKIT2
+	/* TODO: DOM Bindindgs */
+#else
 	WebKitDOMDocument *document;
 	WebKitDOMNodeList *links;
 	gulong length, i;
@@ -441,7 +461,7 @@ fill_default_application_image (EphyApplicationDialogData *data)
 			return;
 		}
 	}
-
+#endif
 	/* If we make it here, no "apple-touch-icon" link was
 	 * found. Take a snapshot of the page. */
 	take_page_snapshot_and_set_image (data);
@@ -665,7 +685,11 @@ window_cmd_edit_undo (GtkAction *action,
 
 		if (embed)
 		{
+#ifdef HAVE_WEBKIT2
+			/* TODO: Editor */
+#else
 			webkit_web_view_undo (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (EPHY_EMBED (embed)));
+#endif
 		}
 	}
 }
@@ -690,7 +714,11 @@ window_cmd_edit_redo (GtkAction *action,
 		embed = gtk_widget_get_ancestor (widget, EPHY_TYPE_EMBED);
 		if (embed)
 		{
+#ifdef HAVE_WEBKIT2
+			/* TODO: Editor */
+#else
 			webkit_web_view_redo (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (EPHY_EMBED (embed)));
+#endif
 		}
 	}
 }
@@ -710,7 +738,11 @@ window_cmd_edit_cut (GtkAction *action,
 		embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
 		g_return_if_fail (embed != NULL);
 
+#ifdef HAVE_WEBKIT2
+		/* TODO: Editor */
+#else
 		webkit_web_view_cut_clipboard (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
+#endif
 	}
 }
 
@@ -730,8 +762,11 @@ window_cmd_edit_copy (GtkAction *action,
 
 		embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
 		g_return_if_fail (embed != NULL);
-
+#ifdef HAVE_WEBKIT2
+		/* TODO: Editor */
+#else
 		webkit_web_view_copy_clipboard (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
+#endif
 	}
 }
 
@@ -752,7 +787,11 @@ window_cmd_edit_paste (GtkAction *action,
 		embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
 		g_return_if_fail (embed != NULL);
 
+#ifdef HAVE_WEBKIT2
+		/* TODO: Editor */
+#else
 		webkit_web_view_paste_clipboard (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
+#endif
 	}
 }
 
@@ -799,7 +838,11 @@ window_cmd_edit_select_all (GtkAction *action,
                   (EPHY_EMBED_CONTAINER (window));
 		g_return_if_fail (embed != NULL);
 
+#ifdef HAVE_WEBKIT2
+		/* TODO: Editor */
+#else
 		webkit_web_view_select_all (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
+#endif
 	}
 }
 
@@ -875,11 +918,14 @@ view_source_embedded (const char *uri, EphyEmbed *embed)
 			 embed,
 			 NULL,
 			 EPHY_NEW_TAB_JUMP | EPHY_NEW_TAB_IN_EXISTING_WINDOW | EPHY_NEW_TAB_APPEND_AFTER);
-
+#ifdef HAVE_WEBKIT2
+	/* TODO: View Source */
+#else
 	webkit_web_view_set_view_source_mode
 		(EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (new_embed), TRUE);
 	webkit_web_view_load_uri
 		(EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (new_embed), uri);
+#endif
 }
 
 
@@ -960,6 +1006,9 @@ save_temp_source_write_cb (GOutputStream *ostream, GAsyncResult *result, GString
 				     data);
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: Resources */
+#else
 static void
 save_temp_source_replace_cb (GFile *file, GAsyncResult *result, EphyEmbed *embed)
 {
@@ -1013,6 +1062,7 @@ save_temp_source_replace_cb (GFile *file, GAsyncResult *result, EphyEmbed *embed
 				     (GAsyncReadyCallback)save_temp_source_write_cb,
 				     data);
 }
+#endif
 
 static void
 save_temp_source (EphyEmbed *embed,
@@ -1037,11 +1087,15 @@ save_temp_source (EphyEmbed *embed,
 	}
 
 	file = g_file_new_for_path (tmp);
+#ifdef HAVE_WEBKIT2
+	/* TODO: Resources */
+#else
 	g_file_replace_async (file, NULL, FALSE,
 			      G_FILE_CREATE_REPLACE_DESTINATION|G_FILE_CREATE_PRIVATE,
 			      G_PRIORITY_DEFAULT, NULL,
 			      (GAsyncReadyCallback)save_temp_source_replace_cb,
 			      embed);
+#endif
 
 	g_object_unref (file);
 	g_free (tmp);
@@ -1182,11 +1236,15 @@ window_cmd_help_about (GtkAction *action,
 
 	g_key_file_free (key_file);
 
+#ifdef HAVE_WEBKIT2
+	/* TODO: WebKit Version */
+#else
 	comments = g_strdup_printf (_("Lets you view web pages and find information on the internet.\n"
 	                              "Powered by WebKit %d.%d.%d"),
 	                            webkit_major_version (),
 	                            webkit_minor_version (),
 	                            webkit_micro_version ());
+#endif
 
 	licence = g_strjoin ("\n\n",
 			     _(licence_part[0]),
diff --git a/tests/ephy-shell-test.c b/tests/ephy-shell-test.c
index 75a33e2..84626ae 100644
--- a/tests/ephy-shell-test.c
+++ b/tests/ephy-shell-test.c
@@ -284,6 +284,9 @@ test_ephy_shell_tab_no_history ()
   EphyEmbed *embed2;
   EphyEmbed *embed3;
 
+#ifdef HAVE_WEBKIT2
+  /* TODO: BackForwardList */
+#else
   WebKitWebBackForwardList *bflist;
   WebKitWebHistoryItem *item;
 
@@ -312,6 +315,7 @@ test_ephy_shell_tab_no_history ()
   g_assert_cmpint (webkit_web_back_forward_list_get_back_length (bflist), ==, 0);
 
   gtk_widget_destroy (window);
+#endif
 }
 
 int
diff --git a/tests/ephy-web-view-test.c b/tests/ephy-web-view-test.c
index bd0f2f0..31b6f78 100644
--- a/tests/ephy-web-view-test.c
+++ b/tests/ephy-web-view-test.c
@@ -63,6 +63,9 @@ server_callback (SoupServer *server,
   soup_message_body_complete (msg->response_body);
 }
 
+#ifdef HAVE_WEBKIT2
+/* TODO: loader */
+#else
 static void
 notify_load_status_cb (WebKitWebView *view, GParamSpec *spec, GMainLoop *loop)
 {
@@ -86,6 +89,7 @@ notify_load_status_cb (WebKitWebView *view, GParamSpec *spec, GMainLoop *loop)
   g_free (expected_url);
   g_main_loop_quit (loop);
 }
+#endif
 
 typedef struct {
   const char *url;
@@ -157,8 +161,12 @@ test_ephy_web_view_load_url ()
 
     g_test_message ("[%s] \t-> %s", test.url, test.expected_url);
 
+#ifdef HAVE_WEBKIT2
+    /* TODO: loader */
+#else
     g_signal_connect (view, "notify::load-status",
                       G_CALLBACK (notify_load_status_cb), loop);
+#endif
 
     g_main_loop_run (loop);
     g_main_loop_unref (loop);



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