Commit 3df6f8c4 authored by Carlos Garcia Campos's avatar Carlos Garcia Campos Committed by Carlos Garcia Campos

Remove all WebKit1 code

We are using WebKit2 unconditionally already.
parent 7213d38a
...@@ -79,8 +79,6 @@ GCR_REQUIRED=3.5.5 ...@@ -79,8 +79,6 @@ GCR_REQUIRED=3.5.5
AVAHI_REQUIRED=0.6.22 AVAHI_REQUIRED=0.6.22
WEBKIT_GTK_PC_NAME=webkit2gtk-3.0 WEBKIT_GTK_PC_NAME=webkit2gtk-3.0
AC_DEFINE([HAVE_WEBKIT2],[1],[Define if building with WebKit2])
AM_CONDITIONAL(WITH_WEBKIT2, [test "yes" = "yes"])
# Tests # Tests
......
...@@ -199,10 +199,6 @@ webkit_pref_callback_user_agent (GSettings *settings, ...@@ -199,10 +199,6 @@ webkit_pref_callback_user_agent (GSettings *settings,
"Epiphany", VERSION); "Epiphany", VERSION);
} }
/* This doesn't contain WebKit2 specific API, but it's only used inside
* HAVE_WEBKIT2 blocks, so it gives a compile warning when building
* with WebKit1.
*/
static gdouble static gdouble
get_screen_dpi (GdkScreen *screen) get_screen_dpi (GdkScreen *screen)
{ {
......
...@@ -2549,7 +2549,6 @@ ephy_web_view_set_typed_address (EphyWebView *view, ...@@ -2549,7 +2549,6 @@ ephy_web_view_set_typed_address (EphyWebView *view,
g_object_notify (G_OBJECT (view), "typed-address"); g_object_notify (G_OBJECT (view), "typed-address");
} }
#ifdef HAVE_WEBKIT2
static void static void
has_modified_forms_cb (GDBusProxy *web_extension, has_modified_forms_cb (GDBusProxy *web_extension,
GAsyncResult *result, GAsyncResult *result,
...@@ -2567,7 +2566,6 @@ has_modified_forms_cb (GDBusProxy *web_extension, ...@@ -2567,7 +2566,6 @@ has_modified_forms_cb (GDBusProxy *web_extension,
g_task_return_boolean (task, retval); g_task_return_boolean (task, retval);
g_object_unref (task); g_object_unref (task);
} }
#endif
/** /**
* ephy_web_view_has_modified_forms: * ephy_web_view_has_modified_forms:
...@@ -2590,7 +2588,6 @@ ephy_web_view_has_modified_forms (EphyWebView *view, ...@@ -2590,7 +2588,6 @@ ephy_web_view_has_modified_forms (EphyWebView *view,
gpointer user_data) gpointer user_data)
{ {
GTask *task = g_task_new (view, cancellable, callback, user_data); GTask *task = g_task_new (view, cancellable, callback, user_data);
#ifdef HAVE_WEBKIT2
GDBusProxy *web_extension; GDBusProxy *web_extension;
web_extension = ephy_embed_shell_get_web_extension_proxy (ephy_embed_shell_get_default ()); web_extension = ephy_embed_shell_get_web_extension_proxy (ephy_embed_shell_get_default ());
...@@ -2606,11 +2603,6 @@ ephy_web_view_has_modified_forms (EphyWebView *view, ...@@ -2606,11 +2603,6 @@ ephy_web_view_has_modified_forms (EphyWebView *view,
} else { } else {
g_task_return_boolean (task, FALSE); g_task_return_boolean (task, FALSE);
} }
#else
WebKitDOMDocument *document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (view));
g_task_return_boolean (task, ephy_web_dom_utils_has_modified_forms (document));
#endif
g_object_unref (task); g_object_unref (task);
} }
......
...@@ -66,7 +66,6 @@ typedef enum { ...@@ -66,7 +66,6 @@ typedef enum {
EPHY_PROCESS_OTHER EPHY_PROCESS_OTHER
} EphyProcess; } EphyProcess;
#ifdef HAVE_WEBKIT2
static const char *get_ephy_process_name (EphyProcess process) static const char *get_ephy_process_name (EphyProcess process)
{ {
switch (process) { switch (process) {
...@@ -82,7 +81,6 @@ static const char *get_ephy_process_name (EphyProcess process) ...@@ -82,7 +81,6 @@ static const char *get_ephy_process_name (EphyProcess process)
return NULL; return NULL;
} }
#endif
static void vma_free (VMA_t* vma) static void vma_free (VMA_t* vma)
{ {
...@@ -306,9 +304,7 @@ static void ephy_smaps_pid_to_html (EphySMaps *smaps, GString *str, pid_t pid, E ...@@ -306,9 +304,7 @@ static void ephy_smaps_pid_to_html (EphySMaps *smaps, GString *str, pid_t pid, E
g_slist_free (vma_entries); g_slist_free (vma_entries);
#ifdef HAVE_WEBKIT2
g_string_append_printf (str, "<h2>%s</h2>", get_ephy_process_name (process)); g_string_append_printf (str, "<h2>%s</h2>", get_ephy_process_name (process));
#endif
/* Anon table. */ /* Anon table. */
print_vma_table (str, anon_hash, "Anonymous memory"); print_vma_table (str, anon_hash, "Anonymous memory");
...@@ -321,7 +317,6 @@ static void ephy_smaps_pid_to_html (EphySMaps *smaps, GString *str, pid_t pid, E ...@@ -321,7 +317,6 @@ static void ephy_smaps_pid_to_html (EphySMaps *smaps, GString *str, pid_t pid, E
g_hash_table_unref (mapped_hash); g_hash_table_unref (mapped_hash);
} }
#ifdef HAVE_WEBKIT2
static pid_t get_pid_from_proc_name (const char *name) static pid_t get_pid_from_proc_name (const char *name)
{ {
guint i; guint i;
...@@ -442,7 +437,6 @@ static void ephy_smaps_pid_children_to_html (EphySMaps *smaps, GString *str, pid ...@@ -442,7 +437,6 @@ static void ephy_smaps_pid_children_to_html (EphySMaps *smaps, GString *str, pid
} }
g_dir_close (proc); g_dir_close (proc);
} }
#endif
char* ephy_smaps_to_html (EphySMaps *smaps) char* ephy_smaps_to_html (EphySMaps *smaps)
{ {
...@@ -452,10 +446,7 @@ char* ephy_smaps_to_html (EphySMaps *smaps) ...@@ -452,10 +446,7 @@ char* ephy_smaps_to_html (EphySMaps *smaps)
g_string_append (str, "<body>"); g_string_append (str, "<body>");
ephy_smaps_pid_to_html (smaps, str, pid, EPHY_PROCESS_EPIPHANY); ephy_smaps_pid_to_html (smaps, str, pid, EPHY_PROCESS_EPIPHANY);
#ifdef HAVE_WEBKIT2
ephy_smaps_pid_children_to_html (smaps, str, pid); ephy_smaps_pid_children_to_html (smaps, str, pid);
#endif
g_string_append (str, "</body>"); g_string_append (str, "</body>");
......
...@@ -27,11 +27,7 @@ ...@@ -27,11 +27,7 @@
#define GNOME_DESKTOP_USE_UNSTABLE_API #define GNOME_DESKTOP_USE_UNSTABLE_API
#endif #endif
#include <libgnome-desktop/gnome-desktop-thumbnail.h> #include <libgnome-desktop/gnome-desktop-thumbnail.h>
#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h> #include <webkit2/webkit2.h>
#else
#include <webkit/webkit.h>
#endif
#define EPHY_SNAPSHOT_SERVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EPHY_TYPE_SNAPSHOT_SERVICE, EphySnapshotServicePrivate)) #define EPHY_SNAPSHOT_SERVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EPHY_TYPE_SNAPSHOT_SERVICE, EphySnapshotServicePrivate))
...@@ -182,7 +178,6 @@ save_snapshot (cairo_surface_t *surface, ...@@ -182,7 +178,6 @@ save_snapshot (cairo_surface_t *surface,
(GAsyncReadyCallback)snapshot_saved, result); (GAsyncReadyCallback)snapshot_saved, result);
} }
#ifdef HAVE_WEBKIT2
static void static void
on_snapshot_ready (WebKitWebView *webview, on_snapshot_ready (WebKitWebView *webview,
GAsyncResult *result, GAsyncResult *result,
...@@ -202,46 +197,22 @@ on_snapshot_ready (WebKitWebView *webview, ...@@ -202,46 +197,22 @@ on_snapshot_ready (WebKitWebView *webview,
save_snapshot (surface, simple); save_snapshot (surface, simple);
cairo_surface_destroy (surface); cairo_surface_destroy (surface);
} }
#endif
static gboolean static gboolean
retrieve_snapshot_from_web_view (GSimpleAsyncResult *result) retrieve_snapshot_from_web_view (GSimpleAsyncResult *result)
{ {
#ifndef HAVE_WEBKIT2
cairo_surface_t *surface;
#endif
SnapshotAsyncData *data; SnapshotAsyncData *data;
data = (SnapshotAsyncData *)g_simple_async_result_get_op_res_gpointer (result); data = (SnapshotAsyncData *)g_simple_async_result_get_op_res_gpointer (result);
#ifdef HAVE_WEBKIT2
webkit_web_view_get_snapshot (data->web_view, webkit_web_view_get_snapshot (data->web_view,
WEBKIT_SNAPSHOT_REGION_VISIBLE, WEBKIT_SNAPSHOT_REGION_VISIBLE,
WEBKIT_SNAPSHOT_OPTIONS_NONE, WEBKIT_SNAPSHOT_OPTIONS_NONE,
NULL, (GAsyncReadyCallback)on_snapshot_ready, NULL, (GAsyncReadyCallback)on_snapshot_ready,
result); result);
#else
surface = webkit_web_view_get_snapshot (data->web_view);
if (surface == NULL) {
g_simple_async_result_set_error (result,
EPHY_SNAPSHOT_SERVICE_ERROR,
EPHY_SNAPSHOT_SERVICE_ERROR_WEB_VIEW,
"%s", "Error getting snapshot from web view");
g_simple_async_result_complete (result);
g_object_unref (result);
return FALSE;
}
save_snapshot (surface, result);
cairo_surface_destroy (surface);
#endif
return FALSE; return FALSE;
} }
#ifdef HAVE_WEBKIT2
static void static void
webview_load_changed_cb (WebKitWebView *webview, webview_load_changed_cb (WebKitWebView *webview,
WebKitLoadEvent load_event, WebKitLoadEvent load_event,
...@@ -277,33 +248,6 @@ webview_load_failed_cb (WebKitWebView *webview, ...@@ -277,33 +248,6 @@ webview_load_failed_cb (WebKitWebView *webview,
return FALSE; return FALSE;
} }
#else
static void
webview_load_status_changed_cb (WebKitWebView *webview,
GParamSpec *pspec,
GSimpleAsyncResult *result)
{
switch (webkit_web_view_get_load_status (webview)) {
case WEBKIT_LOAD_FINISHED:
/* Load finished doesn't ensure that we actually have visible
content yet, so hold a bit before retrieving the snapshot. */
g_idle_add ((GSourceFunc) retrieve_snapshot_from_web_view, result);
g_signal_handlers_disconnect_by_func (webview, webview_load_status_changed_cb, result);
break;
case WEBKIT_LOAD_FAILED:
g_signal_handlers_disconnect_by_func (webview, webview_load_status_changed_cb, result);
g_simple_async_result_set_error (result,
EPHY_SNAPSHOT_SERVICE_ERROR,
EPHY_SNAPSHOT_SERVICE_ERROR_WEB_VIEW,
"%s", "Error getting snapshot, web view failed to load");
g_simple_async_result_complete_in_idle (result);
g_object_unref (result);
break;
default:
break;
}
}
#endif
static gboolean static gboolean
ephy_snapshot_service_take_from_webview (GSimpleAsyncResult *result) ephy_snapshot_service_take_from_webview (GSimpleAsyncResult *result)
...@@ -312,7 +256,6 @@ ephy_snapshot_service_take_from_webview (GSimpleAsyncResult *result) ...@@ -312,7 +256,6 @@ ephy_snapshot_service_take_from_webview (GSimpleAsyncResult *result)
data = (SnapshotAsyncData *)g_simple_async_result_get_op_res_gpointer (result); data = (SnapshotAsyncData *)g_simple_async_result_get_op_res_gpointer (result);
#ifdef HAVE_WEBKIT2
if (webkit_web_view_get_estimated_load_progress (WEBKIT_WEB_VIEW (data->web_view)) == 1.0) if (webkit_web_view_get_estimated_load_progress (WEBKIT_WEB_VIEW (data->web_view)) == 1.0)
retrieve_snapshot_from_web_view (result); retrieve_snapshot_from_web_view (result);
else { else {
...@@ -321,14 +264,6 @@ ephy_snapshot_service_take_from_webview (GSimpleAsyncResult *result) ...@@ -321,14 +264,6 @@ ephy_snapshot_service_take_from_webview (GSimpleAsyncResult *result)
g_signal_connect (data->web_view, "load-failed", g_signal_connect (data->web_view, "load-failed",
G_CALLBACK (webview_load_failed_cb), result); G_CALLBACK (webview_load_failed_cb), result);
} }
#else
if (webkit_web_view_get_load_status (data->web_view) == WEBKIT_LOAD_FINISHED)
retrieve_snapshot_from_web_view (result);
else
g_signal_connect (data->web_view, "notify::load-status",
G_CALLBACK (webview_load_status_changed_cb),
result);
#endif
return FALSE; return FALSE;
} }
......
...@@ -22,11 +22,7 @@ ...@@ -22,11 +22,7 @@
#define _EPHY_SNAPSHOT_SERVICE_H #define _EPHY_SNAPSHOT_SERVICE_H
#include <gtk/gtk.h> #include <gtk/gtk.h>
#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h> #include <webkit2/webkit2.h>
#else
#include <webkit/webkit.h>
#endif
#include <glib-object.h> #include <glib-object.h>
......
...@@ -27,11 +27,7 @@ ...@@ -27,11 +27,7 @@
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include <libsoup/soup.h> #include <libsoup/soup.h>
#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h> #include <webkit2/webkit2.h>
#else
#include <webkit/webkit.h>
#endif
#define EPHY_WEB_APP_DESKTOP_FILE_PREFIX "epiphany-" #define EPHY_WEB_APP_DESKTOP_FILE_PREFIX "epiphany-"
...@@ -257,7 +253,6 @@ out: ...@@ -257,7 +253,6 @@ out:
return desktop_file_path; return desktop_file_path;
} }
#ifdef HAVE_WEBKIT2
static SoupCookieJar *get_current_cookie_jar (void) static SoupCookieJar *get_current_cookie_jar (void)
{ {
char *filename; char *filename;
...@@ -273,19 +268,6 @@ static SoupCookieJar *get_current_cookie_jar (void) ...@@ -273,19 +268,6 @@ static SoupCookieJar *get_current_cookie_jar (void)
return jar; return jar;
} }
#else
static SoupCookieJar *get_current_cookie_jar (void)
{
SoupSession *session = webkit_get_default_session ();
SoupCookieJar *jar;
jar = (SoupCookieJar*)soup_session_get_feature (session, SOUP_TYPE_COOKIE_JAR);
/* WebKit might not have a cookie jar yet, if it has not needed one
* and none has been set by Epiphany. */
return jar ? g_object_ref (jar) : NULL;
}
#endif
static void static void
create_cookie_jar_for_domain (const char *address, const char *directory) create_cookie_jar_for_domain (const char *address, const char *directory)
......
...@@ -26,12 +26,7 @@ ...@@ -26,12 +26,7 @@
#include <glib.h> #include <glib.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h> #include <webkit2/webkit2.h>
#else
#include <webkit/webkit.h>
#endif
G_BEGIN_DECLS G_BEGIN_DECLS
......
...@@ -31,11 +31,7 @@ ...@@ -31,11 +31,7 @@
#include "totem-glow-button.h" #include "totem-glow-button.h"
#include <glib/gi18n.h> #include <glib/gi18n.h>
#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h> #include <webkit2/webkit2.h>
#else
#include <webkit/webkit.h>
#endif
G_DEFINE_TYPE (EphyDownloadWidget, ephy_download_widget, GTK_TYPE_BOX) G_DEFINE_TYPE (EphyDownloadWidget, ephy_download_widget, GTK_TYPE_BOX)
...@@ -88,11 +84,7 @@ get_destination_basename_from_download (EphyDownload *ephy_download) ...@@ -88,11 +84,7 @@ get_destination_basename_from_download (EphyDownload *ephy_download)
char *unescaped; char *unescaped;
download = ephy_download_get_webkit_download (ephy_download); download = ephy_download_get_webkit_download (ephy_download);
#ifdef HAVE_WEBKIT2
dest = webkit_download_get_destination (download); dest = webkit_download_get_destination (download);
#else
dest = webkit_download_get_destination_uri (download);
#endif
if (!dest) if (!dest)
return NULL; return NULL;
...@@ -134,17 +126,11 @@ get_remaining_time (WebKitDownload *download) ...@@ -134,17 +126,11 @@ get_remaining_time (WebKitDownload *download)
gdouble elapsed_time; gdouble elapsed_time;
gdouble remaining_time; gdouble remaining_time;
gdouble per_byte_time; gdouble per_byte_time;
#ifdef HAVE_WEBKIT2
WebKitURIResponse *response; WebKitURIResponse *response;
response = webkit_download_get_response (download); response = webkit_download_get_response (download);
total = webkit_uri_response_get_content_length (response); total = webkit_uri_response_get_content_length (response);
cur = webkit_download_get_received_data_length (download); cur = webkit_download_get_received_data_length (download);
#else
total = webkit_download_get_total_size (download);
cur = webkit_download_get_current_size (download);
#endif
elapsed_time = webkit_download_get_elapsed_time (download); elapsed_time = webkit_download_get_elapsed_time (download);
if (cur <= 0) if (cur <= 0)
...@@ -193,11 +179,7 @@ update_download_label_and_tooltip (EphyDownloadWidget *widget, ...@@ -193,11 +179,7 @@ update_download_label_and_tooltip (EphyDownloadWidget *widget,
char *destination; char *destination;
download = ephy_download_get_webkit_download (widget->priv->download); download = ephy_download_get_webkit_download (widget->priv->download);
#ifdef HAVE_WEBKIT2
destination = g_filename_display_basename (webkit_download_get_destination (download)); destination = g_filename_display_basename (webkit_download_get_destination (download));
#else
destination = g_filename_display_basename (webkit_download_get_destination_uri (download));
#endif
remaining_tooltip = g_markup_printf_escaped ("%s\n%s", destination, download_label); remaining_tooltip = g_markup_printf_escaped ("%s\n%s", destination, download_label);
g_free (destination); g_free (destination);
...@@ -210,19 +192,10 @@ update_download_label_and_tooltip (EphyDownloadWidget *widget, ...@@ -210,19 +192,10 @@ update_download_label_and_tooltip (EphyDownloadWidget *widget,
static gboolean static gboolean
download_content_length_is_known (WebKitDownload *download) download_content_length_is_known (WebKitDownload *download)
{ {
#ifdef HAVE_WEBKIT2
WebKitURIResponse *response; WebKitURIResponse *response;
response = webkit_download_get_response (download); response = webkit_download_get_response (download);
return webkit_uri_response_get_content_length (response); return webkit_uri_response_get_content_length (response);
#else
WebKitNetworkResponse *response;
SoupMessage* message;
response = webkit_download_get_network_response (download);
message = webkit_network_response_get_message (response);
return soup_message_headers_get_content_length (message->response_headers) > 0;
#endif
} }
static void static void
...@@ -233,14 +206,10 @@ widget_progress_cb (WebKitDownload *download, ...@@ -233,14 +206,10 @@ widget_progress_cb (WebKitDownload *download,
int progress; int progress;
char *download_label = NULL; char *download_label = NULL;
#ifdef HAVE_WEBKIT2
if (!webkit_download_get_destination (download)) if (!webkit_download_get_destination (download))
return; return;
progress = webkit_download_get_estimated_progress (download) * 100; progress = webkit_download_get_estimated_progress (download) * 100;
#else
progress = webkit_download_get_progress (download) * 100;
#endif
if (progress % 10 == 0) if (progress % 10 == 0)
update_download_icon (widget); update_download_icon (widget);
...@@ -260,11 +229,7 @@ widget_progress_cb (WebKitDownload *download, ...@@ -260,11 +229,7 @@ widget_progress_cb (WebKitDownload *download,
gint64 current_size; gint64 current_size;
/* Unknown content length, show received bytes instead. */ /* Unknown content length, show received bytes instead. */
#ifdef HAVE_WEBKIT2
current_size = webkit_download_get_received_data_length (download); current_size = webkit_download_get_received_data_length (download);
#else
current_size = webkit_download_get_current_size (download);
#endif
if (current_size > 0) if (current_size > 0)
download_label = g_format_size (current_size); download_label = g_format_size (current_size);
} }
...@@ -275,7 +240,6 @@ widget_progress_cb (WebKitDownload *download, ...@@ -275,7 +240,6 @@ widget_progress_cb (WebKitDownload *download,
} }
} }
#ifdef HAVE_WEBKIT2
static void static void
widget_destination_changed_cb (WebKitDownload *download, widget_destination_changed_cb (WebKitDownload *download,
GParamSpec *pspec, GParamSpec *pspec,
...@@ -296,26 +260,7 @@ widget_finished_cb (WebKitDownload *download, ...@@ -296,26 +260,7 @@ widget_finished_cb (WebKitDownload *download,
update_download_label_and_tooltip (widget, _("Finished")); update_download_label_and_tooltip (widget, _("Finished"));
totem_glow_button_set_glow (TOTEM_GLOW_BUTTON (widget->priv->button), TRUE); totem_glow_button_set_glow (TOTEM_GLOW_BUTTON (widget->priv->button), TRUE);
} }
#else
static void
widget_status_cb (WebKitDownload *download,
GParamSpec *pspec,
EphyDownloadWidget *widget)
{
WebKitDownloadStatus status;
status = webkit_download_get_status (download);
if (status != WEBKIT_DOWNLOAD_STATUS_FINISHED)
return;
widget->priv->finished = TRUE;
update_download_label_and_tooltip (widget, _("Finished"));
totem_glow_button_set_glow (TOTEM_GLOW_BUTTON (widget->priv->button), TRUE);
}
#endif
#ifdef HAVE_WEBKIT2
static void static void
widget_failed_cb (WebKitDownload *download, widget_failed_cb (WebKitDownload *download,
GError *error, GError *error,
...@@ -330,31 +275,6 @@ widget_failed_cb (WebKitDownload *download, ...@@ -330,31 +275,6 @@ widget_failed_cb (WebKitDownload *download,
gtk_widget_set_tooltip_text (GTK_WIDGET (widget), error_msg); gtk_widget_set_tooltip_text (GTK_WIDGET (widget), error_msg);
g_free (error_msg); g_free (error_msg);
} }
#else
static gboolean
widget_error_cb (WebKitDownload *download,
gint error_code,