summaryrefslogtreecommitdiff
path: root/embed/ephy-embed-shell.c
diff options
context:
space:
mode:
Diffstat (limited to 'embed/ephy-embed-shell.c')
-rw-r--r--embed/ephy-embed-shell.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index 0c1d38a1a..ac08ca02c 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -40,6 +40,7 @@
#include "ephy-tabs-catalog.h"
#include "ephy-uri-helpers.h"
#include "ephy-uri-tester-shared.h"
+#include "ephy-view-source-handler.h"
#include "ephy-web-app-utils.h"
#include "ephy-web-extension-proxy.h"
@@ -68,6 +69,7 @@ typedef struct {
EphyDownloadsManager *downloads_manager;
EphyPermissionsManager *permissions_manager;
EphyAboutHandler *about_handler;
+ EphyViewSourceHandler *source_handler;
guint update_overview_timeout_id;
guint hiding_overview_item;
GDBusServer *dbus_server;
@@ -175,6 +177,7 @@ ephy_embed_shell_dispose (GObject *object)
g_clear_object (&priv->global_history_service);
g_clear_object (&priv->global_gsb_service);
g_clear_object (&priv->about_handler);
+ g_clear_object (&priv->source_handler);
g_clear_object (&priv->user_content);
g_clear_object (&priv->downloads_manager);
g_clear_object (&priv->permissions_manager);
@@ -676,6 +679,15 @@ about_request_cb (WebKitURISchemeRequest *request,
}
static void
+source_request_cb (WebKitURISchemeRequest *request,
+ EphyEmbedShell *shell)
+{
+ EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
+
+ ephy_view_source_handler_handle_request (priv->source_handler, request);
+}
+
+static void
ephy_resource_request_cb (WebKitURISchemeRequest *request)
{
const char *path;
@@ -1063,6 +1075,12 @@ ephy_embed_shell_startup (GApplication *application)
webkit_security_manager_register_uri_scheme_as_local (webkit_web_context_get_security_manager (priv->web_context),
EPHY_ABOUT_SCHEME);
+ /* view source handler */
+ priv->source_handler = ephy_view_source_handler_new ();
+ webkit_web_context_register_uri_scheme (priv->web_context, EPHY_VIEW_SOURCE_SCHEME,
+ (WebKitURISchemeRequestCallback)source_request_cb,
+ shell, NULL);
+
/* ephy-resource handler */
webkit_web_context_register_uri_scheme (priv->web_context, "ephy-resource",
(WebKitURISchemeRequestCallback)ephy_resource_request_cb,