From 9b8c1020f2752ab5095086577ab98fa80926c43d Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Wed, 13 Jul 2016 17:28:15 +0200 Subject: Add View Source API and make the feature available from context menu [ChangeLog][QtWebEngineQML][QQuickWebEngineView] View Source feature is now supported [ChangeLog][QtWebEngineWidgets][QWebEnginePage] View Source feature is now supported Change-Id: Icc16da71fc6ec95880897fc9744dd8be8c004e00 Reviewed-by: Allan Sandfeld Jensen --- src/core/web_contents_adapter.cpp | 12 ++++++++++++ src/core/web_contents_adapter.h | 3 +++ 2 files changed, 15 insertions(+) (limited to 'src/core') diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 364d4d5b2..c3789318a 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -1281,4 +1281,16 @@ FaviconManager *WebContentsAdapter::faviconManager() return d->webContentsDelegate->faviconManager(); } +void WebContentsAdapter::viewSource() +{ + Q_D(WebContentsAdapter); + d->webContents->ViewSource(); +} + +bool WebContentsAdapter::canViewSource() +{ + Q_D(WebContentsAdapter); + return d->webContents->GetController().CanViewSource(); +} + } // namespace QtWebEngineCore diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h index 63b99d013..72e1f6447 100644 --- a/src/core/web_contents_adapter.h +++ b/src/core/web_contents_adapter.h @@ -178,6 +178,9 @@ public: content::WebContents *webContents() const; void replaceMisspelling(const QString &word); + void viewSource(); + bool canViewSource(); + private: Q_DISABLE_COPY(WebContentsAdapter) Q_DECLARE_PRIVATE(WebContentsAdapter) -- cgit v1.2.3