summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/API/gtk
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2015-05-20 09:56:07 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2015-05-20 09:56:07 +0000
commit41386e9cb918eed93b3f13648cbef387e371e451 (patch)
treea97f9d7bd1d9d091833286085f72da9d83fd0606 /Source/WebKit2/UIProcess/API/gtk
parente15dd966d523731101f70ccf768bba12435a0208 (diff)
downloadWebKitGtk-tarball-41386e9cb918eed93b3f13648cbef387e371e451.tar.gz
webkitgtk-2.4.9webkitgtk-2.4.9
Diffstat (limited to 'Source/WebKit2/UIProcess/API/gtk')
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/APIWebsiteDataStoreGtk.cpp92
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp161
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h66
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.cpp126
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.h7
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationRequest.cpp48
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardList.cpp24
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListItem.cpp9
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListPrivate.h2
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitBatteryProvider.cpp4
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitBatteryProvider.h2
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitCertificateInfo.cpp120
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitCertificateInfo.h54
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitCertificateInfoPrivate.h (renamed from Source/WebKit2/UIProcess/API/gtk/WebKitInstallMissingMediaPluginsPermissionRequestPrivate.h)30
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitColorChooser.cpp83
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitColorChooser.h58
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitColorChooserRequest.cpp264
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitColorChooserRequest.h84
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitColorChooserRequestPrivate.h35
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitContextMenu.cpp64
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitContextMenu.h9
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuActions.cpp2
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuActions.h2
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuClient.cpp50
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItem.cpp54
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItem.h2
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItemPrivate.h4
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuPrivate.h5
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp58
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitCredential.cpp42
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitDefines.h5
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp93
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h7
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitDownloadClient.cpp23
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitDownloadPrivate.h2
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitEditingCommands.h25
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitEditorState.cpp145
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitEditorState.h87
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitEditorStatePrivate.h29
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp27
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitFaviconDatabase.cpp8
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitFileChooserRequest.cpp12
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp44
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitFindController.h2
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.cpp6
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp18
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequestPrivate.h2
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitForwardDeclarations.h2
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitGeolocationPermissionRequest.cpp3
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitGeolocationProvider.cpp11
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitGeolocationProvider.h2
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp69
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.h9
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResultPrivate.h4
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitInjectedBundleClient.cpp14
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitInstallMissingMediaPluginsPermissionRequest.cpp166
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitInstallMissingMediaPluginsPermissionRequest.h66
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitJavascriptResult.cpp14
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitJavascriptResultPrivate.h3
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp239
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitMimeInfo.cpp6
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitNavigationAction.cpp153
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitNavigationAction.h84
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitNavigationActionPrivate.h55
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.cpp113
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h47
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecisionPrivate.h4
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitNotification.cpp233
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitNotification.h78
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequest.cpp108
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequest.h59
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPrivate.h31
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.cpp129
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.h56
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitPlugin.cpp2
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.cpp78
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitPrintOperation.cpp25
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.cpp160
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h51
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitRequestManagerClient.cpp2
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp18
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecisionPrivate.h2
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitScriptDialog.cpp4
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitSecurityManager.cpp6
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp118
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h7
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp164
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.h61
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp309
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp50
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h4
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.cpp15
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitUserContent.cpp260
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitUserContent.h125
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManager.cpp266
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManager.h90
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManagerPrivate.h28
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitUserContentPrivate.h31
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitUserMediaPermissionRequest.cpp189
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitUserMediaPermissionRequest.h69
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitUserMediaPermissionRequestPrivate.h29
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitVersion.h.in6
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp489
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h28
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h9
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp60
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.h3
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebResource.cpp46
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebResourcePrivate.h1
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp1098
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h89
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp721
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp2
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h23
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebViewGroup.cpp288
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebViewGroup.h100
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebViewGroupPrivate.h (renamed from Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequestPrivate.h)13
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h17
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebsiteDataManager.cpp485
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebsiteDataManager.h87
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebsiteDataManagerPrivate.h30
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp63
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWindowPropertiesPrivate.h2
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebViewBaseInputMethodFilter.cpp100
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebViewBaseInputMethodFilter.h49
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml38
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt (renamed from Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt)303
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk.types (renamed from Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0.types)6
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/webkit2.h12
129 files changed, 2612 insertions, 7573 deletions
diff --git a/Source/WebKit2/UIProcess/API/gtk/APIWebsiteDataStoreGtk.cpp b/Source/WebKit2/UIProcess/API/gtk/APIWebsiteDataStoreGtk.cpp
deleted file mode 100644
index c6b0787c1..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/APIWebsiteDataStoreGtk.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2015 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "APIWebsiteDataStore.h"
-
-#include <WebCore/FileSystem.h>
-
-namespace API {
-
-String WebsiteDataStore::defaultApplicationCacheDirectory()
-{
- return cacheDirectoryFileSystemRepresentation("webkitgtk" G_DIR_SEPARATOR_S "applications");
-}
-
-String WebsiteDataStore::defaultNetworkCacheDirectory()
-{
-#if ENABLE(NETWORK_CACHE)
- static const char networkCacheSubdirectory[] = "WebKitCache";
-#else
- static const char networkCacheSubdirectory[] = "webkit";
-#endif
- return cacheDirectoryFileSystemRepresentation(WebCore::pathByAppendingComponent(WebCore::filenameToString(g_get_prgname()), networkCacheSubdirectory));
-}
-
-String WebsiteDataStore::defaultIndexedDBDatabaseDirectory()
-{
- return websiteDataDirectoryFileSystemRepresentation("webkitgtk" G_DIR_SEPARATOR_S "databases" G_DIR_SEPARATOR_S "indexeddb");
-}
-
-String WebsiteDataStore::defaultLocalStorageDirectory()
-{
- return websiteDataDirectoryFileSystemRepresentation("webkitgtk" G_DIR_SEPARATOR_S "localstorage");
-}
-
-String WebsiteDataStore::defaultMediaKeysStorageDirectory()
-{
- return websiteDataDirectoryFileSystemRepresentation("webkitgtk" G_DIR_SEPARATOR_S "mediakeys");
-}
-
-String WebsiteDataStore::defaultWebSQLDatabaseDirectory()
-{
- return websiteDataDirectoryFileSystemRepresentation("webkitgtk" G_DIR_SEPARATOR_S "databases");
-}
-
-String WebsiteDataStore::cacheDirectoryFileSystemRepresentation(const String& directoryName)
-{
- return WebCore::pathByAppendingComponent(WebCore::filenameToString(g_get_user_cache_dir()), directoryName);
-}
-
-String WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation(const String& directoryName)
-{
- return WebCore::pathByAppendingComponent(WebCore::filenameToString(g_get_user_data_dir()), directoryName);
-}
-
-WebKit::WebsiteDataStore::Configuration WebsiteDataStore::defaultDataStoreConfiguration()
-{
- WebKit::WebsiteDataStore::Configuration configuration;
-
- configuration.applicationCacheDirectory = defaultApplicationCacheDirectory();
- configuration.networkCacheDirectory = defaultNetworkCacheDirectory();
-
- configuration.webSQLDatabaseDirectory = defaultWebSQLDatabaseDirectory();
- configuration.localStorageDirectory = defaultLocalStorageDirectory();
- configuration.mediaKeysStorageDirectory = defaultMediaKeysStorageDirectory();
-
- return configuration;
-}
-
-} // namespace API
diff --git a/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp b/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp
index 796baad97..872a274c9 100644
--- a/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp
@@ -32,15 +32,12 @@
#include "NativeWebKeyboardEvent.h"
#include "NativeWebMouseEvent.h"
#include "NotImplemented.h"
-#include "WebColorPickerGtk.h"
+#include "WebContext.h"
#include "WebContextMenuProxyGtk.h"
#include "WebEventFactory.h"
-#include "WebKitColorChooser.h"
#include "WebKitWebViewBasePrivate.h"
-#include "WebKitWebViewPrivate.h"
#include "WebPageProxy.h"
#include "WebPopupMenuProxyGtk.h"
-#include "WebProcessPool.h"
#include <WebCore/Cursor.h>
#include <WebCore/EventNames.h>
#include <WebCore/GtkUtilities.h>
@@ -56,10 +53,23 @@ PageClientImpl::PageClientImpl(GtkWidget* viewWidget)
{
}
+PageClientImpl::~PageClientImpl()
+{
+}
+
+void PageClientImpl::getEditorCommandsForKeyEvent(const NativeWebKeyboardEvent& event, const AtomicString& eventType, Vector<WTF::String>& commandList)
+{
+ ASSERT(eventType == eventNames().keydownEvent || eventType == eventNames().keypressEvent);
+
+ KeyBindingTranslator::EventType type = eventType == eventNames().keydownEvent ?
+ KeyBindingTranslator::KeyDown : KeyBindingTranslator::KeyPress;
+ m_keyBindingTranslator.getEditorCommandsForKeyEvent(const_cast<GdkEventKey*>(&event.nativeEvent()->key), type, commandList);
+}
+
// PageClient's pure virtual functions
std::unique_ptr<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy()
{
- return std::make_unique<DrawingAreaProxyImpl>(*webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(m_viewWidget)));
+ return std::make_unique<DrawingAreaProxyImpl>(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(m_viewWidget)));
}
void PageClientImpl::setViewNeedsDisplay(const WebCore::IntRect& rect)
@@ -72,20 +82,18 @@ void PageClientImpl::displayView()
notImplemented();
}
-void PageClientImpl::scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& /* scrollOffset */)
+void PageClientImpl::scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset)
{
setViewNeedsDisplay(scrollRect);
}
-void PageClientImpl::requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&, bool)
-{
- notImplemented();
-}
-
WebCore::IntSize PageClientImpl::viewSize()
{
- auto* drawingArea = static_cast<DrawingAreaProxyImpl*>(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(m_viewWidget))->drawingArea());
- return drawingArea ? drawingArea->size() : IntSize();
+ if (!gtk_widget_get_realized(m_viewWidget))
+ return IntSize();
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(m_viewWidget, &allocation);
+ return IntSize(allocation.width, allocation.height);
}
bool PageClientImpl::isViewWindowActive()
@@ -108,14 +116,14 @@ bool PageClientImpl::isViewInWindow()
return webkitWebViewBaseIsInWindow(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
}
-void PageClientImpl::PageClientImpl::processDidExit()
+void PageClientImpl::PageClientImpl::processDidCrash()
{
notImplemented();
}
void PageClientImpl::didRelaunchProcess()
{
- webkitWebViewBaseDidRelaunchWebProcess(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
+ notImplemented();
}
void PageClientImpl::toolTipChanged(const String&, const String& newToolTip)
@@ -123,7 +131,7 @@ void PageClientImpl::toolTipChanged(const String&, const String& newToolTip)
webkitWebViewBaseSetTooltipText(WEBKIT_WEB_VIEW_BASE(m_viewWidget), newToolTip.utf8().data());
}
-void PageClientImpl::setCursor(const WebCore::Cursor& cursor)
+void PageClientImpl::setCursor(const Cursor& cursor)
{
if (!gtk_widget_get_realized(m_viewWidget))
return;
@@ -139,7 +147,7 @@ void PageClientImpl::setCursor(const WebCore::Cursor& cursor)
gdk_window_set_cursor(window, newCursor);
}
-void PageClientImpl::setCursorHiddenUntilMouseMoves(bool /* hiddenUntilMouseMoves */)
+void PageClientImpl::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
{
notImplemented();
}
@@ -181,7 +189,7 @@ FloatRect PageClientImpl::convertToUserSpace(const FloatRect& viewRect)
return viewRect;
}
-IntPoint PageClientImpl::screenToRootView(const IntPoint& point)
+IntPoint PageClientImpl::screenToWindow(const IntPoint& point)
{
IntPoint widgetPositionOnScreen = convertWidgetPointToScreenPoint(m_viewWidget, IntPoint());
IntPoint result(point);
@@ -189,7 +197,7 @@ IntPoint PageClientImpl::screenToRootView(const IntPoint& point)
return result;
}
-IntRect PageClientImpl::rootViewToScreen(const IntRect& rect)
+IntRect PageClientImpl::windowToScreen(const IntRect& rect)
{
return IntRect(convertWidgetPointToScreenPoint(m_viewWidget, rect.location()), rect.size());
}
@@ -206,52 +214,45 @@ void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool
gtk_main_do_event(event.nativeEvent());
}
-RefPtr<WebPopupMenuProxy> PageClientImpl::createPopupMenuProxy(WebPageProxy* page)
+PassRefPtr<WebPopupMenuProxy> PageClientImpl::createPopupMenuProxy(WebPageProxy* page)
{
return WebPopupMenuProxyGtk::create(m_viewWidget, page);
}
-RefPtr<WebContextMenuProxy> PageClientImpl::createContextMenuProxy(WebPageProxy* page)
+PassRefPtr<WebContextMenuProxy> PageClientImpl::createContextMenuProxy(WebPageProxy* page)
{
return WebContextMenuProxyGtk::create(m_viewWidget, page);
}
-RefPtr<WebColorPicker> PageClientImpl::createColorPicker(WebPageProxy* page, const WebCore::Color& color, const WebCore::IntRect& rect)
-{
- if (WEBKIT_IS_WEB_VIEW(m_viewWidget))
- return WebKitColorChooser::create(*page, color, rect);
- return WebColorPickerGtk::create(*page, color, rect);
-}
-
-void PageClientImpl::setTextIndicator(Ref<WebCore::TextIndicator>, WebCore::TextIndicatorLifetime)
-{
- notImplemented();
-}
-
-void PageClientImpl::clearTextIndicator(WebCore::TextIndicatorDismissalAnimation)
+#if ENABLE(INPUT_TYPE_COLOR)
+PassRefPtr<WebColorPicker> PageClientImpl::createColorPicker(WebPageProxy*, const WebCore::Color&, const WebCore::IntRect&)
{
notImplemented();
+ return 0;
}
+#endif
-void PageClientImpl::setTextIndicatorAnimationProgress(float)
+void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate)
{
notImplemented();
}
+#if USE(ACCELERATED_COMPOSITING)
void PageClientImpl::enterAcceleratedCompositingMode(const LayerTreeContext&)
{
- webkitWebViewBaseEnterAcceleratedCompositingMode(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
+ notImplemented();
}
void PageClientImpl::exitAcceleratedCompositingMode()
{
- webkitWebViewBaseExitAcceleratedCompositingMode(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
+ notImplemented();
}
void PageClientImpl::updateAcceleratedCompositingMode(const LayerTreeContext&)
{
notImplemented();
}
+#endif // USE(ACCELERATED_COMPOSITING)
void PageClientImpl::pageClosed()
{
@@ -263,22 +264,15 @@ void PageClientImpl::preferencesDidChange()
notImplemented();
}
-void PageClientImpl::selectionDidChange()
+void PageClientImpl::updateTextInputState()
{
webkitWebViewBaseUpdateTextInputState(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
- if (WEBKIT_IS_WEB_VIEW(m_viewWidget))
- webkitWebViewSelectionDidChange(WEBKIT_WEB_VIEW(m_viewWidget));
}
#if ENABLE(DRAG_SUPPORT)
void PageClientImpl::startDrag(const WebCore::DragData& dragData, PassRefPtr<ShareableBitmap> dragImage)
{
- WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(m_viewWidget);
- webkitWebViewBaseDragAndDropHandler(webView).startDrag(dragData, dragImage);
-
- // A drag starting should prevent a double-click from happening. This might
- // happen if a drag is followed very quickly by another click (like in the WTR).
- webkitWebViewBaseResetClickCounter(webView);
+ webkitWebViewBaseStartDrag(WEBKIT_WEB_VIEW_BASE(m_viewWidget), dragData, dragImage);
}
#endif
@@ -287,7 +281,7 @@ void PageClientImpl::handleDownloadRequest(DownloadProxy* download)
webkitWebViewBaseHandleDownloadRequest(WEBKIT_WEB_VIEW_BASE(m_viewWidget), download);
}
-void PageClientImpl::didCommitLoadForMainFrame(const String& /* mimeType */, bool /* useCustomContentProvider */ )
+void PageClientImpl::didCommitLoadForMainFrame()
{
webkitWebViewBaseResetClickCounter(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
}
@@ -325,30 +319,23 @@ void PageClientImpl::exitFullScreen()
webkitWebViewBaseExitFullScreen(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
}
-void PageClientImpl::beganEnterFullScreen(const IntRect& /* initialFrame */, const IntRect& /* finalFrame */)
+void PageClientImpl::beganEnterFullScreen(const IntRect& initialFrame, const IntRect& finalFrame)
{
notImplemented();
}
-void PageClientImpl::beganExitFullScreen(const IntRect& /* initialFrame */, const IntRect& /* finalFrame */)
+void PageClientImpl::beganExitFullScreen(const IntRect& initialFrame, const IntRect& finalFrame)
{
notImplemented();
}
#endif // ENABLE(FULLSCREEN_API)
-#if ENABLE(TOUCH_EVENTS)
void PageClientImpl::doneWithTouchEvent(const NativeWebTouchEvent& event, bool wasEventHandled)
{
if (wasEventHandled)
return;
-#if HAVE(GTK_GESTURES)
- GestureController& gestureController = webkitWebViewBaseGestureController(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
- if (gestureController.handleEvent(event.nativeEvent()))
- return;
-#endif
-
// Emulate pointer events if unhandled.
const GdkEvent* touchEvent = event.nativeEvent();
@@ -393,67 +380,5 @@ void PageClientImpl::doneWithTouchEvent(const NativeWebTouchEvent& event, bool w
gtk_widget_event(m_viewWidget, pointerEvent.get());
}
-#endif // ENABLE(TOUCH_EVENTS)
-
-void PageClientImpl::didFinishLoadingDataForCustomContentProvider(const String&, const IPC::DataReference&)
-{
-}
-
-void PageClientImpl::navigationGestureDidBegin()
-{
-}
-
-void PageClientImpl::navigationGestureWillEnd(bool, WebBackForwardListItem&)
-{
-}
-
-void PageClientImpl::navigationGestureDidEnd(bool, WebBackForwardListItem&)
-{
-}
-
-void PageClientImpl::navigationGestureDidEnd()
-{
-}
-
-void PageClientImpl::willRecordNavigationSnapshot(WebBackForwardListItem&)
-{
-}
-
-void PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame()
-{
-}
-
-void PageClientImpl::didFinishLoadForMainFrame()
-{
-}
-
-void PageClientImpl::didSameDocumentNavigationForMainFrame(SameDocumentNavigationType)
-{
-}
-
-void PageClientImpl::didChangeBackgroundColor()
-{
-}
-
-void PageClientImpl::refView()
-{
- g_object_ref(m_viewWidget);
-}
-
-void PageClientImpl::derefView()
-{
- g_object_unref(m_viewWidget);
-}
-
-#if ENABLE(VIDEO)
-bool PageClientImpl::decicePolicyForInstallMissingMediaPluginsPermissionRequest(InstallMissingMediaPluginsPermissionRequest& request)
-{
- if (!WEBKIT_IS_WEB_VIEW(m_viewWidget))
- return false;
-
- webkitWebViewRequestInstallMissingMediaPlugins(WEBKIT_WEB_VIEW(m_viewWidget), request);
- return true;
-}
-#endif
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h b/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h
index e9710dc8c..c420beec7 100644
--- a/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h
+++ b/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h
@@ -1,4 +1,3 @@
-
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
* Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
@@ -30,12 +29,13 @@
#define PageClientImpl_h
#include "DefaultUndoController.h"
+#include "KeyBindingTranslator.h"
#include "PageClient.h"
#include "WebFullScreenManagerProxy.h"
#include "WebPageProxy.h"
+#include "WindowsKeyboardCodes.h"
#include <WebCore/IntSize.h>
#include <gtk/gtk.h>
-#include <memory>
namespace WebKit {
@@ -48,24 +48,29 @@ class PageClientImpl : public PageClient
#endif
{
public:
- explicit PageClientImpl(GtkWidget*);
+ ~PageClientImpl();
+ static PassOwnPtr<PageClientImpl> create(GtkWidget* viewWidget)
+ {
+ return adoptPtr(new PageClientImpl(viewWidget));
+ }
GtkWidget* viewWidget() { return m_viewWidget; }
private:
+ explicit PageClientImpl(GtkWidget*);
+
// PageClient
virtual std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy() override;
virtual void setViewNeedsDisplay(const WebCore::IntRect&) override;
virtual void displayView() override;
virtual bool canScrollView() override { return false; }
virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) override;
- virtual void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll) override;
virtual WebCore::IntSize viewSize() override;
virtual bool isViewWindowActive() override;
virtual bool isViewFocused() override;
virtual bool isViewVisible() override;
virtual bool isViewInWindow() override;
- virtual void processDidExit() override;
+ virtual void processDidCrash() override;
virtual void didRelaunchProcess() override;
virtual void pageClosed() override;
virtual void preferencesDidChange() override;
@@ -79,30 +84,29 @@ private:
virtual void executeUndoRedo(WebPageProxy::UndoOrRedo) override;
virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&) override;
virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&) override;
- virtual WebCore::IntPoint screenToRootView(const WebCore::IntPoint&) override;
- virtual WebCore::IntRect rootViewToScreen(const WebCore::IntRect&) override;
+ virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) override;
+ virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) override;
virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) override;
- virtual RefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*) override;
- virtual RefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) override;
+ virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*) override;
+ virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) override;
#if ENABLE(INPUT_TYPE_COLOR)
- virtual RefPtr<WebColorPicker> createColorPicker(WebPageProxy*, const WebCore::Color& intialColor, const WebCore::IntRect&) override;
+ virtual PassRefPtr<WebColorPicker> createColorPicker(WebPageProxy*, const WebCore::Color& intialColor, const WebCore::IntRect&) override;
#endif
- virtual void setTextIndicator(Ref<WebCore::TextIndicator>, WebCore::TextIndicatorLifetime = WebCore::TextIndicatorLifetime::Permanent) override;
- virtual void clearTextIndicator(WebCore::TextIndicatorDismissalAnimation = WebCore::TextIndicatorDismissalAnimation::FadeOut) override;
- virtual void setTextIndicatorAnimationProgress(float) override;
- virtual void selectionDidChange() override;
+ virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate) override;
+ virtual void getEditorCommandsForKeyEvent(const NativeWebKeyboardEvent&, const AtomicString&, Vector<WTF::String>&) override;
+ virtual void updateTextInputState() override;
#if ENABLE(DRAG_SUPPORT)
virtual void startDrag(const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage) override;
#endif
+#if USE(ACCELERATED_COMPOSITING)
virtual void enterAcceleratedCompositingMode(const LayerTreeContext&) override;
virtual void exitAcceleratedCompositingMode() override;
virtual void updateAcceleratedCompositingMode(const LayerTreeContext&) override;
+#endif
virtual void handleDownloadRequest(DownloadProxy*) override;
- virtual void didChangeContentSize(const WebCore::IntSize&) override { }
- virtual void didCommitLoadForMainFrame(const String& mimeType, bool useCustomContentProvider) override;
- virtual void didFailLoadForMainFrame() override { }
+ virtual void didCommitLoadForMainFrame() override;
// Auxiliary Client Creation
#if ENABLE(FULLSCREEN_API)
@@ -119,38 +123,12 @@ private:
virtual void beganExitFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) override;
#endif
- virtual void didFinishLoadingDataForCustomContentProvider(const String& suggestedFilename, const IPC::DataReference&) override;
-
- virtual void navigationGestureDidBegin() override;
- virtual void navigationGestureWillEnd(bool, WebBackForwardListItem&) override;
- virtual void navigationGestureDidEnd(bool, WebBackForwardListItem&) override;
- virtual void navigationGestureDidEnd() override;
- virtual void willRecordNavigationSnapshot(WebBackForwardListItem&) override;
-
- virtual void didFirstVisuallyNonEmptyLayoutForMainFrame() override;
- virtual void didFinishLoadForMainFrame() override;
- virtual void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) override;
-
-#if ENABLE(TOUCH_EVENTS)
virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) override;
-#endif
-
- virtual void didChangeBackgroundColor() override;
-
-#if ENABLE(VIDEO)
- virtual void mediaDocumentNaturalSizeChanged(const WebCore::IntSize&) override { }
-#endif
-
- virtual void refView() override;
- virtual void derefView() override;
-
-#if ENABLE(VIDEO)
- virtual bool decicePolicyForInstallMissingMediaPluginsPermissionRequest(InstallMissingMediaPluginsPermissionRequest&) override;
-#endif
// Members of PageClientImpl class
GtkWidget* m_viewWidget;
DefaultUndoController m_undoController;
+ WebCore::KeyBindingTranslator m_keyBindingTranslator;
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.cpp
index fc856f698..43cd83ac0 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.cpp
@@ -25,17 +25,12 @@
#include "WebKitCredentialPrivate.h"
#include "WebKitPrivate.h"
#include "WebKitWebView.h"
-#include <glib/gi18n-lib.h>
-#include <wtf/text/CString.h>
using namespace WebKit;
struct _WebKitAuthenticationDialogPrivate {
GRefPtr<WebKitAuthenticationRequest> request;
- CredentialStorageMode credentialStorageMode;
- GtkWidget* loginEntry;
- GtkWidget* passwordEntry;
- GtkWidget* rememberCheckButton;
+ GtkWidget* authWidget;
GtkWidget* defaultButton;
unsigned long authenticationCancelledID;
GRefPtr<GtkStyleContext> styleContext;
@@ -46,15 +41,7 @@ WEBKIT_DEFINE_TYPE(WebKitAuthenticationDialog, webkit_authentication_dialog, GTK
static void okButtonClicked(GtkButton*, WebKitAuthenticationDialog* authDialog)
{
WebKitAuthenticationDialogPrivate* priv = authDialog->priv;
- const char* username = gtk_entry_get_text(GTK_ENTRY(priv->loginEntry));
- const char* password = gtk_entry_get_text(GTK_ENTRY(priv->passwordEntry));
- bool rememberPassword = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->rememberCheckButton));
-
- WebCore::CredentialPersistence persistence = rememberPassword && priv->credentialStorageMode == AllowPersistentStorage ?
- WebCore::CredentialPersistencePermanent : WebCore::CredentialPersistenceForSession;
-
- // FIXME: Use a stack allocated WebKitCredential.
- WebKitCredential* credential = webkitCredentialCreate(WebCore::Credential(String::fromUTF8(username), String::fromUTF8(password), persistence));
+ WebKitCredential* credential = webkitCredentialCreate(webkitAuthenticationWidgetCreateCredential(WEBKIT_AUTHENTICATION_WIDGET(priv->authWidget)));
webkit_authentication_request_authenticate(priv->request.get(), credential);
webkit_credential_free(credential);
gtk_widget_destroy(GTK_WIDGET(authDialog));
@@ -62,7 +49,7 @@ static void okButtonClicked(GtkButton*, WebKitAuthenticationDialog* authDialog)
static void cancelButtonClicked(GtkButton*, WebKitAuthenticationDialog* authDialog)
{
- webkit_authentication_request_authenticate(authDialog->priv->request.get(), nullptr);
+ webkit_authentication_request_authenticate(authDialog->priv->request.get(), 0);
gtk_widget_destroy(GTK_WIDGET(authDialog));
}
@@ -71,122 +58,34 @@ static void authenticationCancelled(WebKitAuthenticationRequest*, WebKitAuthenti
gtk_widget_destroy(GTK_WIDGET(authDialog));
}
-static GtkWidget* createLabelWithLineWrap(const char* text)
-{
- GtkWidget* label = gtk_label_new(text);
- gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
- gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
- gtk_label_set_max_width_chars(GTK_LABEL(label), 40);
- return label;
-}
-
-static void webkitAuthenticationDialogInitialize(WebKitAuthenticationDialog* authDialog)
+static void webkitAuthenticationDialogInitialize(WebKitAuthenticationDialog* authDialog, CredentialStorageMode credentialStorageMode)
{
GtkWidget* frame = gtk_frame_new(0);
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
GtkWidget* vBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
- gtk_container_set_border_width(GTK_CONTAINER(vBox), 12);
-
- GtkWidget* label = gtk_label_new(nullptr);
- // Title of the HTTP authentication dialog.
- GUniquePtr<char> title(g_strdup_printf("<b>%s</b>", _("Authentication Required")));
- gtk_label_set_markup(GTK_LABEL(label), title.get());
- gtk_widget_set_halign(label, GTK_ALIGN_CENTER);
- gtk_widget_show(label);
- gtk_box_pack_start(GTK_BOX(vBox), label, FALSE, FALSE, 0);
+ gtk_container_set_border_width(GTK_CONTAINER(vBox), 5);
GtkWidget* buttonBox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonBox), GTK_BUTTONBOX_END);
gtk_container_set_border_width(GTK_CONTAINER(buttonBox), 5);
gtk_box_set_spacing(GTK_BOX(buttonBox), 6);
- GtkWidget* button = gtk_button_new_with_mnemonic(_("_Cancel"));
+ GtkWidget* button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
g_signal_connect(button, "clicked", G_CALLBACK(cancelButtonClicked), authDialog);
gtk_box_pack_end(GTK_BOX(buttonBox), button, FALSE, TRUE, 0);
gtk_widget_show(button);
- WebKitAuthenticationDialogPrivate* priv = authDialog->priv;
- button = gtk_button_new_with_mnemonic(_("_Authenticate"));
- priv->defaultButton = button;
+ button = gtk_button_new_from_stock(GTK_STOCK_OK);
+ authDialog->priv->defaultButton = button;
g_signal_connect(button, "clicked", G_CALLBACK(okButtonClicked), authDialog);
gtk_widget_set_can_default(button, TRUE);
gtk_box_pack_end(GTK_BOX(buttonBox), button, FALSE, TRUE, 0);
gtk_widget_show(button);
- GtkWidget* authBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
- gtk_container_set_border_width(GTK_CONTAINER(authBox), 5);
-
- const WebCore::AuthenticationChallenge& challenge = webkitAuthenticationRequestGetAuthenticationChallenge(priv->request.get())->core();
- // Prompt on the HTTP authentication dialog.
- GUniquePtr<char> prompt(g_strdup_printf(_("Authentication required by %s:%i"),
- challenge.protectionSpace().host().utf8().data(), challenge.protectionSpace().port()));
- label = createLabelWithLineWrap(prompt.get());
- gtk_widget_show(label);
- gtk_box_pack_start(GTK_BOX(authBox), label, FALSE, FALSE, 0);
-
- String realm = challenge.protectionSpace().realm();
- if (!realm.isEmpty()) {
- // Label on the HTTP authentication dialog. %s is a (probably English) message from the website.
- GUniquePtr<char> message(g_strdup_printf(_("The site says: “%s”"), realm.utf8().data()));
- label = createLabelWithLineWrap(message.get());
- gtk_widget_show(label);
- gtk_box_pack_start(GTK_BOX(authBox), label, FALSE, FALSE, 0);
- }
-
- // Check button on the HTTP authentication dialog.
- priv->rememberCheckButton = gtk_check_button_new_with_mnemonic(_("_Remember password"));
- gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(priv->rememberCheckButton))), TRUE);
-
- priv->loginEntry = gtk_entry_new();
- gtk_widget_set_hexpand(priv->loginEntry, TRUE);
- gtk_entry_set_activates_default(GTK_ENTRY(priv->loginEntry), TRUE);
- gtk_widget_show(priv->loginEntry);
-
- // Entry on the HTTP authentication dialog.
- GtkWidget* loginLabel = gtk_label_new_with_mnemonic(_("_Username"));
- gtk_label_set_mnemonic_widget(GTK_LABEL(loginLabel), priv->loginEntry);
- gtk_widget_set_halign(loginLabel, GTK_ALIGN_END);
- gtk_style_context_add_class(gtk_widget_get_style_context(loginLabel), GTK_STYLE_CLASS_DIM_LABEL);
- gtk_widget_show(loginLabel);
-
- priv->passwordEntry = gtk_entry_new();
- gtk_widget_set_hexpand(priv->passwordEntry, TRUE);
- gtk_entry_set_activates_default(GTK_ENTRY(priv->passwordEntry), TRUE);
- gtk_widget_show(priv->passwordEntry);
-
- // Entry on the HTTP authentication dialog.
- GtkWidget* passwordLabel = gtk_label_new_with_mnemonic(_("_Password"));
- gtk_label_set_mnemonic_widget(GTK_LABEL(passwordLabel), priv->passwordEntry);
- gtk_widget_set_halign(passwordLabel, GTK_ALIGN_END);
- gtk_style_context_add_class(gtk_widget_get_style_context(passwordLabel), GTK_STYLE_CLASS_DIM_LABEL);
- gtk_widget_show(passwordLabel);
-
- GtkWidget* grid = gtk_grid_new();
- gtk_grid_set_column_spacing(GTK_GRID(grid), 6);
- gtk_grid_set_row_spacing(GTK_GRID(grid), 6);
- gtk_grid_attach(GTK_GRID(grid), loginLabel, 0, 0, 1, 1);
- gtk_grid_attach(GTK_GRID(grid), priv->loginEntry, 1, 0, 1, 1);
- gtk_grid_attach(GTK_GRID(grid), passwordLabel, 0, 1, 1, 1);
- gtk_grid_attach(GTK_GRID(grid), priv->passwordEntry, 1, 1, 1, 1);
- gtk_grid_attach(GTK_GRID(grid), priv->rememberCheckButton, 1, 2, 1, 1);
- gtk_widget_show(grid);
- gtk_box_pack_start(GTK_BOX(authBox), grid, FALSE, FALSE, 0);
-
- gtk_entry_set_visibility(GTK_ENTRY(priv->passwordEntry), FALSE);
- gtk_widget_set_visible(priv->rememberCheckButton, priv->credentialStorageMode != DisallowPersistentStorage && !realm.isEmpty());
-
- const WebCore::Credential& credentialFromPersistentStorage = challenge.proposedCredential();
- if (!credentialFromPersistentStorage.isEmpty()) {
- gtk_entry_set_text(GTK_ENTRY(priv->loginEntry), credentialFromPersistentStorage.user().utf8().data());
- gtk_entry_set_text(GTK_ENTRY(priv->passwordEntry), credentialFromPersistentStorage.password().utf8().data());
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->rememberCheckButton), TRUE);
- }
-
- gtk_widget_grab_focus(priv->loginEntry);
-
- gtk_box_pack_start(GTK_BOX(vBox), authBox, TRUE, TRUE, 0);
- gtk_widget_show(authBox);
+ authDialog->priv->authWidget = webkitAuthenticationWidgetNew(webkitAuthenticationRequestGetAuthenticationChallenge(authDialog->priv->request.get())->core(), credentialStorageMode);
+ gtk_box_pack_start(GTK_BOX(vBox), authDialog->priv->authWidget, TRUE, TRUE, 0);
+ gtk_widget_show(authDialog->priv->authWidget);
gtk_box_pack_end(GTK_BOX(vBox), buttonBox, FALSE, TRUE, 0);
gtk_widget_show(buttonBox);
@@ -260,7 +159,6 @@ GtkWidget* webkitAuthenticationDialogNew(WebKitAuthenticationRequest* request, C
{
WebKitAuthenticationDialog* authDialog = WEBKIT_AUTHENTICATION_DIALOG(g_object_new(WEBKIT_TYPE_AUTHENTICATION_DIALOG, NULL));
authDialog->priv->request = request;
- authDialog->priv->credentialStorageMode = mode;
- webkitAuthenticationDialogInitialize(authDialog);
+ webkitAuthenticationDialogInitialize(authDialog, mode);
return GTK_WIDGET(authDialog);
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.h b/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.h
index 0e5071f53..e5e62a7bd 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.h
@@ -21,13 +21,10 @@
#define WebKitAuthenticationDialog_h
#include "WebKitAuthenticationRequest.h"
+#include "WebKitAuthenticationWidget.h"
+#include "WebKitWebView.h"
#include <gtk/gtk.h>
-enum CredentialStorageMode {
- AllowPersistentStorage, // The user is asked whether to store credential information.
- DisallowPersistentStorage // Credential information is only kept in the session.
-};
-
G_BEGIN_DECLS
#define WEBKIT_TYPE_AUTHENTICATION_DIALOG (webkit_authentication_dialog_get_type())
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationRequest.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationRequest.cpp
index f79d03a4b..6f0c3707e 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationRequest.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationRequest.cpp
@@ -67,34 +67,17 @@ struct _WebKitAuthenticationRequestPrivate {
static guint signals[LAST_SIGNAL] = { 0, };
-WEBKIT_DEFINE_TYPE(WebKitAuthenticationRequest, webkit_authentication_request, G_TYPE_OBJECT)
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_AUTHENTICATION_SCHEME_DEFAULT, ProtectionSpaceAuthenticationSchemeDefault);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_AUTHENTICATION_SCHEME_HTTP_BASIC, ProtectionSpaceAuthenticationSchemeHTTPBasic);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_AUTHENTICATION_SCHEME_HTTP_DIGEST, ProtectionSpaceAuthenticationSchemeHTTPDigest);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_AUTHENTICATION_SCHEME_HTML_FORM, ProtectionSpaceAuthenticationSchemeHTMLForm);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_AUTHENTICATION_SCHEME_NTLM, ProtectionSpaceAuthenticationSchemeNTLM);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_AUTHENTICATION_SCHEME_NEGOTIATE, ProtectionSpaceAuthenticationSchemeNegotiate);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_AUTHENTICATION_SCHEME_CLIENT_CERTIFICATE_REQUESTED, ProtectionSpaceAuthenticationSchemeClientCertificateRequested);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_AUTHENTICATION_SCHEME_SERVER_TRUST_EVALUATION_REQUESTED, ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_AUTHENTICATION_SCHEME_UNKNOWN, ProtectionSpaceAuthenticationSchemeUnknown);
-static inline WebKitAuthenticationScheme toWebKitAuthenticationScheme(WebCore::ProtectionSpaceAuthenticationScheme coreScheme)
-{
- switch (coreScheme) {
- case WebCore::ProtectionSpaceAuthenticationSchemeDefault:
- return WEBKIT_AUTHENTICATION_SCHEME_DEFAULT;
- case WebCore::ProtectionSpaceAuthenticationSchemeHTTPBasic:
- return WEBKIT_AUTHENTICATION_SCHEME_HTTP_BASIC;
- case WebCore::ProtectionSpaceAuthenticationSchemeHTTPDigest:
- return WEBKIT_AUTHENTICATION_SCHEME_HTTP_DIGEST;
- case WebCore::ProtectionSpaceAuthenticationSchemeHTMLForm:
- return WEBKIT_AUTHENTICATION_SCHEME_HTML_FORM;
- case WebCore::ProtectionSpaceAuthenticationSchemeNTLM:
- return WEBKIT_AUTHENTICATION_SCHEME_NTLM;
- case WebCore::ProtectionSpaceAuthenticationSchemeNegotiate:
- return WEBKIT_AUTHENTICATION_SCHEME_NEGOTIATE;
- case WebCore::ProtectionSpaceAuthenticationSchemeClientCertificateRequested:
- return WEBKIT_AUTHENTICATION_SCHEME_CLIENT_CERTIFICATE_REQUESTED;
- case WebCore::ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested:
- return WEBKIT_AUTHENTICATION_SCHEME_SERVER_TRUST_EVALUATION_REQUESTED;
- case WebCore::ProtectionSpaceAuthenticationSchemeUnknown:
- return WEBKIT_AUTHENTICATION_SCHEME_UNKNOWN;
- default:
- ASSERT_NOT_REACHED();
- return WEBKIT_AUTHENTICATION_SCHEME_DEFAULT;
- }
-}
+WEBKIT_DEFINE_TYPE(WebKitAuthenticationRequest, webkit_authentication_request, G_TYPE_OBJECT)
static void webkitAuthenticationRequestDispose(GObject* object)
{
@@ -185,7 +168,7 @@ WebKitCredential* webkit_authentication_request_get_proposed_credential(WebKitAu
{
g_return_val_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request), 0);
- const WebCore::Credential& credential = request->priv->authenticationChallenge->proposedCredential()->credential();
+ const WebCore::Credential& credential = request->priv->authenticationChallenge->proposedCredential()->core();
if (credential.isEmpty())
return 0;
@@ -261,7 +244,7 @@ WebKitAuthenticationScheme webkit_authentication_request_get_scheme(WebKitAuthen
{
g_return_val_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request), WEBKIT_AUTHENTICATION_SCHEME_UNKNOWN);
- return toWebKitAuthenticationScheme(request->priv->authenticationChallenge->protectionSpace()->authenticationScheme());
+ return static_cast<WebKitAuthenticationScheme>(request->priv->authenticationChallenge->protectionSpace()->authenticationScheme());
}
/**
@@ -312,11 +295,8 @@ void webkit_authentication_request_authenticate(WebKitAuthenticationRequest* req
{
g_return_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request));
- if (credential)
- request->priv->authenticationChallenge->listener()->useCredential(WebCredential::create(webkitCredentialGetCredential(credential)).ptr());
- else
- request->priv->authenticationChallenge->listener()->useCredential(nullptr);
-
+ RefPtr<WebCredential> webCredential = credential ? WebCredential::create(webkitCredentialGetCredential(credential)) : 0;
+ request->priv->authenticationChallenge->listener()->useCredential(webCredential.get());
request->priv->handledRequest = true;
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardList.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardList.cpp
index 01e281002..6cbddc8aa 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardList.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardList.cpp
@@ -23,7 +23,7 @@
#include "WebKitBackForwardListPrivate.h"
#include "WebKitMarshal.h"
#include "WebKitPrivate.h"
-#include <wtf/glib/GRefPtr.h>
+#include <wtf/gobject/GRefPtr.h>
/**
* SECTION: WebKitBackForwardList
@@ -128,18 +128,20 @@ WebKitBackForwardList* webkitBackForwardListCreate(WebBackForwardList* backForwa
return list;
}
-void webkitBackForwardListChanged(WebKitBackForwardList* backForwardList, WebBackForwardListItem* webAddedItem, const Vector<RefPtr<WebBackForwardListItem>>& webRemovedItems)
+void webkitBackForwardListChanged(WebKitBackForwardList* backForwardList, WebBackForwardListItem* webAddedItem, API::Array* webRemovedItems)
{
WebKitBackForwardListItem* addedItem = webkitBackForwardListGetOrCreateItem(backForwardList, webAddedItem);
- GList* removedItems = nullptr;
+ GList* removedItems = 0;
+ size_t removedItemsSize = webRemovedItems ? webRemovedItems->size() : 0;
WebKitBackForwardListPrivate* priv = backForwardList->priv;
- for (auto& webItem : webRemovedItems) {
- removedItems = g_list_prepend(removedItems, g_object_ref(priv->itemsMap.get(webItem.get()).get()));
- priv->itemsMap.remove(webItem.get());
+ for (size_t i = 0; i < removedItemsSize; ++i) {
+ WebBackForwardListItem* webItem = static_cast<WebBackForwardListItem*>(webRemovedItems->at(i));
+ removedItems = g_list_prepend(removedItems, g_object_ref(G_OBJECT(priv->itemsMap.get(webItem).get())));
+ priv->itemsMap.remove(webItem);
}
- g_signal_emit(backForwardList, signals[CHANGED], 0, addedItem, removedItems, nullptr);
+ g_signal_emit(backForwardList, signals[CHANGED], 0, addedItem, removedItems, NULL);
g_list_free_full(removedItems, static_cast<GDestroyNotify>(g_object_unref));
}
@@ -250,8 +252,8 @@ GList* webkit_back_forward_list_get_back_list_with_limit(WebKitBackForwardList*
g_return_val_if_fail(WEBKIT_IS_BACK_FORWARD_LIST(backForwardList), 0);
WebKitBackForwardListPrivate* priv = backForwardList->priv;
- Ref<API::Array> apiArray = priv->backForwardItems->backListAsAPIArrayWithLimit(limit);
- return webkitBackForwardListCreateList(backForwardList, apiArray.ptr());
+ RefPtr<API::Array> apiArray = priv->backForwardItems->backListAsAPIArrayWithLimit(limit);
+ return webkitBackForwardListCreateList(backForwardList, apiArray.get());
}
/**
@@ -281,6 +283,6 @@ GList* webkit_back_forward_list_get_forward_list_with_limit(WebKitBackForwardLis
g_return_val_if_fail(WEBKIT_IS_BACK_FORWARD_LIST(backForwardList), 0);
WebKitBackForwardListPrivate* priv = backForwardList->priv;
- Ref<API::Array> apiArray = priv->backForwardItems->forwardListAsAPIArrayWithLimit(limit);
- return webkitBackForwardListCreateList(backForwardList, apiArray.ptr());
+ RefPtr<API::Array> apiArray = priv->backForwardItems->forwardListAsAPIArrayWithLimit(limit);
+ return webkitBackForwardListCreateList(backForwardList, apiArray.get());
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListItem.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListItem.cpp
index b295c9904..ae18b05ec 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListItem.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListItem.cpp
@@ -23,8 +23,7 @@
#include "WebKitBackForwardListPrivate.h"
#include "WebKitPrivate.h"
#include <wtf/HashMap.h>
-#include <wtf/NeverDestroyed.h>
-#include <wtf/glib/GRefPtr.h>
+#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/CString.h>
using namespace WebKit;
@@ -49,7 +48,7 @@ struct _WebKitBackForwardListItemPrivate {
WEBKIT_DEFINE_TYPE(WebKitBackForwardListItem, webkit_back_forward_list_item, G_TYPE_INITIALLY_UNOWNED)
-static void webkit_back_forward_list_item_class_init(WebKitBackForwardListItemClass*)
+static void webkit_back_forward_list_item_class_init(WebKitBackForwardListItemClass* listItemClass)
{
}
@@ -57,13 +56,13 @@ typedef HashMap<WebBackForwardListItem*, WebKitBackForwardListItem*> HistoryItem
static HistoryItemsMap& historyItemsMap()
{
- static NeverDestroyed<HistoryItemsMap> itemsMap;
+ DEFINE_STATIC_LOCAL(HistoryItemsMap, itemsMap, ());
return itemsMap;
}
static void webkitBackForwardListItemFinalized(gpointer webListItem, GObject* finalizedListItem)
{
- ASSERT_UNUSED(finalizedListItem, G_OBJECT(historyItemsMap().get(static_cast<WebBackForwardListItem*>(webListItem))) == finalizedListItem);
+ ASSERT(G_OBJECT(historyItemsMap().get(static_cast<WebBackForwardListItem*>(webListItem))) == finalizedListItem);
historyItemsMap().remove(static_cast<WebBackForwardListItem*>(webListItem));
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListPrivate.h
index 88ec1d01c..ef9052dc9 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListPrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListPrivate.h
@@ -32,6 +32,6 @@
WebKitBackForwardList* webkitBackForwardListCreate(WebKit::WebBackForwardList*);
WebKitBackForwardListItem* webkitBackForwardListItemGetOrCreate(WebKit::WebBackForwardListItem*);
WebKit::WebBackForwardListItem* webkitBackForwardListItemGetItem(WebKitBackForwardListItem*);
-void webkitBackForwardListChanged(WebKitBackForwardList*, WebKit::WebBackForwardListItem* webAddedItem, const Vector<RefPtr<WebKit::WebBackForwardListItem>>&);
+void webkitBackForwardListChanged(WebKitBackForwardList*, WebKit::WebBackForwardListItem* webAddedItem, API::Array* webRemovedItems);
#endif // WebKitBackForwardListPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitBatteryProvider.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitBatteryProvider.cpp
index 6b9b4cbef..3c1e4c6a8 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitBatteryProvider.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitBatteryProvider.cpp
@@ -43,9 +43,9 @@ static void stopUpdatingCallback(WKBatteryManagerRef batteryManager, const void*
toBatteryProvider(clientInfo)->stopUpdating();
}
-Ref<WebKitBatteryProvider> WebKitBatteryProvider::create(WebBatteryManagerProxy* batteryManager)
+PassRefPtr<WebKitBatteryProvider> WebKitBatteryProvider::create(WebBatteryManagerProxy* batteryManager)
{
- return adoptRef(*new WebKitBatteryProvider(batteryManager));
+ return adoptRef(new WebKitBatteryProvider(batteryManager));
}
WebKitBatteryProvider::WebKitBatteryProvider(WebBatteryManagerProxy* batteryManager)
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitBatteryProvider.h b/Source/WebKit2/UIProcess/API/gtk/WebKitBatteryProvider.h
index e2e94bf04..7f05db6c7 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitBatteryProvider.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitBatteryProvider.h
@@ -32,7 +32,7 @@ namespace WebKit {
class WebKitBatteryProvider : public RefCounted<WebKitBatteryProvider>, public WebCore::BatteryProviderUPowerClient {
public:
- static Ref<WebKitBatteryProvider> create(WebBatteryManagerProxy*);
+ static PassRefPtr<WebKitBatteryProvider> create(WebBatteryManagerProxy*);
virtual ~WebKitBatteryProvider();
void startUpdating();
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitCertificateInfo.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitCertificateInfo.cpp
new file mode 100644
index 000000000..12df1aaca
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitCertificateInfo.cpp
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebKitCertificateInfo.h"
+
+#include "WebKitCertificateInfoPrivate.h"
+#include <wtf/text/CString.h>
+
+using namespace WebKit;
+using namespace WebCore;
+
+/**
+ * SECTION: WebKitCertificateInfo
+ * @Short_description: Boxed type to encapsulate TLS certificate information
+ * @Title: WebKitCertificateInfo
+ * @See_also: #WebKitWebView, #WebKitWebContext
+ *
+ * When a client loads a page over HTTPS where there is an underlying TLS error
+ * WebKit will fire a #WebKitWebView::load-failed-with-tls-errors signal with a
+ * #WebKitCertificateInfo and the host of the failing URI.
+ *
+ * To handle this signal asynchronously you should make a copy of the
+ * #WebKitCertificateInfo with webkit_certificate_info_copy().
+ */
+
+G_DEFINE_BOXED_TYPE(WebKitCertificateInfo, webkit_certificate_info, webkit_certificate_info_copy, webkit_certificate_info_free)
+
+const CertificateInfo& webkitCertificateInfoGetCertificateInfo(WebKitCertificateInfo* info)
+{
+ ASSERT(info);
+ return info->certificateInfo;
+}
+
+/**
+ * webkit_certificate_info_copy:
+ * @info: a #WebKitCertificateInfo
+ *
+ * Make a copy of the #WebKitCertificateInfo.
+ *
+ * Returns: (transfer full): A copy of passed in #WebKitCertificateInfo.
+ *
+ * Since: 2.4
+ */
+WebKitCertificateInfo* webkit_certificate_info_copy(WebKitCertificateInfo* info)
+{
+ g_return_val_if_fail(info, 0);
+
+ WebKitCertificateInfo* copy = g_slice_new0(WebKitCertificateInfo);
+ new (copy) WebKitCertificateInfo(info);
+ return copy;
+}
+
+/**
+ * webkit_certificate_info_free:
+ * @info: a #WebKitCertificateInfo
+ *
+ * Free the #WebKitCertificateInfo.
+ *
+ * Since: 2.4
+ */
+void webkit_certificate_info_free(WebKitCertificateInfo* info)
+{
+ g_return_if_fail(info);
+
+ info->~WebKitCertificateInfo();
+ g_slice_free(WebKitCertificateInfo, info);
+}
+
+/**
+ * webkit_certificate_info_get_tls_certificate:
+ * @info: a #WebKitCertificateInfo
+ *
+ * Get the #GTlsCertificate associated with this
+ * #WebKitCertificateInfo.
+ *
+ * Returns: (transfer none): The certificate of @info.
+ *
+ * Since: 2.4
+ */
+GTlsCertificate* webkit_certificate_info_get_tls_certificate(WebKitCertificateInfo *info)
+{
+ g_return_val_if_fail(info, 0);
+
+ return info->certificateInfo.certificate();
+}
+
+/**
+ * webkit_certificate_info_get_tls_errors:
+ * @info: a #WebKitCertificateInfo
+ *
+ * Get the #GTlsCertificateFlags verification status associated with this
+ * #WebKitCertificateInfo.
+ *
+ * Returns: The verification status of @info.
+ *
+ * Since: 2.4
+ */
+GTlsCertificateFlags webkit_certificate_info_get_tls_errors(WebKitCertificateInfo *info)
+{
+ g_return_val_if_fail(info, static_cast<GTlsCertificateFlags>(0));
+
+ return info->certificateInfo.tlsErrors();
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitCertificateInfo.h b/Source/WebKit2/UIProcess/API/gtk/WebKitCertificateInfo.h
new file mode 100644
index 000000000..eef16405e
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitCertificateInfo.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
+#error "Only <webkit2/webkit2.h> can be included directly."
+#endif
+
+#ifndef WebKitCertificateInfo_h
+#define WebKitCertificateInfo_h
+
+#include <gio/gio.h>
+#include <glib-object.h>
+#include <webkit2/WebKitDefines.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_CERTIFICATE_INFO (webkit_certificate_info_get_type())
+
+typedef struct _WebKitCertificateInfo WebKitCertificateInfo;
+
+WEBKIT_API GType
+webkit_certificate_info_get_type (void);
+
+WEBKIT_API WebKitCertificateInfo *
+webkit_certificate_info_copy (WebKitCertificateInfo *info);
+
+WEBKIT_API void
+webkit_certificate_info_free (WebKitCertificateInfo *info);
+
+WEBKIT_API GTlsCertificate *
+webkit_certificate_info_get_tls_certificate (WebKitCertificateInfo *info);
+
+WEBKIT_API GTlsCertificateFlags
+webkit_certificate_info_get_tls_errors (WebKitCertificateInfo *info);
+
+G_END_DECLS
+
+#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitInstallMissingMediaPluginsPermissionRequestPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitCertificateInfoPrivate.h
index 2c7e3bc0d..ab3f1ef39 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitInstallMissingMediaPluginsPermissionRequestPrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitCertificateInfoPrivate.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Igalia S.L.
+ * Copyright (C) 2013 Samsung Electronics Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -17,15 +17,27 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef WebKitInstallMissingMediaPluginsPermissionRequestPrivate_h
-#define WebKitInstallMissingMediaPluginsPermissionRequestPrivate_h
+#ifndef WebKitCertificateInfoPrivate_h
+#define WebKitCertificateInfoPrivate_h
-#include "InstallMissingMediaPluginsPermissionRequest.h"
-#include "WebKitInstallMissingMediaPluginsPermissionRequest.h"
+#include "WebKitCertificateInfo.h"
#include "WebKitPrivate.h"
+#include <WebCore/CertificateInfo.h>
-#if ENABLE(VIDEO)
-WebKitInstallMissingMediaPluginsPermissionRequest* webkitInstallMissingMediaPluginsPermissionRequestCreate(WebKit::InstallMissingMediaPluginsPermissionRequest&);
-#endif
+struct _WebKitCertificateInfo {
+ _WebKitCertificateInfo(GTlsCertificate* certificate, GTlsCertificateFlags tlsErrors)
+ : certificateInfo(certificate, tlsErrors)
+ {
+ }
-#endif // WebKitInstallMissingMediaPluginsPermissionRequestPrivate_h
+ _WebKitCertificateInfo(WebKitCertificateInfo* info)
+ : certificateInfo(info->certificateInfo)
+ {
+ }
+
+ WebCore::CertificateInfo certificateInfo;
+};
+
+const WebCore::CertificateInfo& webkitCertificateInfoGetCertificateInfo(WebKitCertificateInfo*);
+
+#endif // WebKitCertificateInfoPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitColorChooser.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitColorChooser.cpp
deleted file mode 100644
index 71919d8f6..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitColorChooser.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2015 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "WebKitColorChooser.h"
-
-#include "WebKitColorChooserRequestPrivate.h"
-#include "WebKitWebViewPrivate.h"
-#include <WebCore/Color.h>
-#include <WebCore/IntRect.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-Ref<WebKitColorChooser> WebKitColorChooser::create(WebPageProxy& page, const WebCore::Color& initialColor, const WebCore::IntRect& rect)
-{
- return adoptRef(*new WebKitColorChooser(page, initialColor, rect));
-}
-
-WebKitColorChooser::WebKitColorChooser(WebPageProxy& page, const Color& initialColor, const IntRect& rect)
- : WebColorPickerGtk(page, initialColor, rect)
- , m_elementRect(rect)
-{
-}
-
-WebKitColorChooser::~WebKitColorChooser()
-{
- endPicker();
-}
-
-void WebKitColorChooser::endPicker()
-{
- if (!m_request) {
- WebColorPickerGtk::endPicker();
- return;
- }
-
- webkit_color_chooser_request_finish(m_request.get());
-}
-
-void WebKitColorChooser::colorChooserRequestFinished(WebKitColorChooserRequest*, WebKitColorChooser* colorChooser)
-{
- colorChooser->m_request = nullptr;
-}
-
-void WebKitColorChooser::colorChooserRequestRGBAChanged(WebKitColorChooserRequest* request, GParamSpec*, WebKitColorChooser* colorChooser)
-{
- GdkRGBA rgba;
- webkit_color_chooser_request_get_rgba(request, &rgba);
- colorChooser->didChooseColor(rgba);
-}
-
-void WebKitColorChooser::showColorPicker(const Color& color)
-{
- m_initialColor = color;
- GRefPtr<WebKitColorChooserRequest> request = adoptGRef(webkitColorChooserRequestCreate(this));
- g_signal_connect(request.get(), "notify::rgba", G_CALLBACK(WebKitColorChooser::colorChooserRequestRGBAChanged), this);
- g_signal_connect(request.get(), "finished", G_CALLBACK(WebKitColorChooser::colorChooserRequestFinished), this);
-
- if (webkitWebViewEmitRunColorChooser(WEBKIT_WEB_VIEW(m_webView), request.get()))
- m_request = request;
- else
- WebColorPickerGtk::showColorPicker(color);
-}
-
-} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitColorChooser.h b/Source/WebKit2/UIProcess/API/gtk/WebKitColorChooser.h
deleted file mode 100644
index f2bf35edf..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitColorChooser.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2015 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef WebKitColorChooser_h
-#define WebKitColorChooser_h
-
-#include "WebColorPickerGtk.h"
-#include "WebKitPrivate.h"
-#include <wtf/glib/GRefPtr.h>
-
-typedef struct _WebKitColorChooserRequest WebKitColorChooserRequest;
-
-namespace WebCore {
-class Color;
-class IntRect;
-}
-
-namespace WebKit {
-
-class WebKitColorChooser final : public WebColorPickerGtk {
-public:
- static Ref<WebKitColorChooser> create(WebPageProxy&, const WebCore::Color&, const WebCore::IntRect&);
- virtual ~WebKitColorChooser();
-
- const WebCore::IntRect& elementRect() const { return m_elementRect; }
-
-private:
- WebKitColorChooser(WebPageProxy&, const WebCore::Color&, const WebCore::IntRect&);
-
- virtual void endPicker() override;
- virtual void showColorPicker(const WebCore::Color&) override;
-
- static void colorChooserRequestFinished(WebKitColorChooserRequest*, WebKitColorChooser*);
- static void colorChooserRequestRGBAChanged(WebKitColorChooserRequest*, GParamSpec*, WebKitColorChooser*);
-
- GRefPtr<WebKitColorChooserRequest> m_request;
- WebCore::IntRect m_elementRect;
-};
-
-} // namespace WebKit
-
-#endif // WebKitColorChooser_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitColorChooserRequest.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitColorChooserRequest.cpp
deleted file mode 100644
index 98dad2514..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitColorChooserRequest.cpp
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Copyright (C) 2015 Igalia S.L.
- * Copyright (c) 2012, Samsung Electronics
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "WebKitColorChooserRequest.h"
-
-#include "WebKitColorChooserRequestPrivate.h"
-#include <glib/gi18n-lib.h>
-
-using namespace WebKit;
-using namespace WebCore;
-
-/**
- * SECTION: WebKitColorChooserRequest
- * @Short_description: A request to open a color chooser
- * @Title: WebKitColorChooserRequest
- * @See_also: #WebKitWebView
- *
- * Whenever the user interacts with an &lt;input type='color' /&gt;
- * HTML element, WebKit will need to show a dialog to choose a color. For that
- * to happen in a general way, instead of just opening a #GtkColorChooser
- * (which might be not desirable in some cases, which could prefer to use their
- * own color chooser dialog), WebKit will fire the
- * #WebKitWebView::run-color-chooser signal with a #WebKitColorChooserRequest
- * object, which will allow the client application to specify the color to be
- * selected, to inspect the details of the request (e.g. to get initial color)
- * and to cancel the request, in case nothing was selected.
- *
- * In case the client application does not wish to handle this signal,
- * WebKit will provide a default handler which will asynchronously run
- * a regular #GtkColorChooserDialog for the user to interact with.
- */
-
-enum {
- PROP_0,
-
- PROP_RGBA
-};
-
-enum {
- FINISHED,
-
- LAST_SIGNAL
-};
-
-struct _WebKitColorChooserRequestPrivate {
- WebKitColorChooser* colorChooser;
- GdkRGBA rgba;
- bool handled;
-};
-
-static guint signals[LAST_SIGNAL] = { 0, };
-
-WEBKIT_DEFINE_TYPE(WebKitColorChooserRequest, webkit_color_chooser_request, G_TYPE_OBJECT)
-
-static void webkitColorChooserRequestDispose(GObject* object)
-{
- WebKitColorChooserRequest* request = WEBKIT_COLOR_CHOOSER_REQUEST(object);
- if (!request->priv->handled)
- webkit_color_chooser_request_finish(request);
-
- G_OBJECT_CLASS(webkit_color_chooser_request_parent_class)->dispose(object);
-}
-
-static void webkitColorChooserRequestGetProperty(GObject* object, guint propertyID, GValue* value, GParamSpec* paramSpec)
-{
- WebKitColorChooserRequest* request = WEBKIT_COLOR_CHOOSER_REQUEST(object);
-
- switch (propertyID) {
- case PROP_RGBA:
- g_value_set_boxed(value, &request->priv->rgba);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyID, paramSpec);
- }
-}
-
-static void webkitColorChooserRequestSetProperty(GObject* object, guint propertyID, const GValue* value, GParamSpec* paramSpec)
-{
- WebKitColorChooserRequest* request = WEBKIT_COLOR_CHOOSER_REQUEST(object);
-
- switch (propertyID) {
- case PROP_RGBA:
- webkit_color_chooser_request_set_rgba(request, static_cast<GdkRGBA*>(g_value_get_boxed(value)));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyID, paramSpec);
- }
-}
-
-static void webkit_color_chooser_request_class_init(WebKitColorChooserRequestClass* requestClass)
-{
- GObjectClass* objectClass = G_OBJECT_CLASS(requestClass);
- objectClass->dispose = webkitColorChooserRequestDispose;
- objectClass->get_property = webkitColorChooserRequestGetProperty;
- objectClass->set_property = webkitColorChooserRequestSetProperty;
-
- /**
- * WebKitWebView:rgba:
- *
- * The #GdkRGBA color of the request
- *
- * Since: 2.8
- */
- g_object_class_install_property(objectClass,
- PROP_RGBA,
- g_param_spec_boxed("rgba",
- _("Current RGBA color"),
- _("The current RGBA color for the request"),
- GDK_TYPE_RGBA,
- static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT)));
-
- /**
- * WebKitColorChooserRequest::finished:
- * @request: the #WebKitColorChooserRequest on which the signal is emitted
- *
- * Emitted when the @request finishes. This signal can be emitted because the
- * user completed the @request calling webkit_color_chooser_request_finish(),
- * or cancelled it with webkit_color_chooser_request_cancel() or because the
- * color input element is removed from the DOM.
- *
- * Since: 2.8
- */
- signals[FINISHED] =
- g_signal_new(
- "finished",
- G_TYPE_FROM_CLASS(requestClass),
- G_SIGNAL_RUN_LAST,
- 0, 0,
- nullptr,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
-
-/**
- * webkit_color_chooser_request_set_rgba:
- * @request: a #WebKitFileChooserRequest
- * @rgba: a pointer #GdkRGBA
- *
- * Sets the current #GdkRGBA color of @request
- *
- * Since: 2.8
- */
-void webkit_color_chooser_request_set_rgba(WebKitColorChooserRequest* request, const GdkRGBA* rgba)
-{
- g_return_if_fail(WEBKIT_IS_COLOR_CHOOSER_REQUEST(request));
- g_return_if_fail(rgba);
-
- if (gdk_rgba_equal(&request->priv->rgba, rgba))
- return;
-
- request->priv->rgba = *rgba;
- g_object_notify(G_OBJECT(request), "rgba");
-}
-
-/**
- * webkit_color_chooser_request_get_rgba:
- * @request: a #WebKitColorChooserRequest
- * @rgba: (out): a #GdkRGBA to fill in with the current color.
- *
- * Gets the current #GdkRGBA color of @request
- *
- * Since: 2.8
- */
-void webkit_color_chooser_request_get_rgba(WebKitColorChooserRequest* request, GdkRGBA* rgba)
-{
- g_return_if_fail(WEBKIT_IS_COLOR_CHOOSER_REQUEST(request));
- g_return_if_fail(rgba);
-
- *rgba = request->priv->rgba;
-}
-
-/**
- * webkit_color_chooser_request_get_element_rectangle:
- * @request: a #WebKitColorChooserRequest
- * @rect: (out): a #GdkRectangle to fill in with the element area
- *
- * Gets the bounding box of the color input element.
- *
- * Since: 2.8
- */
-void webkit_color_chooser_request_get_element_rectangle(WebKitColorChooserRequest* request, GdkRectangle* rect)
-{
- g_return_if_fail(WEBKIT_IS_COLOR_CHOOSER_REQUEST(request));
- g_return_if_fail(rect);
-
- *rect = request->priv->colorChooser->elementRect();
-}
-
-/**
- * webkit_color_chooser_request_finish:
- * @request: a #WebKitColorChooserRequest
- *
- * Finishes @request and the input element keeps the current value of
- * #WebKitColorChooserRequest:rgba.
- * The signal #WebKitColorChooserRequest::finished
- * is emitted to notify that the request has finished.
- *
- * Since: 2.8
- */
-void webkit_color_chooser_request_finish(WebKitColorChooserRequest* request)
-{
- g_return_if_fail(WEBKIT_IS_COLOR_CHOOSER_REQUEST(request));
-
- if (request->priv->handled)
- return;
-
- request->priv->handled = true;
- g_signal_emit(request, signals[FINISHED], 0);
-}
-
-/**
- * webkit_color_chooser_request_cancel:
- * @request: a #WebKitColorChooserRequest
- *
- * Cancels @request and the input element changes to use the initial color
- * it has before the request started.
- * The signal #WebKitColorChooserRequest::finished
- * is emitted to notify that the request has finished.
- *
- * Since: 2.8
- */
-void webkit_color_chooser_request_cancel(WebKitColorChooserRequest* request)
-{
- g_return_if_fail(WEBKIT_IS_COLOR_CHOOSER_REQUEST(request));
-
- if (request->priv->handled)
- return;
-
- request->priv->handled = true;
- request->priv->colorChooser->cancel();
- g_signal_emit(request, signals[FINISHED], 0);
-}
-
-WebKitColorChooserRequest* webkitColorChooserRequestCreate(WebKitColorChooser* colorChooser)
-{
- WebKitColorChooserRequest* request = WEBKIT_COLOR_CHOOSER_REQUEST(
- g_object_new(WEBKIT_TYPE_COLOR_CHOOSER_REQUEST, "rgba", colorChooser->initialColor(), nullptr));
- request->priv->colorChooser = colorChooser;
- return request;
-}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitColorChooserRequest.h b/Source/WebKit2/UIProcess/API/gtk/WebKitColorChooserRequest.h
deleted file mode 100644
index 33a4ebb35..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitColorChooserRequest.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2015 Igalia S.L.
- * Copyright (c) 2012, Samsung Electronics
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
-#error "Only <webkit2/webkit2.h> can be included directly."
-#endif
-
-#ifndef WebKitColorChooserRequest_h
-#define WebKitColorChooserRequest_h
-
-#include <gtk/gtk.h>
-#include <webkit2/WebKitDefines.h>
-
-G_BEGIN_DECLS
-
-#define WEBKIT_TYPE_COLOR_CHOOSER_REQUEST (webkit_color_chooser_request_get_type())
-#define WEBKIT_COLOR_CHOOSER_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_COLOR_CHOOSER_REQUEST, WebKitColorChooserRequest))
-#define WEBKIT_IS_COLOR_CHOOSER_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_COLOR_CHOOSER_REQUEST))
-#define WEBKIT_COLOR_CHOOSER_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_COLOR_CHOOSER_REQUEST, WebKitColorChooserRequestClass))
-#define WEBKIT_IS_COLOR_CHOOSER_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_COLOR_CHOOSER_REQUEST))
-#define WEBKIT_COLOR_CHOOSER_REQUEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_COLOR_CHOOSER_REQUEST, WebKitColorChooserRequestClass))
-
-typedef struct _WebKitColorChooserRequest WebKitColorChooserRequest;
-typedef struct _WebKitColorChooserRequestClass WebKitColorChooserRequestClass;
-typedef struct _WebKitColorChooserRequestPrivate WebKitColorChooserRequestPrivate;
-
-struct _WebKitColorChooserRequest {
- GObject parent;
-
- /*< private >*/
- WebKitColorChooserRequestPrivate *priv;
-};
-
-struct _WebKitColorChooserRequestClass {
- GObjectClass parent_class;
-};
-
-WEBKIT_API GType
-webkit_color_chooser_request_get_type (void);
-
-WEBKIT_API void
-webkit_color_chooser_request_get_rgba (WebKitColorChooserRequest *request,
- GdkRGBA *rgba);
-
-WEBKIT_API void
-webkit_color_chooser_request_set_rgba (WebKitColorChooserRequest *request,
- const GdkRGBA *rgba);
-
-WEBKIT_API void
-webkit_color_chooser_request_get_element_rectangle (WebKitColorChooserRequest *request,
- GdkRectangle *rect);
-
-WEBKIT_API void
-webkit_color_chooser_request_finish (WebKitColorChooserRequest *request);
-
-WEBKIT_API void
-webkit_color_chooser_request_cancel (WebKitColorChooserRequest *request);
-
-G_END_DECLS
-
-#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitColorChooserRequestPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitColorChooserRequestPrivate.h
deleted file mode 100644
index 3acfe2821..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitColorChooserRequestPrivate.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2015 Igalia S.L.
- * Copyright (c) 2012, Samsung Electronics
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WebKitColorChooserRequestPrivate_h
-#define WebKitColorChooserRequestPrivate_h
-
-#include "WebKitColorChooser.h"
-#include "WebKitColorChooserRequest.h"
-
-WebKitColorChooserRequest* webkitColorChooserRequestCreate(WebKit::WebKitColorChooser*);
-
-#endif // WebKitColorChooserRequestPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenu.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenu.cpp
index e4f6cf0a2..bbbed0ddc 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenu.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenu.cpp
@@ -24,7 +24,6 @@
#include "WebContextMenuItem.h"
#include "WebKitContextMenuItemPrivate.h"
#include "WebKitContextMenuPrivate.h"
-#include <wtf/glib/GRefPtr.h>
using namespace WebKit;
using namespace WebCore;
@@ -51,7 +50,6 @@ using namespace WebCore;
struct _WebKitContextMenuPrivate {
GList* items;
WebKitContextMenuItem* parentItem;
- GRefPtr<GVariant> userData;
};
WEBKIT_DEFINE_TYPE(WebKitContextMenu, webkit_context_menu, G_TYPE_OBJECT)
@@ -76,29 +74,13 @@ void webkitContextMenuPopulate(WebKitContextMenu* menu, Vector<ContextMenuItem>&
}
}
-void webkitContextMenuPopulate(WebKitContextMenu* menu, Vector<WebContextMenuItemData>& contextMenuItems)
-{
- for (GList* item = menu->priv->items; item; item = g_list_next(item)) {
- WebKitContextMenuItem* menuItem = WEBKIT_CONTEXT_MENU_ITEM(item->data);
- contextMenuItems.append(WebContextMenuItemData(ContextMenuItem(webkitContextMenuItemRelease(menuItem))));
- }
-}
-
-WebKitContextMenu* webkitContextMenuCreate(const Vector<WebContextMenuItemData>& items)
-{
- WebKitContextMenu* menu = webkit_context_menu_new();
- for (const auto& item : items)
- webkit_context_menu_prepend(menu, webkitContextMenuItemCreate(item));
- menu->priv->items = g_list_reverse(menu->priv->items);
-
- return menu;
-}
-
-WebKitContextMenu* webkitContextMenuCreate(const Vector<ContextMenuItem>& items)
+WebKitContextMenu* webkitContextMenuCreate(API::Array* items)
{
WebKitContextMenu* menu = webkit_context_menu_new();
- for (const auto& item : items)
+ for (size_t i = 0; i < items->size(); ++i) {
+ WebContextMenuItem* item = static_cast<WebContextMenuItem*>(items->at(i));
webkit_context_menu_prepend(menu, webkitContextMenuItemCreate(item));
+ }
menu->priv->items = g_list_reverse(menu->priv->items);
return menu;
@@ -334,41 +316,3 @@ void webkit_context_menu_remove_all(WebKitContextMenu* menu)
g_list_free_full(menu->priv->items, reinterpret_cast<GDestroyNotify>(g_object_unref));
menu->priv->items = 0;
}
-
-/**
- * webkit_context_menu_set_user_data:
- * @menu: a #WebKitContextMenu
- * @user_data: a #GVariant
- *
- * Sets user data to @menu.
- * This function can be used from a Web Process extension to set user data
- * that can be retrieved from the UI Process using webkit_context_menu_get_user_data().
- *
- * Since: 2.8
- */
-void webkit_context_menu_set_user_data(WebKitContextMenu* menu, GVariant* userData)
-{
- g_return_if_fail(WEBKIT_IS_CONTEXT_MENU(menu));
- g_return_if_fail(userData);
-
- menu->priv->userData = userData;
-}
-
-/**
- * webkit_context_menu_get_user_data:
- * @menu: a #WebKitContextMenu
- *
- * Gets the user data of @menu.
- * This function can be used from the UI Process to get user data previously set
- * from the Web Process with webkit_context_menu_set_user_data().
- *
- * Returns: (transfer none): the user data of @menu, or %NULL if @menu doesn't have user data
- *
- * Since: 2.8
- */
-GVariant* webkit_context_menu_get_user_data(WebKitContextMenu* menu)
-{
- g_return_val_if_fail(WEBKIT_IS_CONTEXT_MENU(menu), nullptr);
-
- return menu->priv->userData.get();
-}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenu.h b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenu.h
index 9b50c6470..22f4bef29 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenu.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenu.h
@@ -17,7 +17,7 @@
* Boston, MA 02110-1301, USA.
*/
-#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) && !defined(__WEBKIT_WEB_EXTENSION_H_INSIDE__)
+#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
#error "Only <webkit2/webkit2.h> can be included directly."
#endif
@@ -105,13 +105,6 @@ webkit_context_menu_remove (WebKitContextMenu *menu,
WEBKIT_API void
webkit_context_menu_remove_all (WebKitContextMenu *menu);
-WEBKIT_API void
-webkit_context_menu_set_user_data (WebKitContextMenu *menu,
- GVariant *user_data);
-
-WEBKIT_API GVariant *
-webkit_context_menu_get_user_data (WebKitContextMenu *menu);
-
G_END_DECLS
#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuActions.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuActions.cpp
index 4ed20faad..e8cdffd04 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuActions.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuActions.cpp
@@ -182,8 +182,6 @@ WebKitContextMenuAction webkitContextMenuActionGetForContextMenuItem(ContextMenu
return WEBKIT_CONTEXT_MENU_ACTION_UNICODE;
case ContextMenuItemTagSpellingGuess:
return WEBKIT_CONTEXT_MENU_ACTION_SPELLING_GUESS;
- case ContextMenuItemTagNoGuessesFound:
- return WEBKIT_CONTEXT_MENU_ACTION_NO_GUESSES_FOUND;
case ContextMenuItemTagIgnoreSpelling:
return WEBKIT_CONTEXT_MENU_ACTION_IGNORE_SPELLING;
case ContextMenuItemTagLearnSpelling:
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuActions.h b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuActions.h
index cf155e13a..c8c9a0dad 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuActions.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuActions.h
@@ -17,7 +17,7 @@
* Boston, MA 02110-1301, USA.
*/
-#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) && !defined(__WEBKIT_WEB_EXTENSION_H_INSIDE__)
+#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
#error "Only <webkit2/webkit2.h> can be included directly."
#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuClient.cpp
index 69c262150..ea5e42757 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuClient.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuClient.cpp
@@ -20,44 +20,32 @@
#include "config.h"
#include "WebKitContextMenuClient.h"
-#include "APIContextMenuClient.h"
-#include "WebContextMenuItem.h"
+#include "WebKitPrivate.h"
#include "WebKitWebViewBasePrivate.h"
#include "WebKitWebViewPrivate.h"
using namespace WebKit;
-class ContextMenuClient final: public API::ContextMenuClient {
-public:
- explicit ContextMenuClient(WebKitWebView* webView)
- : m_webView(webView)
- {
- }
-
-private:
- bool getContextMenuFromProposedMenu(WebPageProxy&, const Vector<RefPtr<WebContextMenuItem>>& proposedMenu, Vector<RefPtr<WebContextMenuItem>>&, const WebHitTestResult::Data& hitTestResultData, API::Object* userData) override
- {
- GRefPtr<GVariant> variant;
- if (userData) {
- ASSERT(userData->type() == API::Object::Type::String);
- CString userDataString = static_cast<API::String*>(userData)->string().utf8();
- variant = adoptGRef(g_variant_parse(nullptr, userDataString.data(), userDataString.data() + userDataString.length(), nullptr, nullptr));
- }
-
- Vector<WebContextMenuItemData> menuItems;
- menuItems.reserveInitialCapacity(proposedMenu.size());
- for (auto& item : proposedMenu)
- menuItems.uncheckedAppend(*item->data());
- webkitWebViewPopulateContextMenu(m_webView, menuItems, hitTestResultData, variant.get());
- return true;
- }
-
- WebKitWebView* m_webView;
-};
+static void getContextMenuFromProposedMenu(WKPageRef, WKArrayRef proposedMenu, WKArrayRef*, WKHitTestResultRef hitTestResult, WKTypeRef userData, const void* clientInfo)
+{
+ webkitWebViewPopulateContextMenu(WEBKIT_WEB_VIEW(clientInfo), toImpl(proposedMenu), toImpl(hitTestResult));
+}
void attachContextMenuClientToView(WebKitWebView* webView)
{
- WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView));
- page->setContextMenuClient(std::make_unique<ContextMenuClient>(webView));
+ WKPageContextMenuClientV3 wkContextMenuClient = {
+ {
+ 3, // version
+ webView, // clientInfo
+ },
+ 0, // getContextMenuFromProposedMenu_deprecatedForUseWithV0
+ 0, // customContextMenuItemSelected
+ 0, // contextMenuDismissed
+ getContextMenuFromProposedMenu,
+ 0, // showContextMenu
+ 0, // hideContextMenu
+ };
+ WKPageRef wkPage = toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView)));
+ WKPageSetPageContextMenuClient(wkPage, &wkContextMenuClient.base);
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItem.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItem.cpp
index 6e7a27caa..c5e4553aa 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItem.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItem.cpp
@@ -29,9 +29,10 @@
#include <WebCore/ContextMenu.h>
#include <WebCore/ContextMenuItem.h>
#include <gtk/gtk.h>
-#include <memory>
-#include <wtf/glib/GRefPtr.h>
-#include <wtf/glib/GUniquePtr.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/gobject/GRefPtr.h>
+#include <wtf/gobject/GUniquePtr.h>
using namespace WebKit;
using namespace WebCore;
@@ -56,13 +57,13 @@ struct _WebKitContextMenuItemPrivate {
webkitContextMenuSetParentItem(subMenu.get(), 0);
}
- std::unique_ptr<ContextMenuItem> menuItem;
+ OwnPtr<ContextMenuItem> menuItem;
GRefPtr<WebKitContextMenu> subMenu;
};
WEBKIT_DEFINE_TYPE(WebKitContextMenuItem, webkit_context_menu_item, G_TYPE_INITIALLY_UNOWNED)
-static void webkit_context_menu_item_class_init(WebKitContextMenuItemClass*)
+static void webkit_context_menu_item_class_init(WebKitContextMenuItemClass* itemClass)
{
}
@@ -90,27 +91,20 @@ static void webkitContextMenuItemSetSubMenu(WebKitContextMenuItem* item, GRefPtr
webkitContextMenuSetParentItem(subMenu.get(), item);
}
-WebKitContextMenuItem* webkitContextMenuItemCreate(const WebContextMenuItemData& itemData)
+WebKitContextMenuItem* webkitContextMenuItemCreate(WebContextMenuItem* webItem)
{
WebKitContextMenuItem* item = WEBKIT_CONTEXT_MENU_ITEM(g_object_new(WEBKIT_TYPE_CONTEXT_MENU_ITEM, NULL));
-
- item->priv->menuItem = std::make_unique<ContextMenuItem>(itemData.type(), itemData.action(), itemData.title(), itemData.enabled(), itemData.checked());
- const Vector<WebContextMenuItemData>& subMenu = itemData.submenu();
- if (!subMenu.isEmpty())
- webkitContextMenuItemSetSubMenu(item, adoptGRef(webkitContextMenuCreate(subMenu)));
-
- return item;
-}
-
-WebKitContextMenuItem* webkitContextMenuItemCreate(const ContextMenuItem& coreItem)
-{
- WebKitContextMenuItem* item = WEBKIT_CONTEXT_MENU_ITEM(g_object_new(WEBKIT_TYPE_CONTEXT_MENU_ITEM, NULL));
-
- item->priv->menuItem = std::make_unique<ContextMenuItem>(coreItem.type(), coreItem.action(), coreItem.title(), coreItem.enabled(), coreItem.checked());
- if (coreItem.type() == WebCore::SubmenuType) {
- Vector<ContextMenuItem> subMenu = contextMenuItemVector(coreItem.platformSubMenu());
- webkitContextMenuItemSetSubMenu(item, adoptGRef(webkitContextMenuCreate(subMenu)));
- }
+ WebContextMenuItemData* itemData = webItem->data();
+ item->priv->menuItem = WTF::adoptPtr(new ContextMenuItem(itemData->type(), itemData->action(), itemData->title(), itemData->enabled(), itemData->checked()));
+ const Vector<WebContextMenuItemData>& subMenu = itemData->submenu();
+ if (!subMenu.size())
+ return item;
+
+ Vector<RefPtr<API::Object>> subMenuItems;
+ subMenuItems.reserveInitialCapacity(subMenu.size());
+ for (size_t i = 0; i < subMenu.size(); ++i)
+ subMenuItems.uncheckedAppend(WebContextMenuItem::create(subMenu[i]).get());
+ webkitContextMenuItemSetSubMenu(item, adoptGRef(webkitContextMenuCreate(API::Array::create(std::move(subMenuItems)).get())));
return item;
}
@@ -118,7 +112,7 @@ WebKitContextMenuItem* webkitContextMenuItemCreate(const ContextMenuItem& coreIt
static WebKitContextMenuItem* webkitContextMenuItemCreateForGtkItem(GtkMenuItem* menuItem)
{
WebKitContextMenuItem* item = WEBKIT_CONTEXT_MENU_ITEM(g_object_new(WEBKIT_TYPE_CONTEXT_MENU_ITEM, NULL));
- item->priv->menuItem = std::make_unique<ContextMenuItem>(menuItem);
+ item->priv->menuItem = WTF::adoptPtr(new ContextMenuItem(menuItem));
webkitContextMenuItemSetSubMenuFromGtkMenu(item, GTK_MENU(gtk_menu_item_get_submenu(menuItem)));
return item;
@@ -171,7 +165,7 @@ WebKitContextMenuItem* webkit_context_menu_item_new(GtkAction* action)
g_return_val_if_fail(GTK_IS_ACTION(action), 0);
WebKitContextMenuItem* item = WEBKIT_CONTEXT_MENU_ITEM(g_object_new(WEBKIT_TYPE_CONTEXT_MENU_ITEM, NULL));
- item->priv->menuItem = std::make_unique<ContextMenuItem>(GTK_MENU_ITEM(gtk_action_create_menu_item(action)));
+ item->priv->menuItem = WTF::adoptPtr(new ContextMenuItem(GTK_MENU_ITEM(gtk_action_create_menu_item(action))));
item->priv->menuItem->setAction(ContextMenuItemBaseApplicationTag);
return item;
@@ -199,7 +193,7 @@ WebKitContextMenuItem* webkit_context_menu_item_new_from_stock_action(WebKitCont
WebKitContextMenuItem* item = WEBKIT_CONTEXT_MENU_ITEM(g_object_new(WEBKIT_TYPE_CONTEXT_MENU_ITEM, NULL));
ContextMenuItemType type = webkitContextMenuActionIsCheckable(action) ? CheckableActionType : ActionType;
- item->priv->menuItem = std::make_unique<ContextMenuItem>(type, webkitContextMenuActionGetActionTag(action), webkitContextMenuActionGetLabel(action));
+ item->priv->menuItem = WTF::adoptPtr(new ContextMenuItem(type, webkitContextMenuActionGetActionTag(action), webkitContextMenuActionGetLabel(action)));
return item;
}
@@ -221,7 +215,7 @@ WebKitContextMenuItem* webkit_context_menu_item_new_from_stock_action_with_label
WebKitContextMenuItem* item = WEBKIT_CONTEXT_MENU_ITEM(g_object_new(WEBKIT_TYPE_CONTEXT_MENU_ITEM, NULL));
ContextMenuItemType type = webkitContextMenuActionIsCheckable(action) ? CheckableActionType : ActionType;
- item->priv->menuItem = std::make_unique<ContextMenuItem>(type, webkitContextMenuActionGetActionTag(action), String::fromUTF8(label));
+ item->priv->menuItem = WTF::adoptPtr(new ContextMenuItem(type, webkitContextMenuActionGetActionTag(action), String::fromUTF8(label)));
return item;
}
@@ -244,7 +238,7 @@ WebKitContextMenuItem* webkit_context_menu_item_new_with_submenu(const gchar* la
return 0;
WebKitContextMenuItem* item = WEBKIT_CONTEXT_MENU_ITEM(g_object_new(WEBKIT_TYPE_CONTEXT_MENU_ITEM, NULL));
- item->priv->menuItem = std::make_unique<ContextMenuItem>(SubmenuType, ContextMenuItemBaseApplicationTag, String::fromUTF8(label));
+ item->priv->menuItem = WTF::adoptPtr(new ContextMenuItem(SubmenuType, ContextMenuItemBaseApplicationTag, String::fromUTF8(label)));
item->priv->subMenu = submenu;
webkitContextMenuSetParentItem(submenu, item);
@@ -261,7 +255,7 @@ WebKitContextMenuItem* webkit_context_menu_item_new_with_submenu(const gchar* la
WebKitContextMenuItem* webkit_context_menu_item_new_separator(void)
{
WebKitContextMenuItem* item = WEBKIT_CONTEXT_MENU_ITEM(g_object_new(WEBKIT_TYPE_CONTEXT_MENU_ITEM, NULL));
- item->priv->menuItem = std::make_unique<ContextMenuItem>(SeparatorType, ContextMenuItemTagNoAction, String());
+ item->priv->menuItem = WTF::adoptPtr(new ContextMenuItem(SeparatorType, ContextMenuItemTagNoAction, String()));
return item;
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItem.h b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItem.h
index 33e31241a..75d60d7d6 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItem.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItem.h
@@ -17,7 +17,7 @@
* Boston, MA 02110-1301, USA.
*/
-#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) && !defined(__WEBKIT_WEB_EXTENSION_H_INSIDE__)
+#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
#error "Only <webkit2/webkit2.h> can be included directly."
#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItemPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItemPrivate.h
index 7d85f2566..18f8c1a87 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItemPrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItemPrivate.h
@@ -20,12 +20,10 @@
#ifndef WebKitContextMenuItemPrivate_h
#define WebKitContextMenuItemPrivate_h
-#include "WebContextMenuItemData.h"
#include "WebKitContextMenuItem.h"
#include "WebKitPrivate.h"
-WebKitContextMenuItem* webkitContextMenuItemCreate(const WebKit::WebContextMenuItemData&);
-WebKitContextMenuItem* webkitContextMenuItemCreate(const WebCore::ContextMenuItem&);
+WebKitContextMenuItem* webkitContextMenuItemCreate(WebKit::WebContextMenuItem*);
GtkMenuItem* webkitContextMenuItemRelease(WebKitContextMenuItem*);
void webkitContextMenuItemSetSubMenuFromGtkMenu(WebKitContextMenuItem*, GtkMenu*);
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuPrivate.h
index e0baab1c2..dcfd16b21 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuPrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuPrivate.h
@@ -20,14 +20,11 @@
#ifndef WebKitContextMenuPrivate_h
#define WebKitContextMenuPrivate_h
-#include "WebContextMenuItemData.h"
#include "WebKitContextMenu.h"
#include "WebKitPrivate.h"
-WebKitContextMenu* webkitContextMenuCreate(const Vector<WebKit::WebContextMenuItemData>&);
-WebKitContextMenu* webkitContextMenuCreate(const Vector<WebCore::ContextMenuItem>&);
+WebKitContextMenu* webkitContextMenuCreate(API::Array* items);
void webkitContextMenuPopulate(WebKitContextMenu*, Vector<WebCore::ContextMenuItem>&);
-void webkitContextMenuPopulate(WebKitContextMenu*, Vector<WebKit::WebContextMenuItemData>&);
void webkitContextMenuSetParentItem(WebKitContextMenu*, WebKitContextMenuItem*);
WebKitContextMenuItem* webkitContextMenuGetParentItem(WebKitContextMenu*);
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp
index 6f47f60e7..2c1ef4568 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp
@@ -25,7 +25,7 @@
#include "WebCookieManagerProxy.h"
#include "WebKitCookieManagerPrivate.h"
#include "WebKitEnumTypes.h"
-#include <wtf/glib/GRefPtr.h>
+#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/CString.h>
using namespace WebKit;
@@ -65,48 +65,12 @@ static guint signals[LAST_SIGNAL] = { 0, };
WEBKIT_DEFINE_TYPE(WebKitCookieManager, webkit_cookie_manager, G_TYPE_OBJECT)
-static inline SoupCookiePersistentStorageType toSoupCookiePersistentStorageType(WebKitCookiePersistentStorage kitStorage)
-{
- switch (kitStorage) {
- case WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT:
- return SoupCookiePersistentStorageText;
- case WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE:
- return SoupCookiePersistentStorageSQLite;
- default:
- ASSERT_NOT_REACHED();
- return SoupCookiePersistentStorageText;
- }
-}
-
-static inline WebKitCookieAcceptPolicy toWebKitCookieAcceptPolicy(HTTPCookieAcceptPolicy httpPolicy)
-{
- switch (httpPolicy) {
- case HTTPCookieAcceptPolicyAlways:
- return WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS;
- case HTTPCookieAcceptPolicyNever:
- return WEBKIT_COOKIE_POLICY_ACCEPT_NEVER;
- case HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
- return WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY;
- default:
- ASSERT_NOT_REACHED();
- return WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS;
- }
-}
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT, SoupCookiePersistentStorageText);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE, SoupCookiePersistentStorageSQLite);
-static inline HTTPCookieAcceptPolicy toHTTPCookieAcceptPolicy(WebKitCookieAcceptPolicy kitPolicy)
-{
- switch (kitPolicy) {
- case WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS:
- return HTTPCookieAcceptPolicyAlways;
- case WEBKIT_COOKIE_POLICY_ACCEPT_NEVER:
- return HTTPCookieAcceptPolicyNever;
- case WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY:
- return HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
- default:
- ASSERT_NOT_REACHED();
- return HTTPCookieAcceptPolicyAlways;
- }
-}
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS, HTTPCookieAcceptPolicyAlways);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_POLICY_ACCEPT_NEVER, HTTPCookieAcceptPolicyNever);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY, HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain);
static void webkit_cookie_manager_class_init(WebKitCookieManagerClass* findClass)
{
@@ -170,7 +134,7 @@ void webkit_cookie_manager_set_persistent_storage(WebKitCookieManager* manager,
g_return_if_fail(filename);
manager->priv->webCookieManager->stopObservingCookieChanges();
- manager->priv->webCookieManager->setCookiePersistentStorage(String::fromUTF8(filename), toSoupCookiePersistentStorageType(storage));
+ manager->priv->webCookieManager->setCookiePersistentStorage(String::fromUTF8(filename), storage);
manager->priv->webCookieManager->startObservingCookieChanges();
}
@@ -185,13 +149,13 @@ void webkit_cookie_manager_set_accept_policy(WebKitCookieManager* manager, WebKi
{
g_return_if_fail(WEBKIT_IS_COOKIE_MANAGER(manager));
- manager->priv->webCookieManager->setHTTPCookieAcceptPolicy(toHTTPCookieAcceptPolicy(policy));
+ manager->priv->webCookieManager->setHTTPCookieAcceptPolicy(policy);
}
static void webkitCookieManagerGetAcceptPolicyCallback(WKHTTPCookieAcceptPolicy policy, WKErrorRef, void* context)
{
GRefPtr<GTask> task = adoptGRef(G_TASK(context));
- g_task_return_int(task.get(), toWebKitCookieAcceptPolicy(toHTTPCookieAcceptPolicy(policy)));
+ g_task_return_int(task.get(), policy);
}
/**
@@ -211,7 +175,7 @@ void webkit_cookie_manager_get_accept_policy(WebKitCookieManager* manager, GCanc
g_return_if_fail(WEBKIT_IS_COOKIE_MANAGER(manager));
GTask* task = g_task_new(manager, cancellable, callback, userData);
- manager->priv->webCookieManager->getHTTPCookieAcceptPolicy(toGenericCallbackFunction<WKHTTPCookieAcceptPolicy, HTTPCookieAcceptPolicy>(task, webkitCookieManagerGetAcceptPolicyCallback));
+ manager->priv->webCookieManager->getHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicyCallback::create(task, webkitCookieManagerGetAcceptPolicyCallback));
}
/**
@@ -269,7 +233,7 @@ void webkit_cookie_manager_get_domains_with_cookies(WebKitCookieManager* manager
g_return_if_fail(WEBKIT_IS_COOKIE_MANAGER(manager));
GTask* task = g_task_new(manager, cancellable, callback, userData);
- manager->priv->webCookieManager->getHostnamesWithCookies(toGenericCallbackFunction(task, webkitCookieManagerGetDomainsWithCookiesCallback));
+ manager->priv->webCookieManager->getHostnamesWithCookies(ArrayCallback::create(task, webkitCookieManagerGetDomainsWithCookiesCallback));
}
/**
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitCredential.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitCredential.cpp
index a23e7e84b..5755fd5c7 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitCredential.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitCredential.cpp
@@ -37,41 +37,15 @@ struct _WebKitCredential {
CString password;
};
-G_DEFINE_BOXED_TYPE(WebKitCredential, webkit_credential, webkit_credential_copy, webkit_credential_free)
-
-static inline WebKitCredentialPersistence toWebKitCredentialPersistence(WebCore::CredentialPersistence corePersistence)
-{
- switch (corePersistence) {
- case WebCore::CredentialPersistenceNone:
- return WEBKIT_CREDENTIAL_PERSISTENCE_NONE;
- case WebCore::CredentialPersistenceForSession:
- return WEBKIT_CREDENTIAL_PERSISTENCE_FOR_SESSION;
- case WebCore::CredentialPersistencePermanent:
- return WEBKIT_CREDENTIAL_PERSISTENCE_PERMANENT;
- default:
- ASSERT_NOT_REACHED();
- return WEBKIT_CREDENTIAL_PERSISTENCE_NONE;
- }
-}
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_CREDENTIAL_PERSISTENCE_NONE, WebCore::CredentialPersistenceNone);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_CREDENTIAL_PERSISTENCE_FOR_SESSION, WebCore::CredentialPersistenceForSession);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_CREDENTIAL_PERSISTENCE_PERMANENT, WebCore::CredentialPersistencePermanent);
-static inline WebCore::CredentialPersistence toWebCoreCredentialPersistence(WebKitCredentialPersistence kitPersistence)
-{
- switch (kitPersistence) {
- case WEBKIT_CREDENTIAL_PERSISTENCE_NONE:
- return WebCore::CredentialPersistenceNone;
- case WEBKIT_CREDENTIAL_PERSISTENCE_FOR_SESSION:
- return WebCore::CredentialPersistenceForSession;
- case WEBKIT_CREDENTIAL_PERSISTENCE_PERMANENT:
- return WebCore::CredentialPersistencePermanent;
- default:
- ASSERT_NOT_REACHED();
- return WebCore::CredentialPersistenceNone;
- }
-}
+G_DEFINE_BOXED_TYPE(WebKitCredential, webkit_credential, webkit_credential_copy, webkit_credential_free)
WebKitCredential* webkitCredentialCreate(const WebCore::Credential& coreCredential)
{
- WebKitCredential* credential = static_cast<WebKitCredential*>(fastMalloc(sizeof(WebKitCredential)));
+ WebKitCredential* credential = g_slice_new(WebKitCredential);
new (credential) WebKitCredential(coreCredential);
return credential;
}
@@ -99,7 +73,7 @@ WebKitCredential* webkit_credential_new(const gchar* username, const gchar* pass
g_return_val_if_fail(username, 0);
g_return_val_if_fail(password, 0);
- return webkitCredentialCreate(WebCore::Credential(String::fromUTF8(username), String::fromUTF8(password), toWebCoreCredentialPersistence(persistence)));
+ return webkitCredentialCreate(WebCore::Credential(String::fromUTF8(username), String::fromUTF8(password), static_cast<WebCore::CredentialPersistence>(persistence)));
}
/**
@@ -132,7 +106,7 @@ void webkit_credential_free(WebKitCredential* credential)
g_return_if_fail(credential);
credential->~WebKitCredential();
- fastFree(credential);
+ g_slice_free(WebKitCredential, credential);
}
/**
@@ -204,5 +178,5 @@ WebKitCredentialPersistence webkit_credential_get_persistence(WebKitCredential*
{
g_return_val_if_fail(credential, WEBKIT_CREDENTIAL_PERSISTENCE_NONE);
- return toWebKitCredentialPersistence(credential->credential.persistence());
+ return static_cast<WebKitCredentialPersistence>(credential->credential.persistence());
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitDefines.h b/Source/WebKit2/UIProcess/API/gtk/WebKitDefines.h
index 520e9957c..8b637652b 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitDefines.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitDefines.h
@@ -38,11 +38,10 @@
# else
# define WEBKIT_API __declspec(dllimport)
# endif
+# define WEBKIT_OBSOLETE_API WEBKIT_API
#else
# define WEBKIT_API __attribute__((visibility("default")))
+# define WEBKIT_OBSOLETE_API WEBKIT_API __attribute__((deprecated))
#endif
-#define WEBKIT_DEPRECATED WEBKIT_API G_DEPRECATED
-#define WEBKIT_DEPRECATED_FOR(f) WEBKIT_API G_DEPRECATED_FOR(f)
-
#endif // WebKitDefines_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp
index 4b4e374fd..e95e4c065 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012, 2014 Igalia S.L.
+ * Copyright (C) 2012 Igalia S.L.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -23,14 +23,13 @@
#include "DownloadProxy.h"
#include "WebKitDownloadPrivate.h"
#include "WebKitMarshal.h"
-#include "WebKitPrivate.h"
#include "WebKitURIRequestPrivate.h"
#include "WebKitURIResponsePrivate.h"
#include <WebCore/ErrorsGtk.h>
#include <WebCore/ResourceResponse.h>
#include <glib/gi18n-lib.h>
-#include <wtf/glib/GRefPtr.h>
-#include <wtf/glib/GUniquePtr.h>
+#include <wtf/gobject/GRefPtr.h>
+#include <wtf/gobject/GUniquePtr.h>
using namespace WebKit;
using namespace WebCore;
@@ -63,8 +62,7 @@ enum {
PROP_DESTINATION,
PROP_RESPONSE,
- PROP_ESTIMATED_PROGRESS,
- PROP_ALLOW_OVERWRITE
+ PROP_ESTIMATED_PROGRESS
};
struct _WebKitDownloadPrivate {
@@ -85,26 +83,12 @@ struct _WebKitDownloadPrivate {
GUniquePtr<GTimer> timer;
gdouble lastProgress;
gdouble lastElapsed;
- bool allowOverwrite;
};
static guint signals[LAST_SIGNAL] = { 0, };
WEBKIT_DEFINE_TYPE(WebKitDownload, webkit_download, G_TYPE_OBJECT)
-static void webkitDownloadSetProperty(GObject* object, guint propId, const GValue* value, GParamSpec* paramSpec)
-{
- WebKitDownload* download = WEBKIT_DOWNLOAD(object);
-
- switch (propId) {
- case PROP_ALLOW_OVERWRITE:
- webkit_download_set_allow_overwrite(download, g_value_get_boolean(value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
- }
-}
-
static void webkitDownloadGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec)
{
WebKitDownload* download = WEBKIT_DOWNLOAD(object);
@@ -119,9 +103,6 @@ static void webkitDownloadGetProperty(GObject* object, guint propId, GValue* val
case PROP_ESTIMATED_PROGRESS:
g_value_set_double(value, webkit_download_get_estimated_progress(download));
break;
- case PROP_ALLOW_OVERWRITE:
- g_value_set_boolean(value, webkit_download_get_allow_overwrite(download));
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
}
@@ -148,7 +129,6 @@ static gboolean webkitDownloadDecideDestination(WebKitDownload* download, const
static void webkit_download_class_init(WebKitDownloadClass* downloadClass)
{
GObjectClass* objectClass = G_OBJECT_CLASS(downloadClass);
- objectClass->set_property = webkitDownloadSetProperty;
objectClass->get_property = webkitDownloadGetProperty;
downloadClass->decide_destination = webkitDownloadDecideDestination;
@@ -198,25 +178,6 @@ static void webkit_download_class_init(WebKitDownloadClass* downloadClass)
WEBKIT_PARAM_READABLE));
/**
- * WebKitDownload:allow-overwrite:
- *
- * Whether or not the download is allowed to overwrite an existing file on
- * disk. If this property is %FALSE and the destination already exists,
- * the download will fail.
- *
- * Since: 2.6
- */
- g_object_class_install_property(
- objectClass,
- PROP_ALLOW_OVERWRITE,
- g_param_spec_boolean(
- "allow-overwrite",
- _("Allow Overwrite"),
- _("Whether the destination may be overwritten"),
- FALSE,
- WEBKIT_PARAM_READWRITE));
-
- /**
* WebKitDownload::received-data:
* @download: the #WebKitDownload
* @data_length: the length of data received in bytes
@@ -379,7 +340,7 @@ void webkitDownloadNotifyProgress(WebKitDownload* download, guint64 bytesReceive
void webkitDownloadFailed(WebKitDownload* download, const ResourceError& resourceError)
{
GUniquePtr<GError> webError(g_error_new_literal(g_quark_from_string(resourceError.domain().utf8().data()),
- toWebKitError(resourceError.errorCode()), resourceError.localizedDescription().utf8().data()));
+ resourceError.errorCode(), resourceError.localizedDescription().utf8().data()));
if (download->priv->timer)
g_timer_stop(download->priv->timer.get());
@@ -408,13 +369,12 @@ void webkitDownloadFinished(WebKitDownload* download)
g_signal_emit(download, signals[FINISHED], 0, NULL);
}
-CString webkitDownloadDecideDestinationWithSuggestedFilename(WebKitDownload* download, const CString& suggestedFilename, bool& allowOverwrite)
+CString webkitDownloadDecideDestinationWithSuggestedFilename(WebKitDownload* download, const CString& suggestedFilename)
{
if (download->priv->isCancelled)
return "";
gboolean returnValue;
g_signal_emit(download, signals[DECIDE_DESTINATION], 0, suggestedFilename.data(), &returnValue);
- allowOverwrite = download->priv->allowOverwrite;
return download->priv->destinationURI;
}
@@ -607,44 +567,3 @@ WebKitWebView* webkit_download_get_web_view(WebKitDownload* download)
return download->priv->webView;
}
-
-/**
- * webkit_download_get_allow_overwrite:
- * @download: a #WebKitDownload
- *
- * Returns the current value of the #WebKitDownload:allow-overwrite property,
- * which determines whether the download will overwrite an existing file on
- * disk, or if it will fail if the destination already exists.
- *
- * Returns: the current value of the #WebKitDownload:allow-overwrite property
- *
- * Since: 2.6
- */
-gboolean webkit_download_get_allow_overwrite(WebKitDownload* download)
-{
- g_return_val_if_fail(WEBKIT_IS_DOWNLOAD(download), FALSE);
-
- return download->priv->allowOverwrite;
-}
-
-/**
- * webkit_download_set_allow_overwrite:
- * @download: a #WebKitDownload
- * @allowed: the new value for the #WebKitDownload:allow-overwrite property
- *
- * Sets the #WebKitDownload:allow-overwrite property, which determines whether
- * the download may overwrite an existing file on disk, or if it will fail if
- * the destination already exists.
- *
- * Since: 2.6
- */
-void webkit_download_set_allow_overwrite(WebKitDownload* download, gboolean allowed)
-{
- g_return_if_fail(WEBKIT_IS_DOWNLOAD(download));
-
- if (allowed == download->priv->allowOverwrite)
- return;
-
- download->priv->allowOverwrite = allowed;
- g_object_notify(G_OBJECT(download), "allow-overwrite");
-}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h
index 7e6bfeb46..493bfea40 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h
@@ -92,13 +92,6 @@ webkit_download_get_received_data_length (WebKitDownload *download);
WEBKIT_API WebKitWebView *
webkit_download_get_web_view (WebKitDownload *download);
-WEBKIT_API gboolean
-webkit_download_get_allow_overwrite (WebKitDownload *download);
-
-WEBKIT_API void
-webkit_download_set_allow_overwrite (WebKitDownload *download,
- gboolean allowed);
-
G_END_DECLS
#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadClient.cpp
index cc7208172..198cc68f9 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadClient.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadClient.cpp
@@ -21,12 +21,12 @@
#include "WebKitDownloadClient.h"
#include "APIURLResponse.h"
+#include "WebContext.h"
#include "WebKitDownloadPrivate.h"
#include "WebKitURIResponsePrivate.h"
#include "WebKitWebContextPrivate.h"
-#include "WebProcessPool.h"
-#include <WebKit/WKString.h>
-#include <wtf/glib/GRefPtr.h>
+#include <WebKit2/WKString.h>
+#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/CString.h>
using namespace WebCore;
@@ -38,7 +38,7 @@ static void didStart(WKContextRef, WKDownloadRef wkDownload, const void* clientI
webkitWebContextDownloadStarted(WEBKIT_WEB_CONTEXT(clientInfo), download.get());
}
-static void didReceiveResponse(WKContextRef, WKDownloadRef wkDownload, WKURLResponseRef wkResponse, const void* /* clientInfo */)
+static void didReceiveResponse(WKContextRef, WKDownloadRef wkDownload, WKURLResponseRef wkResponse, const void* clientInfo)
{
GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(toImpl(wkDownload));
if (webkitDownloadIsCancelled(download.get()))
@@ -48,26 +48,27 @@ static void didReceiveResponse(WKContextRef, WKDownloadRef wkDownload, WKURLResp
webkitDownloadSetResponse(download.get(), response.get());
}
-static void didReceiveData(WKContextRef, WKDownloadRef wkDownload, uint64_t length, const void* /* clientInfo */)
+static void didReceiveData(WKContextRef, WKDownloadRef wkDownload, uint64_t length, const void* clientInfo)
{
GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(toImpl(wkDownload));
webkitDownloadNotifyProgress(download.get(), length);
}
-static WKStringRef decideDestinationWithSuggestedFilename(WKContextRef, WKDownloadRef wkDownload, WKStringRef filename, bool* allowOverwrite, const void* /* clientInfo */)
+static WKStringRef decideDestinationWithSuggestedFilename(WKContextRef, WKDownloadRef wkDownload, WKStringRef filename, bool* allowOverwrite, const void* clientInfo)
{
GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(toImpl(wkDownload));
- CString destinationURI = webkitDownloadDecideDestinationWithSuggestedFilename(download.get(), toImpl(filename)->string().utf8(), *allowOverwrite);
+ CString destinationURI = webkitDownloadDecideDestinationWithSuggestedFilename(download.get(),
+ toImpl(filename)->string().utf8());
return WKStringCreateWithUTF8CString(destinationURI.data());
}
-static void didCreateDestination(WKContextRef, WKDownloadRef wkDownload, WKStringRef path, const void* /* clientInfo */)
+static void didCreateDestination(WKContextRef, WKDownloadRef wkDownload, WKStringRef path, const void* clientInfo)
{
GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(toImpl(wkDownload));
webkitDownloadDestinationCreated(download.get(), toImpl(path)->string().utf8());
}
-static void didFail(WKContextRef, WKDownloadRef wkDownload, WKErrorRef error, const void* /* clientInfo */)
+static void didFail(WKContextRef, WKDownloadRef wkDownload, WKErrorRef error, const void *clientInfo)
{
GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(toImpl(wkDownload));
if (webkitDownloadIsCancelled(download.get())) {
@@ -78,14 +79,14 @@ static void didFail(WKContextRef, WKDownloadRef wkDownload, WKErrorRef error, co
webkitWebContextRemoveDownload(toImpl(wkDownload));
}
-static void didCancel(WKContextRef, WKDownloadRef wkDownload, const void* /* clientInfo */)
+static void didCancel(WKContextRef, WKDownloadRef wkDownload, const void *clientInfo)
{
GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(toImpl(wkDownload));
webkitDownloadCancelled(download.get());
webkitWebContextRemoveDownload(toImpl(wkDownload));
}
-static void didFinish(WKContextRef, WKDownloadRef wkDownload, const void* /* clientInfo */)
+static void didFinish(WKContextRef wkContext, WKDownloadRef wkDownload, const void *clientInfo)
{
GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(toImpl(wkDownload));
webkitDownloadFinished(download.get());
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadPrivate.h
index b986ca231..980ad732b 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadPrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadPrivate.h
@@ -35,7 +35,7 @@ void webkitDownloadNotifyProgress(WebKitDownload*, guint64 bytesReceived);
void webkitDownloadFailed(WebKitDownload*, const WebCore::ResourceError&);
void webkitDownloadCancelled(WebKitDownload*);
void webkitDownloadFinished(WebKitDownload*);
-CString webkitDownloadDecideDestinationWithSuggestedFilename(WebKitDownload*, const CString& suggestedFilename, bool& allowOverwrite);
+CString webkitDownloadDecideDestinationWithSuggestedFilename(WebKitDownload*, const CString& suggestedFilename);
void webkitDownloadDestinationCreated(WebKitDownload*, const CString& destinationURI);
#endif // WebKitDownloadPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitEditingCommands.h b/Source/WebKit2/UIProcess/API/gtk/WebKitEditingCommands.h
index a3bd0fab6..437395710 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitEditingCommands.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitEditingCommands.h
@@ -94,31 +94,6 @@ G_BEGIN_DECLS
*/
#define WEBKIT_EDITING_COMMAND_REDO "Redo"
-/**
- * WEBKIT_EDITING_COMMAND_INSERT_IMAGE:
- *
- * The insert image command. Creates an image element that is inserted at
- * the current cursor position. It receives an URI as argument,
- * that is used as the image source. This command should be executed with
- * webkit_web_view_execute_editing_command_with_argument().
- *
- * Since: 2.10
- */
-#define WEBKIT_EDITING_COMMAND_INSERT_IMAGE "InsertImage"
-
-/**
- * WEBKIT_EDITING_COMMAND_CREATE_LINK:
- *
- * The create link command. Creates a link elment thst is inserted at
- * the current cursor position. If there's a selection, the selected text
- * will be used as the link text, otherwise the URL itself will be used.
- * It receives the link URL as argument. This command should be executed
- * with webkit_web_view_execute_editing_command_with_argument()
- *
- * Since: 2.10
- */
-#define WEBKIT_EDITING_COMMAND_CREATE_LINK "CreateLink"
-
G_END_DECLS
#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitEditorState.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitEditorState.cpp
deleted file mode 100644
index 97d1f8a17..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitEditorState.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (C) 2015 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "WebKitEditorState.h"
-
-#include "EditorState.h"
-#include "WebKitEditorStatePrivate.h"
-#include <glib/gi18n-lib.h>
-
-using namespace WebKit;
-
-/**
- * SECTION: WebKitEditorState
- * @Short_description: Web editor state
- * @Title: WebKitEditorState
- * @See_also: #WebKitWebView
- *
- * WebKitEditorState represents the state of a #WebKitWebView editor.
- * Use webkit_web_view_get_editor_state() to get WebKitEditorState of
- * a #WebKitWebView.
- *
- * Since: 2.10
- */
-
-enum {
- PROP_0,
-
- PROP_TYPING_ATTRIBUTES
-};
-
-struct _WebKitEditorStatePrivate {
- unsigned typingAttributes;
-};
-
-WEBKIT_DEFINE_TYPE(WebKitEditorState, webkit_editor_state, G_TYPE_OBJECT)
-
-static void webkitEditorStateGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec)
-{
- WebKitEditorState* editorState = WEBKIT_EDITOR_STATE(object);
-
- switch (propId) {
- case PROP_TYPING_ATTRIBUTES:
- g_value_set_uint(value, webkit_editor_state_get_typing_attributes(editorState));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
- }
-}
-
-static void webkit_editor_state_class_init(WebKitEditorStateClass* editorStateClass)
-{
- GObjectClass* objectClass = G_OBJECT_CLASS(editorStateClass);
- objectClass->get_property = webkitEditorStateGetProperty;
-
- /**
- * WebKitEditorState:typing-attributes:
- *
- * Bitmask of #WebKitEditorTypingAttributes flags.
- * See webkit_editor_state_get_typing_attributes() for more information.
- *
- * Since: 2.10
- */
- g_object_class_install_property(
- objectClass,
- PROP_TYPING_ATTRIBUTES,
- g_param_spec_uint(
- "typing-attributes",
- _("Typing Attributes"),
- _("Flags with the typing attributes"),
- 0, G_MAXUINT, 0,
- WEBKIT_PARAM_READABLE));
-}
-
-static void webkitEditorStateSetTypingAttributes(WebKitEditorState* editorState, unsigned typingAttributes)
-{
- if (typingAttributes == editorState->priv->typingAttributes)
- return;
-
- editorState->priv->typingAttributes = typingAttributes;
- g_object_notify(G_OBJECT(editorState), "typing-attributes");
-}
-
-WebKitEditorState* webkitEditorStateCreate(const EditorState& state)
-{
- WebKitEditorState* editorState = WEBKIT_EDITOR_STATE(g_object_new(WEBKIT_TYPE_EDITOR_STATE, nullptr));
- webkitEditorStateChanged(editorState, state);
- return editorState;
-}
-
-void webkitEditorStateChanged(WebKitEditorState* editorState, const EditorState& newState)
-{
- if (newState.isMissingPostLayoutData)
- return;
-
- unsigned typingAttributes = WEBKIT_EDITOR_TYPING_ATTRIBUTE_NONE;
- const auto& postLayoutData = newState.postLayoutData();
- if (postLayoutData.typingAttributes & AttributeBold)
- typingAttributes |= WEBKIT_EDITOR_TYPING_ATTRIBUTE_BOLD;
- if (postLayoutData.typingAttributes & AttributeItalics)
- typingAttributes |= WEBKIT_EDITOR_TYPING_ATTRIBUTE_ITALIC;
- if (postLayoutData.typingAttributes & AttributeUnderline)
- typingAttributes |= WEBKIT_EDITOR_TYPING_ATTRIBUTE_UNDERLINE;
- if (postLayoutData.typingAttributes & AttributeStrikeThrough)
- typingAttributes |= WEBKIT_EDITOR_TYPING_ATTRIBUTE_STRIKETHROUGH;
- webkitEditorStateSetTypingAttributes(editorState, typingAttributes);
-}
-
-/**
- * webkit_editor_state_get_typing_attributes:
- * @editor_state: a #WebKitEditorState
- *
- * Gets the typing attributes at the current cursor position.
- * If there is a selection, this returns the typing attributes
- * of the the selected text. Note that in case of a selection,
- * typing attributes are considered active only when they are
- * present throughout the selection.
- *
- * Returns: a bitmask of #WebKitEditorTypingAttributes flags
- *
- * Since: 2.10
- */
-guint webkit_editor_state_get_typing_attributes(WebKitEditorState* editorState)
-{
- g_return_val_if_fail(WEBKIT_IS_EDITOR_STATE(editorState), WEBKIT_EDITOR_TYPING_ATTRIBUTE_NONE);
-
- return editorState->priv->typingAttributes;
-}
-
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitEditorState.h b/Source/WebKit2/UIProcess/API/gtk/WebKitEditorState.h
deleted file mode 100644
index d0d8351ff..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitEditorState.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2015 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) && !defined(__WEBKIT_WEB_EXTENSION_H_INSIDE__)
-#error "Only <webkit2/webkit2.h> can be included directly."
-#endif
-
-#ifndef WebKitEditorState_h
-#define WebKitEditorState_h
-
-#include <glib-object.h>
-#include <webkit2/WebKitDefines.h>
-
-G_BEGIN_DECLS
-
-#define WEBKIT_TYPE_EDITOR_STATE (webkit_editor_state_get_type())
-#define WEBKIT_EDITOR_STATE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_EDITOR_STATE, WebKitEditorState))
-#define WEBKIT_IS_EDITOR_STATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_EDITOR_STATE))
-#define WEBKIT_EDITOR_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_EDITOR_STATE, WebKitEditorStateClass))
-#define WEBKIT_IS_EDITOR_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_EDITOR_STATE))
-#define WEBKIT_EDITOR_STATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_EDITOR_STATE, WebKitEditorStateClass))
-
-typedef struct _WebKitEditorState WebKitEditorState;
-typedef struct _WebKitEditorStateClass WebKitEditorStateClass;
-typedef struct _WebKitEditorStatePrivate WebKitEditorStatePrivate;
-
-/**
- * WebKitEditorTypingAttributes:
- * @WEBKIT_EDITOR_TYPING_ATTRIBUTE_NONE: No typing attrubutes.
- * @WEBKIT_EDITOR_TYPING_ATTRIBUTE_BOLD: Bold typing attribute.
- * @WEBKIT_EDITOR_TYPING_ATTRIBUTE_ITALIC: Italic typing attribute.
- * @WEBKIT_EDITOR_TYPING_ATTRIBUTE_UNDERLINE: Underline typing attribute.
- * @WEBKIT_EDITOR_TYPING_ATTRIBUTE_STRIKETHROUGH: Strikethrough typing attribute.
- *
- * Enum values with flags representing typing attributes.
- *
- * Since: 2.10
- */
-typedef enum
-{
- WEBKIT_EDITOR_TYPING_ATTRIBUTE_NONE = 1 << 1,
- WEBKIT_EDITOR_TYPING_ATTRIBUTE_BOLD = 1 << 2,
- WEBKIT_EDITOR_TYPING_ATTRIBUTE_ITALIC = 1 << 3,
- WEBKIT_EDITOR_TYPING_ATTRIBUTE_UNDERLINE = 1 << 4,
- WEBKIT_EDITOR_TYPING_ATTRIBUTE_STRIKETHROUGH = 1 << 5
-} WebKitEditorTypingAttributes;
-
-struct _WebKitEditorState {
- GObject parent;
-
- WebKitEditorStatePrivate *priv;
-};
-
-struct _WebKitEditorStateClass {
- GObjectClass parent_class;
-
- void (*_webkit_reserved0) (void);
- void (*_webkit_reserved1) (void);
- void (*_webkit_reserved2) (void);
- void (*_webkit_reserved3) (void);
-};
-
-WEBKIT_API GType
-webkit_editor_state_get_type (void);
-
-WEBKIT_API guint
-webkit_editor_state_get_typing_attributes (WebKitEditorState *editor_state);
-
-G_END_DECLS
-
-#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitEditorStatePrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitEditorStatePrivate.h
deleted file mode 100644
index fdf9a35f5..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitEditorStatePrivate.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2015 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef WebKitEditorStatePrivate_h
-#define WebKitEditorStatePrivate_h
-
-#include "WebKitEditorState.h"
-#include "WebKitPrivate.h"
-
-WebKitEditorState* webkitEditorStateCreate(const WebKit::EditorState&);
-void webkitEditorStateChanged(WebKitEditorState*, const WebKit::EditorState&);
-
-#endif // WebKitEditorStatePrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp
index 7419ee721..c06dc61a5 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp
@@ -40,26 +40,53 @@ GQuark webkit_network_error_quark()
return g_quark_from_static_string(WebCore::errorDomainNetwork);
}
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NETWORK_ERROR_FAILED, NetworkErrorFailed);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NETWORK_ERROR_TRANSPORT, NetworkErrorTransport);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NETWORK_ERROR_UNKNOWN_PROTOCOL, NetworkErrorUnknownProtocol);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NETWORK_ERROR_CANCELLED, NetworkErrorCancelled);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NETWORK_ERROR_FILE_DOES_NOT_EXIST, NetworkErrorFileDoesNotExist);
+
GQuark webkit_policy_error_quark()
{
return g_quark_from_static_string(WebCore::errorDomainPolicy);
}
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_POLICY_ERROR_FAILED, PolicyErrorFailed);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_POLICY_ERROR_CANNOT_SHOW_MIME_TYPE, PolicyErrorCannotShowMimeType);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_POLICY_ERROR_CANNOT_SHOW_URI, PolicyErrorCannotShowURL);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE, PolicyErrorFrameLoadInterruptedByPolicyChange);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_POLICY_ERROR_CANNOT_USE_RESTRICTED_PORT, PolicyErrorCannotUseRestrictedPort);
+
GQuark webkit_plugin_error_quark()
{
return g_quark_from_static_string(WebCore::errorDomainPlugin);
}
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_PLUGIN_ERROR_FAILED, PluginErrorFailed);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_PLUGIN_ERROR_CANNOT_FIND_PLUGIN, PluginErrorCannotFindPlugin);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_PLUGIN_ERROR_CANNOT_LOAD_PLUGIN, PluginErrorCannotLoadPlugin);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_PLUGIN_ERROR_JAVA_UNAVAILABLE, PluginErrorJavaUnavailable);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_PLUGIN_ERROR_CONNECTION_CANCELLED, PluginErrorConnectionCancelled);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD, PluginErrorWillHandleLoad);
+
GQuark webkit_download_error_quark()
{
return g_quark_from_static_string(WebCore::errorDomainDownload);
}
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_DOWNLOAD_ERROR_NETWORK, DownloadErrorNetwork);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER, DownloadErrorCancelledByUser);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_DOWNLOAD_ERROR_DESTINATION, DownloadErrorDestination);
+
GQuark webkit_print_error_quark()
{
return g_quark_from_static_string(WebCore::errorDomainPrint);
}
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_PRINT_ERROR_GENERAL, PrintErrorGeneral);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_PRINT_ERROR_PRINTER_NOT_FOUND, PrintErrorPrinterNotFound);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_PRINT_ERROR_INVALID_PAGE_RANGE, PrintErrorInvalidPageRange);
+
GQuark webkit_javascript_error_quark()
{
return g_quark_from_static_string("WebKitJavascriptError");
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFaviconDatabase.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitFaviconDatabase.cpp
index 80ac15a72..0eda2729e 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitFaviconDatabase.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFaviconDatabase.cpp
@@ -29,8 +29,8 @@
#include <WebCore/RefPtrCairo.h>
#include <glib/gi18n-lib.h>
#include <wtf/RunLoop.h>
-#include <wtf/glib/GRefPtr.h>
-#include <wtf/glib/GUniquePtr.h>
+#include <wtf/gobject/GRefPtr.h>
+#include <wtf/gobject/GUniquePtr.h>
#include <wtf/text/CString.h>
using namespace WebKit;
@@ -181,7 +181,7 @@ static void processPendingIconsForPageURL(WebKitFaviconDatabase* database, const
deletePendingIconRequests(database, pendingIconRequests, pageURL);
}
-static void didChangeIconForPageURLCallback(WKIconDatabaseRef, WKURLRef wkPageURL, const void* clientInfo)
+static void didChangeIconForPageURLCallback(WKIconDatabaseRef wkIconDatabase, WKURLRef wkPageURL, const void* clientInfo)
{
WebKitFaviconDatabase* database = WEBKIT_FAVICON_DATABASE(clientInfo);
if (!database->priv->iconDatabase->isUrlImportCompleted())
@@ -203,7 +203,7 @@ static void didChangeIconForPageURLCallback(WKIconDatabaseRef, WKURLRef wkPageUR
g_signal_emit(database, signals[FAVICON_CHANGED], 0, pageURL.utf8().data(), currentIconURL.utf8().data());
}
-static void iconDataReadyForPageURLCallback(WKIconDatabaseRef, WKURLRef wkPageURL, const void* clientInfo)
+static void iconDataReadyForPageURLCallback(WKIconDatabaseRef wkIconDatabase, WKURLRef wkPageURL, const void* clientInfo)
{
ASSERT(RunLoop::isMain());
processPendingIconsForPageURL(WEBKIT_FAVICON_DATABASE(clientInfo), toImpl(wkPageURL)->string());
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFileChooserRequest.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitFileChooserRequest.cpp
index b23597660..0855deea3 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitFileChooserRequest.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFileChooserRequest.cpp
@@ -27,8 +27,8 @@
#include "WebOpenPanelResultListenerProxy.h"
#include <WebCore/FileSystem.h>
#include <glib/gi18n-lib.h>
-#include <wtf/glib/GRefPtr.h>
-#include <wtf/glib/GUniquePtr.h>
+#include <wtf/gobject/GRefPtr.h>
+#include <wtf/gobject/GUniquePtr.h>
#include <wtf/text/CString.h>
using namespace WebKit;
@@ -206,7 +206,7 @@ const gchar* const* webkit_file_chooser_request_get_mime_types(WebKitFileChooser
if (request->priv->mimeTypes)
return reinterpret_cast<gchar**>(request->priv->mimeTypes->pdata);
- Ref<API::Array> mimeTypes = request->priv->parameters->acceptMIMETypes();
+ RefPtr<API::Array> mimeTypes = request->priv->parameters->acceptMIMETypes();
size_t numOfMimeTypes = mimeTypes->size();
if (!numOfMimeTypes)
return 0;
@@ -247,7 +247,7 @@ GtkFileFilter* webkit_file_chooser_request_get_mime_types_filter(WebKitFileChoos
if (request->priv->filter)
return request->priv->filter.get();
- Ref<API::Array> mimeTypes = request->priv->parameters->acceptMIMETypes();
+ RefPtr<API::Array> mimeTypes = request->priv->parameters->acceptMIMETypes();
size_t numOfMimeTypes = mimeTypes->size();
if (!numOfMimeTypes)
return 0;
@@ -315,7 +315,7 @@ void webkit_file_chooser_request_select_files(WebKitFileChooserRequest* request,
g_ptr_array_add(selectedFiles.get(), 0);
// Select the files in WebCore and update local private attributes.
- request->priv->listener->chooseFiles(API::Array::create(WTF::move(choosenFiles)).ptr());
+ request->priv->listener->chooseFiles(API::Array::create(std::move(choosenFiles)).get());
request->priv->selectedFiles = selectedFiles;
request->priv->handledRequest = true;
}
@@ -354,7 +354,7 @@ const gchar* const* webkit_file_chooser_request_get_selected_files(WebKitFileCho
request->priv->selectedFiles = adoptGRef(g_ptr_array_new_with_free_func(g_free));
for (size_t i = 0; i < numOfFiles; ++i) {
API::String* webFileName = static_cast<API::String*>(selectedFileNames->at(i));
- if (webFileName->stringView().isEmpty())
+ if (webFileName->isEmpty())
continue;
CString filename = fileSystemRepresentation(webFileName->string());
g_ptr_array_add(request->priv->selectedFiles.get(), g_strdup(filename.data()));
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp
index 0830bccaf..8759306e2 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp
@@ -25,7 +25,7 @@
#include "WebKitWebView.h"
#include "WebKitWebViewBasePrivate.h"
#include <glib/gi18n-lib.h>
-#include <wtf/glib/GRefPtr.h>
+#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/CString.h>
using namespace WebKit;
@@ -73,7 +73,6 @@ typedef enum {
struct _WebKitFindControllerPrivate {
CString searchText;
- // Interpreted as WebKit::FindOptions.
uint32_t findOptions;
unsigned maxMatchCount;
WebKitWebView* webView;
@@ -83,35 +82,23 @@ static guint signals[LAST_SIGNAL] = { 0, };
WEBKIT_DEFINE_TYPE(WebKitFindController, webkit_find_controller, G_TYPE_OBJECT)
-static inline WebKit::FindOptions toWebFindOptions(uint32_t findOptions)
-{
- return static_cast<WebKit::FindOptions>((findOptions & WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE ? FindOptionsCaseInsensitive : 0)
- | (findOptions & WEBKIT_FIND_OPTIONS_AT_WORD_STARTS ? FindOptionsAtWordStarts : 0)
- | (findOptions & WEBKIT_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START ? FindOptionsTreatMedialCapitalAsWordStart : 0)
- | (findOptions & WEBKIT_FIND_OPTIONS_BACKWARDS ? FindOptionsBackwards : 0)
- | (findOptions & WEBKIT_FIND_OPTIONS_WRAP_AROUND ? FindOptionsWrapAround : 0));
-}
-
-static inline WebKitFindOptions toWebKitFindOptions(uint32_t findOptions)
-{
- return static_cast<WebKitFindOptions>((findOptions & FindOptionsCaseInsensitive ? WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE : 0)
- | (findOptions & FindOptionsAtWordStarts ? WEBKIT_FIND_OPTIONS_AT_WORD_STARTS : 0)
- | (findOptions & FindOptionsTreatMedialCapitalAsWordStart ? WEBKIT_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START : 0)
- | (findOptions & FindOptionsBackwards ? WEBKIT_FIND_OPTIONS_BACKWARDS : 0)
- | (findOptions & FindOptionsWrapAround ? WEBKIT_FIND_OPTIONS_WRAP_AROUND : 0));
-}
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE, FindOptionsCaseInsensitive);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_FIND_OPTIONS_AT_WORD_STARTS, FindOptionsAtWordStarts);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START, FindOptionsTreatMedialCapitalAsWordStart);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_FIND_OPTIONS_BACKWARDS, FindOptionsBackwards);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_FIND_OPTIONS_WRAP_AROUND, FindOptionsWrapAround);
-static void didFindString(WKPageRef, WKStringRef, unsigned matchCount, const void* clientInfo)
+static void didFindString(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo)
{
g_signal_emit(WEBKIT_FIND_CONTROLLER(clientInfo), signals[FOUND_TEXT], 0, matchCount);
}
-static void didFailToFindString(WKPageRef, WKStringRef, const void* clientInfo)
+static void didFailToFindString(WKPageRef page, WKStringRef string, const void* clientInfo)
{
g_signal_emit(WEBKIT_FIND_CONTROLLER(clientInfo), signals[FAILED_TO_FIND_TEXT], 0);
}
-static void didCountStringMatches(WKPageRef, WKStringRef, unsigned matchCount, const void* clientInfo)
+static void didCountStringMatches(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo)
{
g_signal_emit(WEBKIT_FIND_CONTROLLER(clientInfo), signals[COUNTED_MATCHES], 0, matchCount);
}
@@ -319,7 +306,7 @@ guint32 webkit_find_controller_get_options(WebKitFindController* findController)
{
g_return_val_if_fail(WEBKIT_IS_FIND_CONTROLLER(findController), WEBKIT_FIND_OPTIONS_NONE);
- return toWebKitFindOptions(findController->priv->findOptions);
+ return findController->priv->findOptions;
}
/**
@@ -362,7 +349,7 @@ static void webKitFindControllerPerform(WebKitFindController* findController, We
WebKitFindControllerPrivate* priv = findController->priv;
if (operation == CountOperation) {
getPage(findController)->countStringMatches(String::fromUTF8(priv->searchText.data()),
- static_cast<WebKit::FindOptions>(priv->findOptions), priv->maxMatchCount);
+ static_cast<WebKit::FindOptions>(priv->findOptions), priv->maxMatchCount);
return;
}
@@ -419,7 +406,8 @@ void webkit_find_controller_search(WebKitFindController* findController, const g
{
g_return_if_fail(WEBKIT_IS_FIND_CONTROLLER(findController));
g_return_if_fail(searchText);
- webKitFindControllerSetSearchData(findController, searchText, toWebFindOptions(findOptions), maxMatchCount);
+
+ webKitFindControllerSetSearchData(findController, searchText, findOptions, maxMatchCount);
webKitFindControllerPerform(findController, FindOperation);
}
@@ -436,7 +424,7 @@ void webkit_find_controller_search_next(WebKitFindController* findController)
{
g_return_if_fail(WEBKIT_IS_FIND_CONTROLLER(findController));
- findController->priv->findOptions &= ~FindOptionsBackwards;
+ findController->priv->findOptions &= ~WEBKIT_FIND_OPTIONS_BACKWARDS;
findController->priv->findOptions &= ~FindOptionsShowHighlight;
webKitFindControllerPerform(findController, FindNextPrevOperation);
}
@@ -454,7 +442,7 @@ void webkit_find_controller_search_previous(WebKitFindController* findController
{
g_return_if_fail(WEBKIT_IS_FIND_CONTROLLER(findController));
- findController->priv->findOptions |= FindOptionsBackwards;
+ findController->priv->findOptions |= WEBKIT_FIND_OPTIONS_BACKWARDS;
findController->priv->findOptions &= ~FindOptionsShowHighlight;
webKitFindControllerPerform(findController, FindNextPrevOperation);
}
@@ -476,7 +464,7 @@ void webkit_find_controller_count_matches(WebKitFindController* findController,
g_return_if_fail(WEBKIT_IS_FIND_CONTROLLER(findController));
g_return_if_fail(searchText);
- webKitFindControllerSetSearchData(findController, searchText, toWebFindOptions(findOptions), maxMatchCount);
+ webKitFindControllerSetSearchData(findController, searchText, findOptions, maxMatchCount);
webKitFindControllerPerform(findController, CountOperation);
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.h b/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.h
index 8f3e438ff..7bad1d051 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.h
@@ -62,7 +62,7 @@ typedef enum {
WEBKIT_FIND_OPTIONS_AT_WORD_STARTS = 1 << 1,
WEBKIT_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START = 1 << 2,
WEBKIT_FIND_OPTIONS_BACKWARDS = 1 << 3,
- WEBKIT_FIND_OPTIONS_WRAP_AROUND = 1 << 4
+ WEBKIT_FIND_OPTIONS_WRAP_AROUND = 1 << 4,
} WebKitFindOptions;
struct _WebKitFindController {
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.cpp
index 12ec927a8..a07f04948 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFormClient.cpp
@@ -20,17 +20,15 @@
#include "config.h"
#include "WebKitFormClient.h"
-#include "APIDictionary.h"
-#include "WebFormSubmissionListenerProxy.h"
#include "WebKitFormSubmissionRequestPrivate.h"
#include "WebKitPrivate.h"
#include "WebKitWebViewBasePrivate.h"
#include "WebKitWebViewPrivate.h"
-#include <wtf/glib/GRefPtr.h>
+#include <wtf/gobject/GRefPtr.h>
using namespace WebKit;
-static void willSubmitForm(WKPageRef, WKFrameRef, WKFrameRef, WKDictionaryRef values, WKTypeRef /* userData */, WKFormSubmissionListenerRef listener, const void* clientInfo)
+static void willSubmitForm(WKPageRef page, WKFrameRef frame, WKFrameRef sourceFrame, WKDictionaryRef values, WKTypeRef userData, WKFormSubmissionListenerRef listener, const void* clientInfo)
{
GRefPtr<WebKitFormSubmissionRequest> request = adoptGRef(webkitFormSubmissionRequestCreate(toImpl(values), toImpl(listener)));
webkitWebViewSubmitFormRequest(WEBKIT_WEB_VIEW(clientInfo), request.get());
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp
index 7af2aee10..8519a2cb6 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequest.cpp
@@ -20,11 +20,11 @@
#include "config.h"
#include "WebKitFormSubmissionRequest.h"
-#include "APIDictionary.h"
#include "APIString.h"
+#include "ImmutableDictionary.h"
#include "WebFormSubmissionListenerProxy.h"
#include "WebKitFormSubmissionRequestPrivate.h"
-#include <wtf/glib/GRefPtr.h>
+#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/CString.h>
using namespace WebKit;
@@ -45,7 +45,7 @@ using namespace WebKit;
*/
struct _WebKitFormSubmissionRequestPrivate {
- RefPtr<API::Dictionary> webValues;
+ RefPtr<ImmutableDictionary> webValues;
RefPtr<WebFormSubmissionListenerProxy> listener;
GRefPtr<GHashTable> values;
bool handledRequest;
@@ -70,7 +70,7 @@ static void webkit_form_submission_request_class_init(WebKitFormSubmissionReques
objectClass->dispose = webkitFormSubmissionRequestDispose;
}
-WebKitFormSubmissionRequest* webkitFormSubmissionRequestCreate(API::Dictionary* values, WebFormSubmissionListenerProxy* listener)
+WebKitFormSubmissionRequest* webkitFormSubmissionRequestCreate(ImmutableDictionary* values, WebFormSubmissionListenerProxy* listener)
{
WebKitFormSubmissionRequest* request = WEBKIT_FORM_SUBMISSION_REQUEST(g_object_new(WEBKIT_TYPE_FORM_SUBMISSION_REQUEST, NULL));
request->priv->webValues = values;
@@ -96,18 +96,18 @@ GHashTable* webkit_form_submission_request_get_text_fields(WebKitFormSubmissionR
return request->priv->values.get();
if (!request->priv->webValues->size())
- return nullptr;
+ return 0;
request->priv->values = adoptGRef(g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free));
- const API::Dictionary::MapType& map = request->priv->webValues->map();
- API::Dictionary::MapType::const_iterator end = map.end();
- for (API::Dictionary::MapType::const_iterator it = map.begin(); it != end; ++it) {
+ const ImmutableDictionary::MapType& map = request->priv->webValues->map();
+ ImmutableDictionary::MapType::const_iterator end = map.end();
+ for (ImmutableDictionary::MapType::const_iterator it = map.begin(); it != end; ++it) {
API::String* value = static_cast<API::String*>(it->value.get());
g_hash_table_insert(request->priv->values.get(), g_strdup(it->key.utf8().data()), g_strdup(value->string().utf8().data()));
}
- request->priv->webValues = nullptr;
+ request->priv->webValues = 0;
return request->priv->values.get();
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequestPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequestPrivate.h
index 1d2b499f6..9fe4751d2 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequestPrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFormSubmissionRequestPrivate.h
@@ -23,6 +23,6 @@
#include "WebKitFormSubmissionRequest.h"
#include "WebKitPrivate.h"
-WebKitFormSubmissionRequest* webkitFormSubmissionRequestCreate(API::Dictionary* values, WebKit::WebFormSubmissionListenerProxy*);
+WebKitFormSubmissionRequest* webkitFormSubmissionRequestCreate(WebKit::ImmutableDictionary* values, WebKit::WebFormSubmissionListenerProxy*);
#endif // WebKitFormSubmissionRequestPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitForwardDeclarations.h b/Source/WebKit2/UIProcess/API/gtk/WebKitForwardDeclarations.h
index 543f4b136..a9898de48 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitForwardDeclarations.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitForwardDeclarations.h
@@ -23,7 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) && !defined(__WEBKIT_WEB_EXTENSION_H_INSIDE__)
+#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
#error "Only <webkit2/webkit2.h> can be included directly."
#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitGeolocationPermissionRequest.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitGeolocationPermissionRequest.cpp
index 871c3cf3e..f780dafb2 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitGeolocationPermissionRequest.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitGeolocationPermissionRequest.cpp
@@ -35,9 +35,6 @@ using namespace WebKit;
* WebKitGeolocationPermissionRequest represents a request for
* permission to decide whether WebKit should provide the user's
* location to a website when requested throught the Geolocation API.
- *
- * When a WebKitGeolocationPermissionRequest is not handled by the user,
- * it is denied by default.
*/
static void webkit_permission_request_interface_init(WebKitPermissionRequestIface*);
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitGeolocationProvider.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitGeolocationProvider.cpp
index 6ac0fbc98..261abf81a 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitGeolocationProvider.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitGeolocationProvider.cpp
@@ -38,12 +38,12 @@ static inline WebKitGeolocationProvider* toGeolocationProvider(const void* clien
return static_cast<WebKitGeolocationProvider*>(const_cast<void*>(clientInfo));
}
-static void startUpdatingCallback(WKGeolocationManagerRef, const void* clientInfo)
+static void startUpdatingCallback(WKGeolocationManagerRef geolocationManager, const void* clientInfo)
{
toGeolocationProvider(clientInfo)->startUpdating();
}
-static void stopUpdatingCallback(WKGeolocationManagerRef, const void* clientInfo)
+static void stopUpdatingCallback(WKGeolocationManagerRef geolocationManager, const void* clientInfo)
{
toGeolocationProvider(clientInfo)->stopUpdating();
}
@@ -51,12 +51,11 @@ static void stopUpdatingCallback(WKGeolocationManagerRef, const void* clientInfo
WebKitGeolocationProvider::~WebKitGeolocationProvider()
{
m_provider.stopUpdating();
- WKGeolocationManagerSetProvider(toAPI(m_geolocationManager.get()), nullptr);
}
-Ref<WebKitGeolocationProvider> WebKitGeolocationProvider::create(WebGeolocationManagerProxy* geolocationManager)
+PassRefPtr<WebKitGeolocationProvider> WebKitGeolocationProvider::create(WebGeolocationManagerProxy* geolocationManager)
{
- return adoptRef(*new WebKitGeolocationProvider(geolocationManager));
+ return adoptRef(new WebKitGeolocationProvider(geolocationManager));
}
WebKitGeolocationProvider::WebKitGeolocationProvider(WebGeolocationManagerProxy* geolocationManager)
@@ -93,7 +92,7 @@ void WebKitGeolocationProvider::notifyPositionChanged(int timestamp, double lati
m_geolocationManager->providerDidChangePosition(position.get());
}
-void WebKitGeolocationProvider::notifyErrorOccurred(const char* /* message */)
+void WebKitGeolocationProvider::notifyErrorOccurred(const char* message)
{
m_geolocationManager->providerDidFailToDeterminePosition();
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitGeolocationProvider.h b/Source/WebKit2/UIProcess/API/gtk/WebKitGeolocationProvider.h
index 92586ce05..e6be3eac2 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitGeolocationProvider.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitGeolocationProvider.h
@@ -33,7 +33,7 @@ namespace WebKit {
class WebKitGeolocationProvider : public RefCounted<WebKitGeolocationProvider>, public WebCore::GeolocationProviderGeoclueClient {
public:
virtual ~WebKitGeolocationProvider();
- static Ref<WebKitGeolocationProvider> create(WebGeolocationManagerProxy*);
+ static PassRefPtr<WebKitGeolocationProvider> create(WebGeolocationManagerProxy*);
void startUpdating();
void stopUpdating();
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp
index 67769ca45..918d316c0 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp
@@ -221,36 +221,39 @@ static void webkit_hit_test_result_class_init(WebKitHitTestResultClass* hitTestR
paramFlags));
}
-WebKitHitTestResult* webkitHitTestResultCreate(const WebHitTestResult::Data& hitTestResult)
+WebKitHitTestResult* webkitHitTestResultCreate(WebHitTestResult* hitTestResult)
{
unsigned context = WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT;
- if (!hitTestResult.absoluteLinkURL.isEmpty())
+ const String& linkURL = hitTestResult->absoluteLinkURL();
+ if (!linkURL.isEmpty())
context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK;
- if (!hitTestResult.absoluteImageURL.isEmpty())
+ const String& imageURL = hitTestResult->absoluteImageURL();
+ if (!imageURL.isEmpty())
context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE;
- if (!hitTestResult.absoluteMediaURL.isEmpty())
+ const String& mediaURL = hitTestResult->absoluteMediaURL();
+ if (!mediaURL.isEmpty())
context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA;
- if (hitTestResult.isContentEditable)
+ if (hitTestResult->isContentEditable())
context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE;
- if (hitTestResult.isScrollbar)
+ if (hitTestResult->isScrollbar())
context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR;
- if (hitTestResult.isSelected)
- context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION;
+ const String& linkTitle = hitTestResult->linkTitle();
+ const String& linkLabel = hitTestResult->linkLabel();
return WEBKIT_HIT_TEST_RESULT(g_object_new(WEBKIT_TYPE_HIT_TEST_RESULT,
- "context", context,
- "link-uri", context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK ? hitTestResult.absoluteLinkURL.utf8().data() : nullptr,
- "image-uri", context & WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE ? hitTestResult.absoluteImageURL.utf8().data() : nullptr,
- "media-uri", context & WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA ? hitTestResult.absoluteMediaURL.utf8().data() : nullptr,
- "link-title", !hitTestResult.linkTitle.isEmpty() ? hitTestResult.linkTitle.utf8().data() : nullptr,
- "link-label", !hitTestResult.linkLabel.isEmpty() ? hitTestResult.linkLabel.utf8().data() : nullptr,
- nullptr));
+ "context", context,
+ "link-uri", !linkURL.isEmpty() ? linkURL.utf8().data() : 0,
+ "image-uri", !imageURL.isEmpty() ? imageURL.utf8().data() : 0,
+ "media-uri", !mediaURL.isEmpty() ? mediaURL.utf8().data() : 0,
+ "link-title", !linkTitle.isEmpty() ? linkTitle.utf8().data() : 0,
+ "link-label", !linkLabel.isEmpty() ? linkLabel.utf8().data() : 0,
+ NULL));
}
static bool stringIsEqualToCString(const String& string, const CString& cString)
@@ -258,17 +261,16 @@ static bool stringIsEqualToCString(const String& string, const CString& cString)
return ((string.isEmpty() && cString.isNull()) || (string.utf8() == cString));
}
-bool webkitHitTestResultCompare(WebKitHitTestResult* hitTestResult, const WebHitTestResult::Data& webHitTestResult)
+bool webkitHitTestResultCompare(WebKitHitTestResult* hitTestResult, WebHitTestResult* webHitTestResult)
{
WebKitHitTestResultPrivate* priv = hitTestResult->priv;
- return webHitTestResult.isContentEditable == webkit_hit_test_result_context_is_editable(hitTestResult)
- && webHitTestResult.isScrollbar == webkit_hit_test_result_context_is_scrollbar(hitTestResult)
- && webHitTestResult.isSelected == webkit_hit_test_result_context_is_selection(hitTestResult)
- && stringIsEqualToCString(webHitTestResult.absoluteLinkURL, priv->linkURI)
- && stringIsEqualToCString(webHitTestResult.linkTitle, priv->linkTitle)
- && stringIsEqualToCString(webHitTestResult.linkLabel, priv->linkLabel)
- && stringIsEqualToCString(webHitTestResult.absoluteImageURL, priv->imageURI)
- && stringIsEqualToCString(webHitTestResult.absoluteMediaURL, priv->mediaURI);
+ return webHitTestResult->isContentEditable() == webkit_hit_test_result_context_is_editable(hitTestResult)
+ && webHitTestResult->isScrollbar() == webkit_hit_test_result_context_is_scrollbar(hitTestResult)
+ && stringIsEqualToCString(webHitTestResult->absoluteLinkURL(), priv->linkURI)
+ && stringIsEqualToCString(webHitTestResult->linkTitle(), priv->linkTitle)
+ && stringIsEqualToCString(webHitTestResult->linkLabel(), priv->linkLabel)
+ && stringIsEqualToCString(webHitTestResult->absoluteImageURL(), priv->imageURI)
+ && stringIsEqualToCString(webHitTestResult->absoluteMediaURL(), priv->mediaURI);
}
/**
@@ -355,25 +357,6 @@ gboolean webkit_hit_test_result_context_is_editable(WebKitHitTestResult* hitTest
}
/**
- * webkit_hit_test_result_context_is_selection:
- * @hit_test_result: a #WebKitHitTestResult
- *
- * Gets whether %WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION flag is present in
- * #WebKitHitTestResult:context.
- *
- * Returns: %TRUE if there's a selected element at the coordinates of the @hit_test_result,
- * or %FALSE otherwise
- *
- * Since: 2.8
- */
-gboolean webkit_hit_test_result_context_is_selection(WebKitHitTestResult* hitTestResult)
-{
- g_return_val_if_fail(WEBKIT_IS_HIT_TEST_RESULT(hitTestResult), FALSE);
-
- return hitTestResult->priv->context & WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION;
-}
-
-/**
* webkit_hit_test_result_get_link_uri:
* @hit_test_result: a #WebKitHitTestResult
*
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.h b/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.h
index 718573b90..54611ba92 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.h
@@ -17,7 +17,7 @@
* Boston, MA 02110-1301, USA.
*/
-#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) && !defined(__WEBKIT_WEB_EXTENSION_H_INSIDE__)
+#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
#error "Only <webkit2/webkit2.h> can be included directly."
#endif
@@ -48,7 +48,6 @@ typedef struct _WebKitHitTestResultPrivate WebKitHitTestResultPrivate;
* @WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA: a video or audio element.
* @WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE: an editable element
* @WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR: a scrollbar element.
- * @WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION: a selected element. Since 2.8
*
* Enum values with flags representing the context of a #WebKitHitTestResult.
*/
@@ -59,8 +58,7 @@ typedef enum
WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE = 1 << 3,
WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA = 1 << 4,
WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE = 1 << 5,
- WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR = 1 << 6,
- WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION = 1 << 7
+ WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR = 1 << 6
} WebKitHitTestResultContext;
struct _WebKitHitTestResult {
@@ -96,9 +94,6 @@ webkit_hit_test_result_context_is_media (WebKitHitTestResult *hit_test_resul
WEBKIT_API gboolean
webkit_hit_test_result_context_is_editable (WebKitHitTestResult *hit_test_result);
-WEBKIT_API gboolean
-webkit_hit_test_result_context_is_selection (WebKitHitTestResult *hit_test_result);
-
WEBKIT_API const gchar *
webkit_hit_test_result_get_link_uri (WebKitHitTestResult *hit_test_result);
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResultPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResultPrivate.h
index a69b24b50..7ba2c3871 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResultPrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResultPrivate.h
@@ -23,7 +23,7 @@
#include "WebKitHitTestResult.h"
#include "WebKitPrivate.h"
-WebKitHitTestResult* webkitHitTestResultCreate(const WebKit::WebHitTestResult::Data&);
-bool webkitHitTestResultCompare(WebKitHitTestResult*, const WebKit::WebHitTestResult::Data&);
+WebKitHitTestResult* webkitHitTestResultCreate(WebKit::WebHitTestResult*);
+bool webkitHitTestResultCompare(WebKitHitTestResult*, WebKit::WebHitTestResult*);
#endif // WebKitHitTestResultPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitInjectedBundleClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitInjectedBundleClient.cpp
index 7205f0ae0..1b77b6ea7 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitInjectedBundleClient.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitInjectedBundleClient.cpp
@@ -21,18 +21,17 @@
#include "WebKitInjectedBundleClient.h"
#include "WebImage.h"
-#include "WebKitPrivate.h"
#include "WebKitURIRequestPrivate.h"
#include "WebKitURIResponsePrivate.h"
#include "WebKitWebContextPrivate.h"
#include "WebKitWebResourcePrivate.h"
#include "WebKitWebViewPrivate.h"
-#include <wtf/glib/GUniquePtr.h>
+#include <wtf/gobject/GUniquePtr.h>
using namespace WebKit;
using namespace WebCore;
-static void didReceiveWebViewMessageFromInjectedBundle(WebKitWebView* webView, const char* messageName, API::Dictionary& message)
+static void didReceiveWebViewMessageFromInjectedBundle(WebKitWebView* webView, const char* messageName, ImmutableDictionary& message)
{
if (g_str_equal(messageName, "DidInitiateLoadForResource")) {
WebFrameProxy* frame = static_cast<WebFrameProxy*>(message.get(String::fromUTF8("Frame")));
@@ -88,12 +87,9 @@ static void didReceiveWebViewMessageFromInjectedBundle(WebKitWebView* webView, c
API::Error* webError = static_cast<API::Error*>(message.get(String::fromUTF8("Error")));
const ResourceError& platformError = webError->platformError();
GUniquePtr<GError> resourceError(g_error_new_literal(g_quark_from_string(platformError.domain().utf8().data()),
- toWebKitError(platformError.errorCode()), platformError.localizedDescription().utf8().data()));
- if (platformError.tlsErrors())
- webkitWebResourceFailedWithTLSErrors(resource.get(), static_cast<GTlsCertificateFlags>(platformError.tlsErrors()), platformError.certificate());
- else
- webkitWebResourceFailed(resource.get(), resourceError.get());
+ platformError.errorCode(), platformError.localizedDescription().utf8().data()));
+ webkitWebResourceFailed(resource.get(), resourceError.get());
webkitWebViewRemoveLoadingWebResource(webView, resourceIdentifier->value());
} else if (g_str_equal(messageName, "DidGetSnapshot")) {
API::UInt64* callbackID = static_cast<API::UInt64*>(message.get("CallbackID"));
@@ -106,7 +102,7 @@ static void didReceiveWebViewMessageFromInjectedBundle(WebKitWebView* webView, c
static void didReceiveMessageFromInjectedBundle(WKContextRef, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo)
{
ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
- API::Dictionary& message = *toImpl(static_cast<WKDictionaryRef>(messageBody));
+ ImmutableDictionary& message = *toImpl(static_cast<WKDictionaryRef>(messageBody));
CString messageNameCString = toImpl(messageName)->string().utf8();
const char* messageNameUTF8 = messageNameCString.data();
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitInstallMissingMediaPluginsPermissionRequest.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitInstallMissingMediaPluginsPermissionRequest.cpp
deleted file mode 100644
index d516b61ad..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitInstallMissingMediaPluginsPermissionRequest.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (C) 2015 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "WebKitInstallMissingMediaPluginsPermissionRequest.h"
-
-#include "WebKitInstallMissingMediaPluginsPermissionRequestPrivate.h"
-#include "WebKitPermissionRequest.h"
-#include "WebPageProxy.h"
-
-#if ENABLE(VIDEO)
-#include <WebCore/PlatformDisplay.h>
-#include <gtk/gtk.h>
-#if PLATFORM(X11)
-#include <gdk/gdkx.h>
-#endif
-#endif
-
-using namespace WebKit;
-using namespace WebCore;
-
-/**
- * SECTION: WebKitInstallMissingMediaPluginsPermissionRequest
- * @Short_description: A permission request for installing missing media plugins
- * @Title: WebKitInstallMissingMediaPluginsPermissionRequest
- * @See_also: #WebKitPermissionRequest, #WebKitWebView
- *
- * WebKitInstallMissingMediaPluginsPermissionRequest represents a request for
- * permission to decide whether WebKit should try to start a helper application to
- * install missing media plugins when the media backend couldn't play a media because
- * the required plugins were not available.
- *
- * When a WebKitInstallMissingMediaPluginsPermissionRequest is not handled by the user,
- * it is allowed by default.
- *
- * Since: 2.10
- */
-
-static void webkit_permission_request_interface_init(WebKitPermissionRequestIface*);
-
-struct _WebKitInstallMissingMediaPluginsPermissionRequestPrivate {
-#if ENABLE(VIDEO)
- RefPtr<InstallMissingMediaPluginsPermissionRequest> request;
-#endif
- CString description;
- bool madeDecision;
-};
-
-WEBKIT_DEFINE_TYPE_WITH_CODE(
- WebKitInstallMissingMediaPluginsPermissionRequest, webkit_install_missing_media_plugins_permission_request, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE(WEBKIT_TYPE_PERMISSION_REQUEST, webkit_permission_request_interface_init))
-
-#if ENABLE(VIDEO)
-static GUniquePtr<GstInstallPluginsContext> createGstInstallPluginsContext(GtkWidget* widget)
-{
-#if PLATFORM(X11)
- if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::X11) {
- GUniquePtr<GstInstallPluginsContext> context(gst_install_plugins_context_new());
- gst_install_plugins_context_set_xid(context.get(), GDK_WINDOW_XID(gtk_widget_get_window(widget)));
- return context;
- }
-#endif
-
- return nullptr;
-}
-#endif
-
-static void webkitInstallMissingMediaPluginsPermissionRequestAllow(WebKitPermissionRequest* request)
-{
- ASSERT(WEBKIT_IS_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST(request));
-
- WebKitInstallMissingMediaPluginsPermissionRequestPrivate* priv = WEBKIT_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST(request)->priv;
-
- // Only one decision at a time.
- if (priv->madeDecision)
- return;
-#if ENABLE(VIDEO)
- priv->request->allow(createGstInstallPluginsContext(priv->request->page().viewWidget()));
-#endif
- priv->madeDecision = true;
-}
-
-static void webkitInstallMissingMediaPluginsPermissionRequestDeny(WebKitPermissionRequest* request)
-{
- ASSERT(WEBKIT_IS_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST(request));
-
- WebKitInstallMissingMediaPluginsPermissionRequestPrivate* priv = WEBKIT_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST(request)->priv;
-
- // Only one decision at a time.
- if (priv->madeDecision)
- return;
-
-#if ENABLE(VIDEO)
- priv->request->deny();
-#endif
- priv->madeDecision = true;
-}
-
-static void webkit_permission_request_interface_init(WebKitPermissionRequestIface* iface)
-{
- iface->allow = webkitInstallMissingMediaPluginsPermissionRequestAllow;
- iface->deny = webkitInstallMissingMediaPluginsPermissionRequestDeny;
-}
-
-static void webkitInstallMissingMediaPluginsPermissionRequestDispose(GObject* object)
-{
- // Default behaviour when no decision has been made is allowing the request for backwards compatibility.
- webkitInstallMissingMediaPluginsPermissionRequestDeny(WEBKIT_PERMISSION_REQUEST(object));
- G_OBJECT_CLASS(webkit_install_missing_media_plugins_permission_request_parent_class)->dispose(object);
-}
-
-static void webkit_install_missing_media_plugins_permission_request_class_init(WebKitInstallMissingMediaPluginsPermissionRequestClass* klass)
-{
- GObjectClass* objectClass = G_OBJECT_CLASS(klass);
- objectClass->dispose = webkitInstallMissingMediaPluginsPermissionRequestDispose;
-}
-
-#if ENABLE(VIDEO)
-WebKitInstallMissingMediaPluginsPermissionRequest* webkitInstallMissingMediaPluginsPermissionRequestCreate(InstallMissingMediaPluginsPermissionRequest& request)
-{
- WebKitInstallMissingMediaPluginsPermissionRequest* permissionRequest = WEBKIT_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST(g_object_new(WEBKIT_TYPE_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST, nullptr));
- permissionRequest->priv->request = &request;
- return permissionRequest;
-}
-#endif
-
-/**
- * webkit_install_missing_media_plugins_permission_request_get_description:
- * @request: a #WebKitInstallMissingMediaPluginsPermissionRequest
- *
- * Gets the description about the missing plugins provided by the media backend when a media couldn't be played.
- *
- * Returns: a string with the description provided by the media backend.
- *
- * Since: 2.10
- */
-const char* webkit_install_missing_media_plugins_permission_request_get_description(WebKitInstallMissingMediaPluginsPermissionRequest* request)
-{
- g_return_val_if_fail(WEBKIT_IS_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST(request), nullptr);
-
-#if ENABLE(VIDEO)
- if (!request->priv->description.isNull())
- return request->priv->description.data();
-
- const auto& description = request->priv->request->description();
- ASSERT(!description.isEmpty());
- request->priv->description = description.utf8();
-#endif
- return request->priv->description.data();
-}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitInstallMissingMediaPluginsPermissionRequest.h b/Source/WebKit2/UIProcess/API/gtk/WebKitInstallMissingMediaPluginsPermissionRequest.h
deleted file mode 100644
index e0632afa5..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitInstallMissingMediaPluginsPermissionRequest.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2015 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
-#error "Only <webkit2/webkit2.h> can be included directly."
-#endif
-
-#ifndef WebKitInstallMissingMediaPluginsPermissionRequest_h
-#define WebKitInstallMissingMediaPluginsPermissionRequest_h
-
-#include <glib-object.h>
-#include <webkit2/WebKitDefines.h>
-
-G_BEGIN_DECLS
-
-#define WEBKIT_TYPE_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST (webkit_install_missing_media_plugins_permission_request_get_type())
-#define WEBKIT_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST, WebKitInstallMissingMediaPluginsPermissionRequest))
-#define WEBKIT_IS_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST))
-#define WEBKIT_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST, WebKitInstallMissingMediaPluginsPermissionRequestClass))
-#define WEBKIT_IS_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST))
-#define WEBKIT_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST, WebKitInstallMissingMediaPluginsPermissionRequestClass))
-
-typedef struct _WebKitInstallMissingMediaPluginsPermissionRequest WebKitInstallMissingMediaPluginsPermissionRequest;
-typedef struct _WebKitInstallMissingMediaPluginsPermissionRequestClass WebKitInstallMissingMediaPluginsPermissionRequestClass;
-typedef struct _WebKitInstallMissingMediaPluginsPermissionRequestPrivate WebKitInstallMissingMediaPluginsPermissionRequestPrivate;
-
-struct _WebKitInstallMissingMediaPluginsPermissionRequest {
- GObject parent;
-
- WebKitInstallMissingMediaPluginsPermissionRequestPrivate *priv;
-};
-
-struct _WebKitInstallMissingMediaPluginsPermissionRequestClass {
- GObjectClass parent_class;
-
- void (*_webkit_reserved0) (void);
- void (*_webkit_reserved1) (void);
- void (*_webkit_reserved2) (void);
- void (*_webkit_reserved3) (void);
-};
-
-WEBKIT_API GType
-webkit_install_missing_media_plugins_permission_request_get_type (void);
-
-WEBKIT_API const gchar *
-webkit_install_missing_media_plugins_permission_request_get_description (WebKitInstallMissingMediaPluginsPermissionRequest *request);
-
-G_END_DECLS
-
-#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitJavascriptResult.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitJavascriptResult.cpp
index 79ec69b70..9bbd3f4ed 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitJavascriptResult.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitJavascriptResult.cpp
@@ -20,18 +20,18 @@
#include "config.h"
#include "WebKitJavascriptResult.h"
-#include "APISerializedScriptValue.h"
#include "WebKitJavascriptResultPrivate.h"
-#include <wtf/glib/GRefPtr.h>
+#include "WebSerializedScriptValue.h"
+#include <wtf/gobject/GRefPtr.h>
using namespace WebKit;
struct _WebKitJavascriptResult {
- _WebKitJavascriptResult(WebKitWebView* view, WebCore::SerializedScriptValue& serializedScriptValue)
+ _WebKitJavascriptResult(WebKitWebView* view, WebSerializedScriptValue* serializedScriptValue)
: webView(view)
, referenceCount(1)
{
- value = serializedScriptValue.deserialize(webkit_web_view_get_javascript_global_context(view), nullptr);
+ value = serializedScriptValue->deserialize(webkit_web_view_get_javascript_global_context(view), 0);
}
GRefPtr<WebKitWebView> webView;
@@ -42,9 +42,9 @@ struct _WebKitJavascriptResult {
G_DEFINE_BOXED_TYPE(WebKitJavascriptResult, webkit_javascript_result, webkit_javascript_result_ref, webkit_javascript_result_unref)
-WebKitJavascriptResult* webkitJavascriptResultCreate(WebKitWebView* webView, WebCore::SerializedScriptValue& serializedScriptValue)
+WebKitJavascriptResult* webkitJavascriptResultCreate(WebKitWebView* webView, WebSerializedScriptValue* serializedScriptValue)
{
- WebKitJavascriptResult* result = static_cast<WebKitJavascriptResult*>(fastMalloc(sizeof(WebKitJavascriptResult)));
+ WebKitJavascriptResult* result = g_slice_new(WebKitJavascriptResult);
new (result) WebKitJavascriptResult(webView, serializedScriptValue);
return result;
}
@@ -77,7 +77,7 @@ void webkit_javascript_result_unref(WebKitJavascriptResult* javascriptResult)
{
if (g_atomic_int_dec_and_test(&javascriptResult->referenceCount)) {
javascriptResult->~WebKitJavascriptResult();
- fastFree(javascriptResult);
+ g_slice_free(WebKitJavascriptResult, javascriptResult);
}
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitJavascriptResultPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitJavascriptResultPrivate.h
index 23e2e7926..e47e94c1b 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitJavascriptResultPrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitJavascriptResultPrivate.h
@@ -20,11 +20,10 @@
#ifndef WebKitJavascriptResultPrivate_h
#define WebKitJavascriptResultPrivate_h
-#include <WebCore/SerializedScriptValue.h>
#include "WebKitJavascriptResult.h"
#include "WebKitPrivate.h"
#include "WebKitWebView.h"
-WebKitJavascriptResult* webkitJavascriptResultCreate(WebKitWebView*, WebCore::SerializedScriptValue&);
+WebKitJavascriptResult* webkitJavascriptResultCreate(WebKitWebView*, WebKit::WebSerializedScriptValue*);
#endif // WebKitJavascriptResultPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp
index e46fa1c6d..4b2e59c25 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp
@@ -21,107 +21,166 @@
#include "config.h"
#include "WebKitLoaderClient.h"
-#include "APILoaderClient.h"
#include "WebKitBackForwardListPrivate.h"
-#include "WebKitPrivate.h"
#include "WebKitURIResponsePrivate.h"
#include "WebKitWebViewBasePrivate.h"
#include "WebKitWebViewPrivate.h"
-#include <wtf/glib/GUniquePtr.h>
+#include <wtf/gobject/GUniquePtr.h>
#include <wtf/text/CString.h>
using namespace WebKit;
using namespace WebCore;
-class LoaderClient : public API::LoaderClient {
-public:
- explicit LoaderClient(WebKitWebView* webView)
- : m_webView(webView)
- {
- }
-
-private:
- void didStartProvisionalLoadForFrame(WebPageProxy&, WebFrameProxy& frame, API::Navigation*, API::Object* /* userData */) override
- {
- if (!frame.isMainFrame())
- return;
- webkitWebViewLoadChanged(m_webView, WEBKIT_LOAD_STARTED);
- }
-
- void didReceiveServerRedirectForProvisionalLoadForFrame(WebPageProxy&, WebFrameProxy& frame, API::Navigation*, API::Object* /* userData */) override
- {
- if (!frame.isMainFrame())
- return;
- webkitWebViewLoadChanged(m_webView, WEBKIT_LOAD_REDIRECTED);
- }
-
- void didFailProvisionalLoadWithErrorForFrame(WebPageProxy&, WebFrameProxy& frame, API::Navigation*, const ResourceError& resourceError, API::Object* /* userData */) override
- {
- if (!frame.isMainFrame())
- return;
- GUniquePtr<GError> error(g_error_new_literal(g_quark_from_string(resourceError.domain().utf8().data()),
- toWebKitError(resourceError.errorCode()), resourceError.localizedDescription().utf8().data()));
- if (resourceError.tlsErrors()) {
- webkitWebViewLoadFailedWithTLSErrors(m_webView, resourceError.failingURL().utf8().data(), error.get(),
- static_cast<GTlsCertificateFlags>(resourceError.tlsErrors()), resourceError.certificate());
- } else
- webkitWebViewLoadFailed(m_webView, WEBKIT_LOAD_STARTED, resourceError.failingURL().utf8().data(), error.get());
- }
-
- void didCommitLoadForFrame(WebPageProxy&, WebFrameProxy& frame, API::Navigation*, API::Object* /* userData */) override
- {
- if (!frame.isMainFrame())
- return;
- webkitWebViewLoadChanged(m_webView, WEBKIT_LOAD_COMMITTED);
- }
-
- void didFinishLoadForFrame(WebPageProxy&, WebFrameProxy& frame, API::Navigation*, API::Object* /* userData */) override
- {
- if (!frame.isMainFrame())
- return;
- webkitWebViewLoadChanged(m_webView, WEBKIT_LOAD_FINISHED);
- }
-
- void didFailLoadWithErrorForFrame(WebPageProxy&, WebFrameProxy& frame, API::Navigation*, const ResourceError& resourceError, API::Object* /* userData */) override
- {
- if (!frame.isMainFrame())
- return;
- GUniquePtr<GError> error(g_error_new_literal(g_quark_from_string(resourceError.domain().utf8().data()),
- toWebKitError(resourceError.errorCode()), resourceError.localizedDescription().utf8().data()));
- webkitWebViewLoadFailed(m_webView, WEBKIT_LOAD_COMMITTED, resourceError.failingURL().utf8().data(), error.get());
- }
-
- void didDisplayInsecureContentForFrame(WebPageProxy&, WebFrameProxy&, API::Object* /* userData */) override
- {
- webkitWebViewInsecureContentDetected(m_webView, WEBKIT_INSECURE_CONTENT_DISPLAYED);
- }
-
- void didRunInsecureContentForFrame(WebPageProxy&, WebFrameProxy&, API::Object* /* userData */) override
- {
- webkitWebViewInsecureContentDetected(m_webView, WEBKIT_INSECURE_CONTENT_RUN);
- }
-
- void didChangeBackForwardList(WebPageProxy&, WebBackForwardListItem* addedItem, Vector<RefPtr<WebBackForwardListItem>> removedItems) override
- {
- webkitBackForwardListChanged(webkit_web_view_get_back_forward_list(m_webView), addedItem, removedItems);
- }
-
- void didReceiveAuthenticationChallengeInFrame(WebPageProxy&, WebFrameProxy&, AuthenticationChallengeProxy* authenticationChallenge) override
- {
- webkitWebViewHandleAuthenticationChallenge(m_webView, authenticationChallenge);
- }
-
- void processDidCrash(WebPageProxy&) override
- {
- webkitWebViewWebProcessCrashed(m_webView);
- }
-
- WebKitWebView* m_webView;
-};
+static void didStartProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
+{
+ if (!WKFrameIsMainFrame(frame))
+ return;
+
+ webkitWebViewLoadChanged(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_LOAD_STARTED);
+}
+
+static void didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
+{
+ if (!WKFrameIsMainFrame(frame))
+ return;
+
+ webkitWebViewLoadChanged(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_LOAD_REDIRECTED);
+}
+
+static void didFailProvisionalLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void* clientInfo)
+{
+ if (!WKFrameIsMainFrame(frame))
+ return;
+
+ const ResourceError& resourceError = toImpl(error)->platformError();
+ GUniquePtr<GError> webError(g_error_new_literal(g_quark_from_string(resourceError.domain().utf8().data()),
+ resourceError.errorCode(), resourceError.localizedDescription().utf8().data()));
+ if (resourceError.tlsErrors()) {
+ webkitWebViewLoadFailedWithTLSErrors(WEBKIT_WEB_VIEW(clientInfo), resourceError.failingURL().utf8().data(), webError.get(),
+ static_cast<GTlsCertificateFlags>(resourceError.tlsErrors()), resourceError.certificate());
+ } else
+ webkitWebViewLoadFailed(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_LOAD_STARTED, resourceError.failingURL().utf8().data(), webError.get());
+}
+
+static void didCommitLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
+{
+ if (!WKFrameIsMainFrame(frame))
+ return;
+
+ webkitWebViewLoadChanged(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_LOAD_COMMITTED);
+}
+
+static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
+{
+ if (!WKFrameIsMainFrame(frame))
+ return;
+
+ webkitWebViewLoadChanged(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_LOAD_FINISHED);
+}
+
+static void didFailLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef, const void* clientInfo)
+{
+ if (!WKFrameIsMainFrame(frame))
+ return;
+
+ const ResourceError& resourceError = toImpl(error)->platformError();
+ GUniquePtr<GError> webError(g_error_new_literal(g_quark_from_string(resourceError.domain().utf8().data()),
+ resourceError.errorCode(), resourceError.localizedDescription().utf8().data()));
+ webkitWebViewLoadFailed(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_LOAD_COMMITTED,
+ resourceError.failingURL().utf8().data(), webError.get());
+}
+
+static void didSameDocumentNavigationForFrame(WKPageRef page, WKFrameRef frame, WKSameDocumentNavigationType, WKTypeRef, const void* clientInfo)
+{
+ if (!WKFrameIsMainFrame(frame))
+ return;
+
+ webkitWebViewUpdateURI(WEBKIT_WEB_VIEW(clientInfo));
+}
+
+static void didReceiveTitleForFrame(WKPageRef page, WKStringRef titleRef, WKFrameRef frameRef, WKTypeRef, const void* clientInfo)
+{
+ if (!WKFrameIsMainFrame(frameRef))
+ return;
+
+ webkitWebViewSetTitle(WEBKIT_WEB_VIEW(clientInfo), toImpl(titleRef)->string().utf8());
+}
+
+static void didDisplayInsecureContentForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
+{
+ webkitWebViewInsecureContentDetected(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_INSECURE_CONTENT_DISPLAYED);
+}
+
+static void didRunInsecureContentForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
+{
+ webkitWebViewInsecureContentDetected(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_INSECURE_CONTENT_RUN);
+}
+
+static void didChangeProgress(WKPageRef page, const void* clientInfo)
+{
+ webkitWebViewSetEstimatedLoadProgress(WEBKIT_WEB_VIEW(clientInfo), WKPageGetEstimatedProgress(page));
+}
+
+static void didChangeBackForwardList(WKPageRef page, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void* clientInfo)
+{
+ webkitBackForwardListChanged(webkit_web_view_get_back_forward_list(WEBKIT_WEB_VIEW(clientInfo)), toImpl(addedItem), toImpl(removedItems));
+}
+
+static void didReceiveAuthenticationChallengeInFrame(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo)
+{
+ webkitWebViewHandleAuthenticationChallenge(WEBKIT_WEB_VIEW(clientInfo), toImpl(authenticationChallenge));
+}
+
+static void processDidCrash(WKPageRef page, const void* clientInfo)
+{
+ webkitWebViewWebProcessCrashed(WEBKIT_WEB_VIEW(clientInfo));
+}
void attachLoaderClientToView(WebKitWebView* webView)
{
- WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView));
- page->setLoaderClient(std::make_unique<LoaderClient>(webView));
+ WKPageLoaderClientV3 wkLoaderClient = {
+ {
+ 3, // version
+ webView, // clientInfo
+ },
+ didStartProvisionalLoadForFrame,
+ didReceiveServerRedirectForProvisionalLoadForFrame,
+ didFailProvisionalLoadWithErrorForFrame,
+ didCommitLoadForFrame,
+ 0, // didFinishDocumentLoadForFrame
+ didFinishLoadForFrame,
+ didFailLoadWithErrorForFrame,
+ didSameDocumentNavigationForFrame,
+ didReceiveTitleForFrame,
+ 0, // didFirstLayoutForFrame
+ 0, // didFirstVisuallyNonEmptyLayoutForFrame
+ 0, // didRemoveFrameFromHierarchy
+ didDisplayInsecureContentForFrame,
+ didRunInsecureContentForFrame,
+ 0, // canAuthenticateAgainstProtectionSpaceInFrame
+ didReceiveAuthenticationChallengeInFrame,
+ didChangeProgress, // didStartProgress
+ didChangeProgress,
+ didChangeProgress, // didFinishProgress
+ 0, // didBecomeUnresponsive
+ 0, // didBecomeResponsive
+ processDidCrash,
+ didChangeBackForwardList,
+ 0, // shouldGoToBackForwardListItem
+ 0, // didFailToInitializePlugin
+ 0, // didDetectXSSForFrame
+ 0, // didFirstVisuallyNonEmptyLayoutForFrame
+ 0, // willGoToBackForwardListItem
+ 0, // interactionOccurredWhileProcessUnresponsive
+ 0, // pluginDidFail_deprecatedForUseWithV1
+ 0, // didReceiveIntentForFrame
+ 0, // registerIntentServiceForFrame
+ 0, // didLayout
+ 0, // pluginLoadPolicy_deprecatedForUseWithV2
+ 0, // pluginDidFail
+ 0, // pluginLoadPolicy
+ };
+ WKPageRef wkPage = toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView)));
+ WKPageSetPageLoaderClient(wkPage, &wkLoaderClient.base);
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitMimeInfo.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitMimeInfo.cpp
index af61dc69a..2282ede37 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitMimeInfo.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitMimeInfo.cpp
@@ -21,7 +21,7 @@
#include "WebKitMimeInfo.h"
#include "WebKitMimeInfoPrivate.h"
-#include <wtf/glib/GRefPtr.h>
+#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/CString.h>
struct _WebKitMimeInfo {
@@ -42,7 +42,7 @@ G_DEFINE_BOXED_TYPE(WebKitMimeInfo, webkit_mime_info, webkit_mime_info_ref, webk
WebKitMimeInfo* webkitMimeInfoCreate(const WebCore::MimeClassInfo& mimeInfo)
{
- WebKitMimeInfo* info = static_cast<WebKitMimeInfo*>(fastMalloc(sizeof(WebKitMimeInfo)));
+ WebKitMimeInfo* info = g_slice_new(WebKitMimeInfo);
new (info) WebKitMimeInfo(mimeInfo);
return info;
}
@@ -75,7 +75,7 @@ void webkit_mime_info_unref(WebKitMimeInfo* info)
{
if (g_atomic_int_dec_and_test(&info->referenceCount)) {
info->~WebKitMimeInfo();
- fastFree(info);
+ g_slice_free(WebKitMimeInfo, info);
}
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationAction.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationAction.cpp
deleted file mode 100644
index bcce8ba42..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationAction.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (C) 2014 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "WebKitNavigationAction.h"
-
-#include "WebKitNavigationActionPrivate.h"
-#include <gdk/gdk.h>
-#include <wtf/glib/GRefPtr.h>
-
-using namespace WebKit;
-
-G_DEFINE_BOXED_TYPE(WebKitNavigationAction, webkit_navigation_action, webkit_navigation_action_copy, webkit_navigation_action_free)
-
-WebKitNavigationAction* webkitNavigationActionCreate(WebKitURIRequest* request, const NavigationActionData& navigationActionData)
-{
- WebKitNavigationAction* navigation = static_cast<WebKitNavigationAction*>(fastZeroedMalloc(sizeof(WebKitNavigationAction)));
- new (navigation) WebKitNavigationAction(request, navigationActionData);
- return navigation;
-}
-
-/**
- * webkit_navigation_action_copy:
- * @navigation: a #WebKitNavigationAction
- *
- * Make a copy of @navigation.
- *
- * Returns: (transfer full): A copy of passed in #WebKitNavigationAction
- *
- * Since: 2.6
- */
-WebKitNavigationAction* webkit_navigation_action_copy(WebKitNavigationAction* navigation)
-{
- g_return_val_if_fail(navigation, nullptr);
-
- WebKitNavigationAction* copy = static_cast<WebKitNavigationAction*>(fastZeroedMalloc(sizeof(WebKitNavigationAction)));
- new (copy) WebKitNavigationAction(navigation);
- return copy;
-}
-
-/**
- * webkit_navigation_action_free:
- * @navigation: a #WebKitNavigationAction
- *
- * Free the #WebKitNavigationAction
- *
- * Since: 2.6
- */
-void webkit_navigation_action_free(WebKitNavigationAction* navigation)
-{
- g_return_if_fail(navigation);
-
- navigation->~WebKitNavigationAction();
- fastFree(navigation);
-}
-
-/**
- * webkit_navigation_action_get_navigation_type:
- * @navigation: a #WebKitNavigationAction
- *
- * Return the type of action that triggered the navigation.
- *
- * Returns: a #WebKitNavigationType
- *
- * Since: 2.6
- */
-WebKitNavigationType webkit_navigation_action_get_navigation_type(WebKitNavigationAction* navigation)
-{
- g_return_val_if_fail(navigation, WEBKIT_NAVIGATION_TYPE_OTHER);
- return navigation->type;
-}
-
-/**
- * webkit_navigation_action_get_mouse_button:
- * @navigation: a #WebKitNavigationAction
- *
- * Return the number of the mouse button that triggered the navigation, or 0 if
- * the navigation was not started by a mouse event.
- *
- * Returns: the mouse button number or 0
- *
- * Since: 2.6
- */
-unsigned webkit_navigation_action_get_mouse_button(WebKitNavigationAction* navigation)
-{
- g_return_val_if_fail(navigation, 0);
- return navigation->mouseButton;
-}
-
-/**
- * webkit_navigation_action_get_modifiers:
- * @navigation: a #WebKitNavigationAction
- *
- * Return a bitmask of #GdkModifierType values describing the modifier keys that were in effect
- * when the navigation was requested
- *
- * Returns: the modifier keys
- *
- * Since: 2.6
- */
-unsigned webkit_navigation_action_get_modifiers(WebKitNavigationAction* navigation)
-{
- g_return_val_if_fail(navigation, 0);
- return navigation->modifiers;
-}
-
-/**
- * webkit_navigation_action_get_request:
- * @navigation: a #WebKitNavigationAction
- *
- * Return the navigation #WebKitURIRequest
- *
- * Returns: (transfer none): a #WebKitURIRequest
- *
- * Since: 2.6
- */
-WebKitURIRequest* webkit_navigation_action_get_request(WebKitNavigationAction* navigation)
-{
- g_return_val_if_fail(navigation, nullptr);
- return navigation->request.get();
-}
-
-/**
- * webkit_navigation_action_is_user_gesture:
- * @navigation: a #WebKitNavigationAction
- *
- * Return whether the navigation was triggered by a user gesture like a mouse click.
- *
- * Returns: whether navigation action is a user gesture
- *
- * Since: 2.6
- */
-gboolean webkit_navigation_action_is_user_gesture(WebKitNavigationAction* navigation)
-{
- g_return_val_if_fail(navigation, FALSE);
- return navigation->isUserGesture;
-}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationAction.h b/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationAction.h
deleted file mode 100644
index ae95586bc..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationAction.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2014 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
-#error "Only <webkit2/webkit2.h> can be included directly."
-#endif
-
-#ifndef WebKitNavigationAction_h
-#define WebKitNavigationAction_h
-
-#include <glib-object.h>
-#include <webkit2/WebKitDefines.h>
-#include <webkit2/WebKitURIRequest.h>
-
-G_BEGIN_DECLS
-
-#define WEBKIT_TYPE_NAVIGATION_ACTION (webkit_navigation_action_get_type())
-
-/**
- * WebKitNavigationType:
- * @WEBKIT_NAVIGATION_TYPE_LINK_CLICKED: The navigation was triggered by clicking a link.
- * @WEBKIT_NAVIGATION_TYPE_FORM_SUBMITTED: The navigation was triggered by submitting a form.
- * @WEBKIT_NAVIGATION_TYPE_BACK_FORWARD: The navigation was triggered by navigating forward or backward.
- * @WEBKIT_NAVIGATION_TYPE_RELOAD: The navigation was triggered by reloading.
- * @WEBKIT_NAVIGATION_TYPE_FORM_RESUBMITTED: The navigation was triggered by resubmitting a form.
- * @WEBKIT_NAVIGATION_TYPE_OTHER: The navigation was triggered by some other action.
- *
- * Enum values used to denote the various navigation types.
- */
-typedef enum {
- WEBKIT_NAVIGATION_TYPE_LINK_CLICKED,
- WEBKIT_NAVIGATION_TYPE_FORM_SUBMITTED,
- WEBKIT_NAVIGATION_TYPE_BACK_FORWARD,
- WEBKIT_NAVIGATION_TYPE_RELOAD,
- WEBKIT_NAVIGATION_TYPE_FORM_RESUBMITTED,
- WEBKIT_NAVIGATION_TYPE_OTHER
-} WebKitNavigationType;
-
-typedef struct _WebKitNavigationAction WebKitNavigationAction;
-
-
-WEBKIT_API GType
-webkit_navigation_action_get_type (void);
-
-WEBKIT_API WebKitNavigationAction *
-webkit_navigation_action_copy (WebKitNavigationAction *navigation);
-
-WEBKIT_API void
-webkit_navigation_action_free (WebKitNavigationAction *navigation);
-
-WEBKIT_API WebKitNavigationType
-webkit_navigation_action_get_navigation_type (WebKitNavigationAction *navigation);
-
-WEBKIT_API guint
-webkit_navigation_action_get_mouse_button (WebKitNavigationAction *navigation);
-
-WEBKIT_API guint
-webkit_navigation_action_get_modifiers (WebKitNavigationAction *navigation);
-
-WEBKIT_API WebKitURIRequest *
-webkit_navigation_action_get_request (WebKitNavigationAction *navigation);
-
-WEBKIT_API gboolean
-webkit_navigation_action_is_user_gesture (WebKitNavigationAction *navigation);
-
-G_END_DECLS
-
-#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationActionPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationActionPrivate.h
deleted file mode 100644
index 97fc8b36e..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationActionPrivate.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2014 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef WebKitNavigationActionPrivate_h
-#define WebKitNavigationActionPrivate_h
-
-#include "NavigationActionData.h"
-#include "WebKitNavigationAction.h"
-#include "WebKitPrivate.h"
-
-struct _WebKitNavigationAction {
- _WebKitNavigationAction(WebKitURIRequest* uriRequest, const WebKit::NavigationActionData& navigationActionData)
- : type(toWebKitNavigationType(navigationActionData.navigationType))
- , mouseButton(toWebKitMouseButton(navigationActionData.mouseButton))
- , modifiers(toGdkModifiers(navigationActionData.modifiers))
- , isUserGesture(navigationActionData.isProcessingUserGesture)
- , request(uriRequest)
- {
- }
-
- _WebKitNavigationAction(WebKitNavigationAction* navigation)
- : type(navigation->type)
- , mouseButton(navigation->mouseButton)
- , modifiers(navigation->modifiers)
- , isUserGesture(navigation->isUserGesture)
- , request(navigation->request)
- {
- }
-
- WebKitNavigationType type;
- unsigned mouseButton;
- unsigned modifiers;
- bool isUserGesture : 1;
- GRefPtr<WebKitURIRequest> request;
-};
-
-WebKitNavigationAction* webkitNavigationActionCreate(WebKitURIRequest*, const WebKit::NavigationActionData&);
-
-#endif // WebKitNavigationActionPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.cpp
index e5769723c..f03446bab 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.cpp
@@ -20,13 +20,13 @@
#include "config.h"
#include "WebKitNavigationPolicyDecision.h"
+#include "APIURLRequest.h"
+#include "WebEvent.h"
#include "WebKitEnumTypes.h"
-#include "WebKitNavigationActionPrivate.h"
-#include "WebKitNavigationPolicyDecisionPrivate.h"
#include "WebKitPolicyDecisionPrivate.h"
#include "WebKitURIRequestPrivate.h"
#include <glib/gi18n-lib.h>
-#include <wtf/glib/GRefPtr.h>
+#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/CString.h>
using namespace WebKit;
@@ -44,12 +44,10 @@ using namespace WebCore;
*/
struct _WebKitNavigationPolicyDecisionPrivate {
- ~_WebKitNavigationPolicyDecisionPrivate()
- {
- webkit_navigation_action_free(navigationAction);
- }
-
- WebKitNavigationAction* navigationAction;
+ WebKitNavigationType navigationType;
+ unsigned modifiers;
+ unsigned mouseButton;
+ GRefPtr<WebKitURIRequest> request;
CString frameName;
};
@@ -57,7 +55,6 @@ WEBKIT_DEFINE_TYPE(WebKitNavigationPolicyDecision, webkit_navigation_policy_deci
enum {
PROP_0,
- PROP_NAVIGATION_ACTION,
PROP_NAVIGATION_TYPE,
PROP_MOUSE_BUTTON,
PROP_MODIFIERS,
@@ -69,20 +66,17 @@ static void webkitNavigationPolicyDecisionGetProperty(GObject* object, guint pro
{
WebKitNavigationPolicyDecision* decision = WEBKIT_NAVIGATION_POLICY_DECISION(object);
switch (propId) {
- case PROP_NAVIGATION_ACTION:
- g_value_set_boxed(value, webkit_navigation_policy_decision_get_navigation_action(decision));
- break;
case PROP_NAVIGATION_TYPE:
- g_value_set_enum(value, webkit_navigation_action_get_navigation_type(decision->priv->navigationAction));
+ g_value_set_enum(value, webkit_navigation_policy_decision_get_navigation_type(decision));
break;
case PROP_MOUSE_BUTTON:
- g_value_set_enum(value, webkit_navigation_action_get_mouse_button(decision->priv->navigationAction));
+ g_value_set_enum(value, webkit_navigation_policy_decision_get_mouse_button(decision));
break;
case PROP_MODIFIERS:
- g_value_set_uint(value, webkit_navigation_action_get_modifiers(decision->priv->navigationAction));
+ g_value_set_uint(value, webkit_navigation_policy_decision_get_modifiers(decision));
break;
case PROP_REQUEST:
- g_value_set_object(value, webkit_navigation_action_get_request(decision->priv->navigationAction));
+ g_value_set_object(value, webkit_navigation_policy_decision_get_request(decision));
break;
case PROP_FRAME_NAME:
g_value_set_string(value, webkit_navigation_policy_decision_get_frame_name(decision));
@@ -99,30 +93,11 @@ static void webkit_navigation_policy_decision_class_init(WebKitNavigationPolicyD
objectClass->get_property = webkitNavigationPolicyDecisionGetProperty;
/**
- * WebKitNavigationPolicyDecision:navigation-action:
- *
- * The #WebKitNavigationAction that triggered this policy decision.
- *
- * Since: 2.6
- */
- g_object_class_install_property(
- objectClass,
- PROP_NAVIGATION_ACTION,
- g_param_spec_boxed(
- "navigation-action",
- _("Navigation action"),
- _("The WebKitNavigationAction triggering this decision"),
- WEBKIT_TYPE_NAVIGATION_ACTION,
- WEBKIT_PARAM_READABLE));
-
- /**
* WebKitNavigationPolicyDecision:navigation-type:
*
* The type of navigation that triggered this policy decision. This is
* useful for enacting different policies depending on what type of user
* action caused the navigation.
- *
- * Deprecated: 2.6: Use #WebKitNavigationPolicyDecision:navigation-action instead
*/
g_object_class_install_property(objectClass,
PROP_NAVIGATION_TYPE,
@@ -141,8 +116,6 @@ static void webkit_navigation_policy_decision_class_init(WebKitNavigationPolicyD
* of the button triggering that event. The button numbers match those from GDK.
* If the navigation was not triggered by a mouse event, the value of this
* property will be 0.
- *
- * Deprecated: 2.6: Use #WebKitNavigationPolicyDecision:navigation-action instead
*/
g_object_class_install_property(objectClass,
PROP_MOUSE_BUTTON,
@@ -160,8 +133,6 @@ static void webkit_navigation_policy_decision_class_init(WebKitNavigationPolicyD
* #GdkModifierType values describing the modifiers used for that click.
* If the navigation was not triggered by a mouse event or no modifiers
* were active, the value of this property will be zero.
- *
- * Deprecated: 2.6: Use #WebKitNavigationPolicyDecision:navigation-action instead
*/
g_object_class_install_property(objectClass,
PROP_MODIFIERS,
@@ -176,8 +147,6 @@ static void webkit_navigation_policy_decision_class_init(WebKitNavigationPolicyD
*
* This property contains the #WebKitURIRequest associated with this
* navigation.
- *
- * Deprecated: 2.6: Use #WebKitNavigationPolicyDecision:navigation-action instead
*/
g_object_class_install_property(objectClass,
PROP_REQUEST,
@@ -205,35 +174,17 @@ static void webkit_navigation_policy_decision_class_init(WebKitNavigationPolicyD
}
/**
- * webkit_navigation_policy_decision_get_navigation_action:
- * @decision: a #WebKitNavigationPolicyDecision
- *
- * Gets the value of the #WebKitNavigationPolicyDecision:navigation-action property.
- *
- * Returns: (transfer none): The #WebKitNavigationAction triggering this policy decision.
- *
- * Since: 2.6
- */
-WebKitNavigationAction* webkit_navigation_policy_decision_get_navigation_action(WebKitNavigationPolicyDecision* decision)
-{
- g_return_val_if_fail(WEBKIT_IS_NAVIGATION_POLICY_DECISION(decision), nullptr);
- return decision->priv->navigationAction;
-}
-
-/**
* webkit_navigation_policy_decision_get_navigation_type:
* @decision: a #WebKitNavigationPolicyDecision
*
* Gets the value of the #WebKitNavigationPolicyDecision:navigation-type property.
*
* Returns: The type of navigation triggering this policy decision.
- *
- * Deprecated: 2.6: Use webkit_navigation_policy_decision_get_navigation_action() instead.
*/
WebKitNavigationType webkit_navigation_policy_decision_get_navigation_type(WebKitNavigationPolicyDecision* decision)
{
g_return_val_if_fail(WEBKIT_IS_NAVIGATION_POLICY_DECISION(decision), WEBKIT_NAVIGATION_TYPE_OTHER);
- return webkit_navigation_action_get_navigation_type(decision->priv->navigationAction);
+ return decision->priv->navigationType;
}
/**
@@ -243,13 +194,11 @@ WebKitNavigationType webkit_navigation_policy_decision_get_navigation_type(WebKi
* Gets the value of the #WebKitNavigationPolicyDecision:mouse-button property.
*
* Returns: The mouse button used if this decision was triggered by a mouse event or 0 otherwise
- *
- * Deprecated: 2.6: Use webkit_navigation_policy_decision_get_navigation_action() instead.
*/
guint webkit_navigation_policy_decision_get_mouse_button(WebKitNavigationPolicyDecision* decision)
{
g_return_val_if_fail(WEBKIT_IS_NAVIGATION_POLICY_DECISION(decision), 0);
- return webkit_navigation_action_get_mouse_button(decision->priv->navigationAction);
+ return decision->priv->mouseButton;
}
/**
@@ -259,13 +208,11 @@ guint webkit_navigation_policy_decision_get_mouse_button(WebKitNavigationPolicyD
* Gets the value of the #WebKitNavigationPolicyDecision:modifiers property.
*
* Returns: The modifiers active if this decision was triggered by a mouse event
- *
- * Deprecated: 2.6: Use webkit_navigation_policy_decision_get_navigation_action() instead.
*/
unsigned webkit_navigation_policy_decision_get_modifiers(WebKitNavigationPolicyDecision* decision)
{
g_return_val_if_fail(WEBKIT_IS_NAVIGATION_POLICY_DECISION(decision), 0);
- return webkit_navigation_action_get_modifiers(decision->priv->navigationAction);
+ return decision->priv->modifiers;
}
/**
@@ -275,13 +222,11 @@ unsigned webkit_navigation_policy_decision_get_modifiers(WebKitNavigationPolicyD
* Gets the value of the #WebKitNavigationPolicyDecision:request property.
*
* Returns: (transfer none): The URI request that is associated with this navigation
- *
- * Deprecated: 2.6: Use webkit_navigation_policy_decision_get_navigation_action() instead.
*/
WebKitURIRequest* webkit_navigation_policy_decision_get_request(WebKitNavigationPolicyDecision* decision)
{
- g_return_val_if_fail(WEBKIT_IS_NAVIGATION_POLICY_DECISION(decision), nullptr);
- return webkit_navigation_action_get_request(decision->priv->navigationAction);
+ g_return_val_if_fail(WEBKIT_IS_NAVIGATION_POLICY_DECISION(decision), 0);
+ return decision->priv->request.get();
}
/**
@@ -298,19 +243,21 @@ const char* webkit_navigation_policy_decision_get_frame_name(WebKitNavigationPol
return decision->priv->frameName.data();
}
-WebKitPolicyDecision* webkitNavigationPolicyDecisionCreate(const NavigationActionData& navigationActionData, const ResourceRequest& request, WebFramePolicyListenerProxy* listener)
-{
- WebKitNavigationPolicyDecision* navigationDecision = WEBKIT_NAVIGATION_POLICY_DECISION(g_object_new(WEBKIT_TYPE_NAVIGATION_POLICY_DECISION, nullptr));
- GRefPtr<WebKitURIRequest> uriRequest = adoptGRef(webkitURIRequestCreateForResourceRequest(request));
- navigationDecision->priv->navigationAction = webkitNavigationActionCreate(uriRequest.get(), navigationActionData);
- WebKitPolicyDecision* decision = WEBKIT_POLICY_DECISION(navigationDecision);
- webkitPolicyDecisionSetListener(decision, listener);
- return decision;
-}
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NAVIGATION_TYPE_LINK_CLICKED, NavigationTypeLinkClicked);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NAVIGATION_TYPE_FORM_SUBMITTED, NavigationTypeFormSubmitted);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NAVIGATION_TYPE_BACK_FORWARD, NavigationTypeBackForward);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NAVIGATION_TYPE_RELOAD, NavigationTypeReload);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NAVIGATION_TYPE_FORM_RESUBMITTED, NavigationTypeFormResubmitted);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NAVIGATION_TYPE_OTHER, NavigationTypeOther);
-WebKitPolicyDecision* webkitNewWindowPolicyDecisionCreate(const NavigationActionData& navigationActionData, const ResourceRequest& request, const String& frameName, WebFramePolicyListenerProxy* listener)
+WebKitNavigationPolicyDecision* webkitNavigationPolicyDecisionCreate(WebKitNavigationType navigationType, unsigned mouseButton, unsigned modifiers, API::URLRequest* request, const char* frameName, WebFramePolicyListenerProxy* listener)
{
- WebKitPolicyDecision* decision = webkitNavigationPolicyDecisionCreate(navigationActionData, request, listener);
- WEBKIT_NAVIGATION_POLICY_DECISION(decision)->priv->frameName = frameName.utf8().data();
+ WebKitNavigationPolicyDecision* decision = WEBKIT_NAVIGATION_POLICY_DECISION(g_object_new(WEBKIT_TYPE_NAVIGATION_POLICY_DECISION, NULL));
+ decision->priv->navigationType = navigationType;
+ decision->priv->mouseButton = mouseButton;
+ decision->priv->modifiers = modifiers;
+ decision->priv->request = adoptGRef(webkitURIRequestCreateForResourceRequest(request->resourceRequest()));
+ decision->priv->frameName = frameName;
+ webkitPolicyDecisionSetListener(WEBKIT_POLICY_DECISION(decision), listener);
return decision;
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h b/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h
index 0d9fb261a..751397731 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h
@@ -26,12 +26,31 @@
#include <glib-object.h>
#include <webkit2/WebKitDefines.h>
-#include <webkit2/WebKitNavigationAction.h>
#include <webkit2/WebKitPolicyDecision.h>
#include <webkit2/WebKitURIRequest.h>
G_BEGIN_DECLS
+/**
+ * WebKitNavigationType:
+ * @WEBKIT_NAVIGATION_TYPE_LINK_CLICKED: The navigation was triggered by clicking a link.
+ * @WEBKIT_NAVIGATION_TYPE_FORM_SUBMITTED: The navigation was triggered by submitting a form.
+ * @WEBKIT_NAVIGATION_TYPE_BACK_FORWARD: The navigation was triggered by navigating forward or backward.
+ * @WEBKIT_NAVIGATION_TYPE_RELOAD: The navigation was triggered by reloading.
+ * @WEBKIT_NAVIGATION_TYPE_FORM_RESUBMITTED: The navigation was triggered by resubmitting a form.
+ * @WEBKIT_NAVIGATION_TYPE_OTHER: The navigation was triggered by some other action.
+ *
+ * Enum values used to denote the various navigation types.
+ */
+typedef enum {
+ WEBKIT_NAVIGATION_TYPE_LINK_CLICKED,
+ WEBKIT_NAVIGATION_TYPE_FORM_SUBMITTED,
+ WEBKIT_NAVIGATION_TYPE_BACK_FORWARD,
+ WEBKIT_NAVIGATION_TYPE_RELOAD,
+ WEBKIT_NAVIGATION_TYPE_FORM_RESUBMITTED,
+ WEBKIT_NAVIGATION_TYPE_OTHER,
+} WebKitNavigationType;
+
#define WEBKIT_TYPE_NAVIGATION_POLICY_DECISION (webkit_navigation_policy_decision_get_type())
#define WEBKIT_NAVIGATION_POLICY_DECISION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_NAVIGATION_POLICY_DECISION, WebKitNavigationPolicyDecision))
#define WEBKIT_NAVIGATION_POLICY_DECISION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_NAVIGATION_POLICY_DECISION, WebKitNavigationPolicyDecisionClass))
@@ -62,24 +81,16 @@ struct _WebKitNavigationPolicyDecisionClass {
WEBKIT_API GType
webkit_navigation_policy_decision_get_type (void);
-WEBKIT_API WebKitNavigationAction *
-webkit_navigation_policy_decision_get_navigation_action (WebKitNavigationPolicyDecision *decision);
-
-WEBKIT_DEPRECATED_FOR(webkit_navigation_policy_decision_get_navigation_action) WebKitNavigationType
-webkit_navigation_policy_decision_get_navigation_type (WebKitNavigationPolicyDecision *decision);
-
-WEBKIT_DEPRECATED_FOR(webkit_navigation_policy_decision_get_navigation_action) guint
-webkit_navigation_policy_decision_get_mouse_button (WebKitNavigationPolicyDecision *decision);
-
-WEBKIT_DEPRECATED_FOR(webkit_navigation_policy_decision_get_navigation_action) guint
-webkit_navigation_policy_decision_get_modifiers (WebKitNavigationPolicyDecision *decision);
-
-WEBKIT_DEPRECATED_FOR(webkit_navigation_policy_decision_get_navigation_action) WebKitURIRequest *
-webkit_navigation_policy_decision_get_request (WebKitNavigationPolicyDecision *decision);
-
+WEBKIT_API WebKitNavigationType
+webkit_navigation_policy_decision_get_navigation_type (WebKitNavigationPolicyDecision *decision);
+WEBKIT_API guint
+webkit_navigation_policy_decision_get_mouse_button (WebKitNavigationPolicyDecision *decision);
+WEBKIT_API guint
+webkit_navigation_policy_decision_get_modifiers (WebKitNavigationPolicyDecision *decision);
+WEBKIT_API WebKitURIRequest *
+webkit_navigation_policy_decision_get_request (WebKitNavigationPolicyDecision *decision);
WEBKIT_API const gchar *
-webkit_navigation_policy_decision_get_frame_name (WebKitNavigationPolicyDecision *decision);
-
+webkit_navigation_policy_decision_get_frame_name (WebKitNavigationPolicyDecision *decision);
G_END_DECLS
#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecisionPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecisionPrivate.h
index 9d94ee00e..84ee827cd 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecisionPrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecisionPrivate.h
@@ -20,11 +20,9 @@
#ifndef WebKitNavigationPolicyDecisionPrivate_h
#define WebKitNavigationPolicyDecisionPrivate_h
-#include "NavigationActionData.h"
#include "WebKitNavigationPolicyDecision.h"
#include "WebKitPrivate.h"
-WebKitPolicyDecision* webkitNavigationPolicyDecisionCreate(const WebKit::NavigationActionData&, const WebCore::ResourceRequest&, WebKit::WebFramePolicyListenerProxy*);
-WebKitPolicyDecision* webkitNewWindowPolicyDecisionCreate(const WebKit::NavigationActionData&, const WebCore::ResourceRequest&, const String& frameName, WebKit::WebFramePolicyListenerProxy*);
+WebKitNavigationPolicyDecision* webkitNavigationPolicyDecisionCreate(WebKitNavigationType, unsigned mouseButton, unsigned modifiers, API::URLRequest*, const char* frameName, WebKit::WebFramePolicyListenerProxy*);
#endif // WebKitNavigationPolicyDecisionPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.cpp
deleted file mode 100644
index af776e5d4..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Copyright (C) 2014 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "WebKitNotification.h"
-
-#include "WebKitNotificationPrivate.h"
-#include "WebKitPrivate.h"
-#include "WebNotification.h"
-#include <glib/gi18n-lib.h>
-#include <wtf/text/CString.h>
-
-/**
- * SECTION: WebKitNotification
- * @Short_description: Object used to hold information about a notification that should be shown to the user.
- * @Title: WebKitNotification
- *
- * Since: 2.8
- */
-
-enum {
- PROP_0,
-
- PROP_ID,
- PROP_TITLE,
- PROP_BODY
-};
-
-enum {
- CLOSED,
-
- LAST_SIGNAL
-};
-
-struct _WebKitNotificationPrivate {
- CString title;
- CString body;
- guint64 id;
-
- WebKitWebView* webView;
-};
-
-static guint signals[LAST_SIGNAL] = { 0, };
-
-WEBKIT_DEFINE_TYPE(WebKitNotification, webkit_notification, G_TYPE_OBJECT)
-
-static void webkitNotificationGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec)
-{
- WebKitNotification* notification = WEBKIT_NOTIFICATION(object);
-
- switch (propId) {
- case PROP_ID:
- g_value_set_uint64(value, webkit_notification_get_id(notification));
- break;
- case PROP_TITLE:
- g_value_set_string(value, webkit_notification_get_title(notification));
- break;
- case PROP_BODY:
- g_value_set_string(value, webkit_notification_get_body(notification));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
- }
-}
-
-static void webkit_notification_class_init(WebKitNotificationClass* notificationClass)
-{
- GObjectClass* objectClass = G_OBJECT_CLASS(notificationClass);
- objectClass->get_property = webkitNotificationGetProperty;
-
- /**
- * WebKitNotification:id:
- *
- * The unique id for the notification.
- *
- * Since: 2.8
- */
- g_object_class_install_property(objectClass,
- PROP_ID,
- g_param_spec_uint64("id",
- _("ID"),
- _("The unique id for the notification"),
- 0, G_MAXUINT64, 0,
- WEBKIT_PARAM_READABLE));
-
- /**
- * WebKitNotification:title:
- *
- * The title for the notification.
- *
- * Since: 2.8
- */
- g_object_class_install_property(objectClass,
- PROP_TITLE,
- g_param_spec_string("title",
- _("Title"),
- _("The title for the notification"),
- nullptr,
- WEBKIT_PARAM_READABLE));
-
- /**
- * WebKitNotification:body:
- *
- * The body for the notification.
- *
- * Since: 2.8
- */
- g_object_class_install_property(objectClass,
- PROP_BODY,
- g_param_spec_string("body",
- _("Body"),
- _("The body for the notification"),
- nullptr,
- WEBKIT_PARAM_READABLE));
-
- /**
- * WebKitNotification::closed:
- * @notification: the #WebKitNotification on which the signal is emitted
- *
- * Emitted when a notification has been withdrawn.
- *
- * The default handler will close the notification using libnotify, if built with
- * support for it.
- *
- * Since: 2.8
- */
- signals[CLOSED] =
- g_signal_new(
- "closed",
- G_TYPE_FROM_CLASS(notificationClass),
- G_SIGNAL_RUN_LAST,
- 0, 0,
- nullptr,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
-
-WebKitNotification* webkitNotificationCreate(WebKitWebView* webView, const WebKit::WebNotification& webNotification)
-{
- WebKitNotification* notification = WEBKIT_NOTIFICATION(g_object_new(WEBKIT_TYPE_NOTIFICATION, nullptr));
- notification->priv->id = webNotification.notificationID();
- notification->priv->title = webNotification.title().utf8();
- notification->priv->body = webNotification.body().utf8();
- notification->priv->webView = webView;
- return notification;
-}
-
-WebKitWebView* webkitNotificationGetWebView(WebKitNotification* notification)
-{
- return notification->priv->webView;
-}
-
-/**
- * webkit_notification_get_id:
- * @notification: a #WebKitNotification
- *
- * Obtains the unique id for the notification.
- *
- * Returns: the unique id for the notification
- *
- * Since: 2.8
- */
-guint64 webkit_notification_get_id(WebKitNotification* notification)
-{
- g_return_val_if_fail(WEBKIT_IS_NOTIFICATION(notification), 0);
-
- return notification->priv->id;
-}
-
-/**
- * webkit_notification_get_title:
- * @notification: a #WebKitNotification
- *
- * Obtains the title for the notification.
- *
- * Returns: the title for the notification
- *
- * Since: 2.8
- */
-const gchar* webkit_notification_get_title(WebKitNotification* notification)
-{
- g_return_val_if_fail(WEBKIT_IS_NOTIFICATION(notification), nullptr);
-
- return notification->priv->title.data();
-}
-
-/**
- * webkit_notification_get_body:
- * @notification: a #WebKitNotification
- *
- * Obtains the body for the notification.
- *
- * Returns: the body for the notification
- *
- * Since: 2.8
- */
-const gchar* webkit_notification_get_body(WebKitNotification* notification)
-{
- g_return_val_if_fail(WEBKIT_IS_NOTIFICATION(notification), nullptr);
-
- return notification->priv->body.data();
-}
-
-/**
- * webkit_notification_close:
- * @notification: a #WebKitNotification
- *
- * Closes the notification.
- *
- * Since: 2.8
- */
-void webkit_notification_close(WebKitNotification* notification)
-{
- g_return_if_fail(WEBKIT_IS_NOTIFICATION(notification));
-
- g_signal_emit(notification, signals[CLOSED], 0);
-}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.h b/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.h
deleted file mode 100644
index aa56fd13b..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2014 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
-#error "Only <webkit2/webkit2.h> can be included directly."
-#endif
-
-#ifndef WebKitNotification_h
-#define WebKitNotification_h
-
-#include <glib-object.h>
-#include <webkit2/WebKitDefines.h>
-#include <webkit2/WebKitForwardDeclarations.h>
-
-G_BEGIN_DECLS
-
-#define WEBKIT_TYPE_NOTIFICATION (webkit_notification_get_type())
-#define WEBKIT_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_NOTIFICATION, WebKitNotification))
-#define WEBKIT_IS_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_NOTIFICATION))
-#define WEBKIT_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_NOTIFICATION, WebKitNotificationClass))
-#define WEBKIT_IS_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_NOTIFICATION))
-#define WEBKIT_NOTIFICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_NOTIFICATION, WebKitNotificationClass))
-
-typedef struct _WebKitNotification WebKitNotification;
-typedef struct _WebKitNotificationClass WebKitNotificationClass;
-typedef struct _WebKitNotificationPrivate WebKitNotificationPrivate;
-
-struct _WebKitNotification {
- GObject parent;
-
- WebKitNotificationPrivate *priv;
-};
-
-struct _WebKitNotificationClass {
- GObjectClass parent_class;
-
- void (*_webkit_reserved0) (void);
- void (*_webkit_reserved1) (void);
- void (*_webkit_reserved2) (void);
- void (*_webkit_reserved3) (void);
- void (*_webkit_reserved4) (void);
- void (*_webkit_reserved5) (void);
-};
-
-WEBKIT_API GType
-webkit_notification_get_type (void);
-
-WEBKIT_API guint64
-webkit_notification_get_id (WebKitNotification *notification);
-
-WEBKIT_API const gchar *
-webkit_notification_get_title (WebKitNotification *notification);
-
-WEBKIT_API const gchar *
-webkit_notification_get_body (WebKitNotification *notification);
-
-WEBKIT_API void
-webkit_notification_close (WebKitNotification* notification);
-
-G_END_DECLS
-
-#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequest.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequest.cpp
deleted file mode 100644
index 2df447455..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequest.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2013 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "WebKitNotificationPermissionRequest.h"
-
-#include "NotificationPermissionRequest.h"
-#include "WebKitNotificationPermissionRequestPrivate.h"
-#include "WebKitPermissionRequest.h"
-
-using namespace WebKit;
-
-/**
- * SECTION: WebKitNotificationPermissionRequest
- * @Short_description: A permission request for displaying web notifications
- * @Title: WebKitNotificationPermissionRequest
- * @See_also: #WebKitPermissionRequest, #WebKitWebView
- *
- * WebKitNotificationPermissionRequest represents a request for
- * permission to decide whether WebKit should provide the user with
- * notifications through the Web Notification API.
- *
- * When a WebKitNotificationPermissionRequest is not handled by the user,
- * it is denied by default.
- *
- * Since: 2.8
- */
-
-static void webkit_permission_request_interface_init(WebKitPermissionRequestIface*);
-
-struct _WebKitNotificationPermissionRequestPrivate {
- RefPtr<NotificationPermissionRequest> request;
- bool madeDecision;
-};
-
-WEBKIT_DEFINE_TYPE_WITH_CODE(
- WebKitNotificationPermissionRequest, webkit_notification_permission_request, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE(WEBKIT_TYPE_PERMISSION_REQUEST, webkit_permission_request_interface_init))
-
-static void webkitNotificationPermissionRequestAllow(WebKitPermissionRequest* request)
-{
- ASSERT(WEBKIT_IS_NOTIFICATION_PERMISSION_REQUEST(request));
-
- WebKitNotificationPermissionRequestPrivate* priv = WEBKIT_NOTIFICATION_PERMISSION_REQUEST(request)->priv;
-
- // Only one decision at a time.
- if (priv->madeDecision)
- return;
-
- priv->request->allow();
- priv->madeDecision = true;
-}
-
-static void webkitNotificationPermissionRequestDeny(WebKitPermissionRequest* request)
-{
- ASSERT(WEBKIT_IS_NOTIFICATION_PERMISSION_REQUEST(request));
-
- WebKitNotificationPermissionRequestPrivate* priv = WEBKIT_NOTIFICATION_PERMISSION_REQUEST(request)->priv;
-
- // Only one decision at a time.
- if (priv->madeDecision)
- return;
-
- priv->request->deny();
- priv->madeDecision = true;
-}
-
-static void webkit_permission_request_interface_init(WebKitPermissionRequestIface* iface)
-{
- iface->allow = webkitNotificationPermissionRequestAllow;
- iface->deny = webkitNotificationPermissionRequestDeny;
-}
-
-static void webkitNotificationPermissionRequestDispose(GObject* object)
-{
- // Default behaviour when no decision has been made is denying the request.
- webkitNotificationPermissionRequestDeny(WEBKIT_PERMISSION_REQUEST(object));
- G_OBJECT_CLASS(webkit_notification_permission_request_parent_class)->dispose(object);
-}
-
-static void webkit_notification_permission_request_class_init(WebKitNotificationPermissionRequestClass* klass)
-{
- GObjectClass* objectClass = G_OBJECT_CLASS(klass);
- objectClass->dispose = webkitNotificationPermissionRequestDispose;
-}
-
-WebKitNotificationPermissionRequest* webkitNotificationPermissionRequestCreate(NotificationPermissionRequest* request)
-{
- WebKitNotificationPermissionRequest* notificationPermissionRequest = WEBKIT_NOTIFICATION_PERMISSION_REQUEST(g_object_new(WEBKIT_TYPE_NOTIFICATION_PERMISSION_REQUEST, nullptr));
- notificationPermissionRequest->priv->request = request;
- return notificationPermissionRequest;
-}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequest.h b/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequest.h
deleted file mode 100644
index d2fb41104..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequest.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2013 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
-#error "Only <webkit2/webkit2.h> can be included directly."
-#endif
-
-#ifndef WebKitNotificationPermissionRequest_h
-#define WebKitNotificationPermissionRequest_h
-
-#include <glib-object.h>
-#include <webkit2/WebKitDefines.h>
-
-G_BEGIN_DECLS
-
-#define WEBKIT_TYPE_NOTIFICATION_PERMISSION_REQUEST (webkit_notification_permission_request_get_type())
-#define WEBKIT_NOTIFICATION_PERMISSION_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_NOTIFICATION_PERMISSION_REQUEST, WebKitNotificationPermissionRequest))
-#define WEBKIT_NOTIFICATION_PERMISSION_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_NOTIFICATION_PERMISSION_REQUEST, WebKitNotificationPermissionRequestClass))
-#define WEBKIT_IS_NOTIFICATION_PERMISSION_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_NOTIFICATION_PERMISSION_REQUEST))
-#define WEBKIT_IS_NOTIFICATION_PERMISSION_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_NOTIFICATION_PERMISSION_REQUEST))
-#define WEBKIT_NOTIFICATION_PERMISSION_REQUEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_NOTIFICATION_PERMISSION_REQUEST, WebKitNotificationPermissionRequestClass))
-
-typedef struct _WebKitNotificationPermissionRequest WebKitNotificationPermissionRequest;
-typedef struct _WebKitNotificationPermissionRequestClass WebKitNotificationPermissionRequestClass;
-typedef struct _WebKitNotificationPermissionRequestPrivate WebKitNotificationPermissionRequestPrivate;
-
-struct _WebKitNotificationPermissionRequest {
- GObject parent;
-
- /*< private >*/
- WebKitNotificationPermissionRequestPrivate *priv;
-};
-
-struct _WebKitNotificationPermissionRequestClass {
- GObjectClass parent_class;
-};
-
-WEBKIT_API GType
-webkit_notification_permission_request_get_type (void);
-
-G_END_DECLS
-
-#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPrivate.h
deleted file mode 100644
index 49e9a6087..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPrivate.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2014 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef WebKitNotificationPrivate_h
-#define WebKitNotificationPrivate_h
-
-#include "WebKitNotification.h"
-#include "WebKitPrivate.h"
-#include "WebNotification.h"
-#include <wtf/text/CString.h>
-
-WebKitNotification* webkitNotificationCreate(WebKitWebView*, const WebKit::WebNotification&);
-WebKitWebView* webkitNotificationGetWebView(WebKitNotification*);
-
-#endif // WebKitNotificationPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.cpp
deleted file mode 100644
index 01dc297e1..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2013 Igalia S.L.
- * Copyright (C) 2014 Collabora Ltd.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "WebKitNotificationProvider.h"
-
-#include "APIArray.h"
-#include "WKNotificationManager.h"
-#include "WebKitNotificationPrivate.h"
-#include "WebKitWebViewPrivate.h"
-#include "WebNotificationManagerProxy.h"
-#include "WebPageProxy.h"
-#include <wtf/text/CString.h>
-
-using namespace WebKit;
-
-static inline WebKitNotificationProvider* toNotificationProvider(const void* clientInfo)
-{
- return static_cast<WebKitNotificationProvider*>(const_cast<void*>(clientInfo));
-}
-
-static void showCallback(WKPageRef page, WKNotificationRef notification, const void* clientInfo)
-{
- toNotificationProvider(clientInfo)->show(toImpl(page), *toImpl(notification));
-}
-
-static void cancelCallback(WKNotificationRef notification, const void* clientInfo)
-{
- toNotificationProvider(clientInfo)->cancel(*toImpl(notification));
-}
-
-static void clearNotificationsCallback(WKArrayRef notificationIDs, const void* clientInfo)
-{
- toNotificationProvider(clientInfo)->clearNotifications(toImpl(notificationIDs));
-}
-
-WebKitNotificationProvider::~WebKitNotificationProvider()
-{
-}
-
-Ref<WebKitNotificationProvider> WebKitNotificationProvider::create(WebNotificationManagerProxy* notificationManager)
-{
- return adoptRef(*new WebKitNotificationProvider(notificationManager));
-}
-
-WebKitNotificationProvider::WebKitNotificationProvider(WebNotificationManagerProxy* notificationManager)
- : m_notificationManager(notificationManager)
-{
- ASSERT(notificationManager);
-
- WKNotificationProviderV0 wkNotificationProvider = {
- {
- 0, // version
- this, // clientInfo
- },
- showCallback,
- cancelCallback,
- 0, // didDestroyNotificationCallback,
- 0, // addNotificationManagerCallback,
- 0, // removeNotificationManagerCallback,
- 0, // notificationPermissionsCallback,
- clearNotificationsCallback,
- };
-
- WKNotificationManagerSetProvider(toAPI(notificationManager), reinterpret_cast<WKNotificationProviderBase*>(&wkNotificationProvider));
-}
-
-void WebKitNotificationProvider::notificationCloseCallback(WebKitNotification* notification, WebKitNotificationProvider* provider)
-{
- uint64_t notificationID = webkit_notification_get_id(notification);
- Vector<RefPtr<API::Object>> arrayIDs;
- arrayIDs.append(API::UInt64::create(notificationID));
- provider->m_notificationManager->providerDidCloseNotifications(API::Array::create(WTF::move(arrayIDs)).ptr());
- provider->m_notifications.remove(notificationID);
-}
-
-void WebKitNotificationProvider::show(WebPageProxy* page, const WebNotification& webNotification)
-{
- GRefPtr<WebKitNotification> notification = m_notifications.get(webNotification.notificationID());
-
- if (!notification) {
- notification = adoptGRef(webkitNotificationCreate(WEBKIT_WEB_VIEW(page->viewWidget()), webNotification));
- g_signal_connect(notification.get(), "closed", G_CALLBACK(notificationCloseCallback), this);
- m_notifications.set(webNotification.notificationID(), notification);
- }
-
- if (webkitWebViewEmitShowNotification(WEBKIT_WEB_VIEW(page->viewWidget()), notification.get()))
- m_notificationManager->providerDidShowNotification(webNotification.notificationID());
-}
-
-void WebKitNotificationProvider::cancelNotificationByID(uint64_t notificationID)
-{
- if (GRefPtr<WebKitNotification> notification = m_notifications.get(notificationID))
- webkit_notification_close(notification.get());
-}
-
-void WebKitNotificationProvider::cancel(const WebNotification& webNotification)
-{
- cancelNotificationByID(webNotification.notificationID());
-}
-
-void WebKitNotificationProvider::clearNotifications(const API::Array* notificationIDs)
-{
- for (const auto& item : notificationIDs->elementsOfType<API::UInt64>())
- cancelNotificationByID(item->value());
-}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.h b/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.h
deleted file mode 100644
index ac874b833..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2013 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef WebKitNotificationProvider_h
-#define WebKitNotificationProvider_h
-
-#include "WebKitPrivate.h"
-#include "WebKitNotification.h"
-#include <wtf/HashMap.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-
-namespace API {
-class Array;
-}
-
-namespace WebKit {
-
-class WebKitNotificationProvider : public RefCounted<WebKitNotificationProvider> {
-public:
- virtual ~WebKitNotificationProvider();
- static Ref<WebKitNotificationProvider> create(WebNotificationManagerProxy*);
-
- void show(WebPageProxy*, const WebNotification&);
- void cancel(const WebNotification&);
- void clearNotifications(const API::Array*);
-
-private:
- WebKitNotificationProvider(WebNotificationManagerProxy*);
-
- void cancelNotificationByID(uint64_t);
- static void notificationCloseCallback(WebKitNotification*, WebKitNotificationProvider*);
-
- RefPtr<WebNotificationManagerProxy> m_notificationManager;
- HashMap<uint64_t, GRefPtr<WebKitNotification>> m_notifications;
-};
-
-} // namespace WebKit
-
-#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPlugin.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitPlugin.cpp
index b6dec1d3a..2bcb89c50 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitPlugin.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPlugin.cpp
@@ -55,7 +55,7 @@ struct _WebKitPluginPrivate {
WEBKIT_DEFINE_TYPE(WebKitPlugin, webkit_plugin, G_TYPE_OBJECT)
-static void webkit_plugin_class_init(WebKitPluginClass*)
+static void webkit_plugin_class_init(WebKitPluginClass* pluginClass)
{
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.cpp
index 2d4eac5b3..1eb6b1ec6 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.cpp
@@ -20,47 +20,65 @@
#include "config.h"
#include "WebKitPolicyClient.h"
-#include "APIPolicyClient.h"
#include "WebKitNavigationPolicyDecisionPrivate.h"
#include "WebKitResponsePolicyDecisionPrivate.h"
#include "WebKitWebViewBasePrivate.h"
#include "WebKitWebViewPrivate.h"
-#include <wtf/glib/GRefPtr.h>
+#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/CString.h>
using namespace WebKit;
-class PolicyClient: public API::PolicyClient {
-public:
- explicit PolicyClient(WebKitWebView* webView)
- : m_webView(webView)
- {
- }
-
-private:
- virtual void decidePolicyForNavigationAction(WebPageProxy&, WebFrameProxy*, const NavigationActionData& navigationActionData, WebFrameProxy* /*originatingFrame*/, const WebCore::ResourceRequest& /*originalRequest*/, const WebCore::ResourceRequest& request, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* /*userData*/) override
- {
- GRefPtr<WebKitPolicyDecision> decision = adoptGRef(webkitNavigationPolicyDecisionCreate(navigationActionData, request, listener.ptr()));
- webkitWebViewMakePolicyDecision(m_webView, WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION, decision.get());
- }
-
- virtual void decidePolicyForNewWindowAction(WebPageProxy&, WebFrameProxy&, const NavigationActionData& navigationActionData, const WebCore::ResourceRequest& request, const String& frameName, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* /*userData*/) override
- {
- GRefPtr<WebKitPolicyDecision> decision = adoptGRef(webkitNewWindowPolicyDecisionCreate(navigationActionData, request, frameName, listener.ptr()));
- webkitWebViewMakePolicyDecision(m_webView, WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION, decision.get());
- }
+static void decidePolicyForNavigationAction(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKFrameRef originatingFrame, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
+{
+ GRefPtr<WebKitNavigationPolicyDecision> decision =
+ adoptGRef(webkitNavigationPolicyDecisionCreate(static_cast<WebKitNavigationType>(navigationType),
+ wkEventMouseButtonToWebKitMouseButton(mouseButton),
+ wkEventModifiersToGdkModifiers(modifiers),
+ toImpl(request),
+ 0, /* frame name */
+ toImpl(listener)));
+ webkitWebViewMakePolicyDecision(WEBKIT_WEB_VIEW(clientInfo),
+ WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION,
+ WEBKIT_POLICY_DECISION(decision.get()));
+}
- virtual void decidePolicyForResponse(WebPageProxy&, WebFrameProxy&, const WebCore::ResourceResponse& response, const WebCore::ResourceRequest& request, bool canShowMIMEType, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* /*userData*/) override
- {
- GRefPtr<WebKitPolicyDecision> decision = adoptGRef(webkitResponsePolicyDecisionCreate(request, response, canShowMIMEType, listener.ptr()));
- webkitWebViewMakePolicyDecision(m_webView, WEBKIT_POLICY_DECISION_TYPE_RESPONSE, decision.get());
- }
+static void decidePolicyForNewWindowAction(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKStringRef frameName, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
+{
+ GRefPtr<WebKitNavigationPolicyDecision> decision =
+ adoptGRef(webkitNavigationPolicyDecisionCreate(static_cast<WebKitNavigationType>(navigationType),
+ wkEventMouseButtonToWebKitMouseButton(mouseButton),
+ wkEventModifiersToGdkModifiers(modifiers),
+ toImpl(request),
+ toImpl(frameName)->string().utf8().data(),
+ toImpl(listener)));
+ webkitWebViewMakePolicyDecision(WEBKIT_WEB_VIEW(clientInfo),
+ WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION,
+ WEBKIT_POLICY_DECISION(decision.get()));
+}
- WebKitWebView* m_webView;
-};
+static void decidePolicyForResponse(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, bool canShowMIMEType, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
+{
+ GRefPtr<WebKitResponsePolicyDecision> decision =
+ adoptGRef(webkitResponsePolicyDecisionCreate(toImpl(request), toImpl(response), canShowMIMEType, toImpl(listener)));
+ webkitWebViewMakePolicyDecision(WEBKIT_WEB_VIEW(clientInfo),
+ WEBKIT_POLICY_DECISION_TYPE_RESPONSE,
+ WEBKIT_POLICY_DECISION(decision.get()));
+}
void attachPolicyClientToView(WebKitWebView* webView)
{
- WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView));
- page->setPolicyClient(std::make_unique<PolicyClient>(webView));
+ WKPagePolicyClientV1 policyClient = {
+ {
+ 1, // version
+ webView, // clientInfo
+ },
+ 0, // decidePolicyForNavigationAction_deprecatedForUseWithV0
+ decidePolicyForNewWindowAction,
+ 0, // decidePolicyForResponse_deprecatedForUseWithV0
+ 0, // unableToImplementPolicy
+ decidePolicyForNavigationAction,
+ decidePolicyForResponse
+ };
+ WKPageSetPagePolicyClient(toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView))), &policyClient.base);
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPrintOperation.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitPrintOperation.cpp
index a6e524b43..75b435baf 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitPrintOperation.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPrintOperation.cpp
@@ -27,11 +27,11 @@
#include <WebCore/GtkUtilities.h>
#include <WebCore/NotImplemented.h>
#include <glib/gi18n-lib.h>
-#include <wtf/glib/GRefPtr.h>
-#include <wtf/glib/GUniquePtr.h>
+#include <wtf/gobject/GRefPtr.h>
+#include <wtf/gobject/GUniquePtr.h>
#include <wtf/text/CString.h>
-#if HAVE(GTK_UNIX_PRINTING)
+#ifdef HAVE_GTK_UNIX_PRINTING
#include <gtk/gtkunixprint.h>
#endif
@@ -207,7 +207,7 @@ static void webkit_print_operation_class_init(WebKitPrintOperationClass* printOp
G_TYPE_POINTER);
}
-#if HAVE(GTK_UNIX_PRINTING)
+#ifdef HAVE_GTK_UNIX_PRINTING
static WebKitPrintOperationResponse webkitPrintOperationRunDialog(WebKitPrintOperation* printOperation, GtkWindow* parent)
{
GtkPrintUnixDialog* printDialog = GTK_PRINT_UNIX_DIALOG(gtk_print_unix_dialog_new(0, parent));
@@ -252,31 +252,30 @@ static WebKitPrintOperationResponse webkitPrintOperationRunDialog(WebKitPrintOpe
}
#endif
-static void drawPagesForPrintingCompleted(API::Error* wkPrintError, WebKitPrintOperation* printOperation)
+static void drawPagesForPrintingCompleted(WKErrorRef wkPrintError, WKErrorRef, void* context)
{
+ GRefPtr<WebKitPrintOperation> printOperation = adoptGRef(WEBKIT_PRINT_OPERATION(context));
+
// When running synchronously WebPageProxy::printFrame() calls endPrinting().
if (printOperation->priv->printMode == PrintInfo::PrintModeAsync && printOperation->priv->webView) {
WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(printOperation->priv->webView));
page->endPrinting();
}
- const WebCore::ResourceError& resourceError = wkPrintError ? wkPrintError->platformError() : WebCore::ResourceError();
+ const WebCore::ResourceError& resourceError = wkPrintError ? toImpl(wkPrintError)->platformError() : WebCore::ResourceError();
if (!resourceError.isNull()) {
GUniquePtr<GError> printError(g_error_new_literal(g_quark_from_string(resourceError.domain().utf8().data()),
- toWebKitError(resourceError.errorCode()), resourceError.localizedDescription().utf8().data()));
- g_signal_emit(printOperation, signals[FAILED], 0, printError.get());
+ resourceError.errorCode(), resourceError.localizedDescription().utf8().data()));
+ g_signal_emit(printOperation.get(), signals[FAILED], 0, printError.get());
}
- g_signal_emit(printOperation, signals[FINISHED], 0, NULL);
+ g_signal_emit(printOperation.get(), signals[FINISHED], 0, NULL);
}
static void webkitPrintOperationPrintPagesForFrame(WebKitPrintOperation* printOperation, WebFrameProxy* webFrame, GtkPrintSettings* printSettings, GtkPageSetup* pageSetup)
{
PrintInfo printInfo(printSettings, pageSetup, printOperation->priv->printMode);
WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(printOperation->priv->webView));
- g_object_ref(printOperation);
- page->drawPagesForPrinting(webFrame, printInfo, PrintFinishedCallback::create([printOperation](API::Error* printError, CallbackBase::Error) {
- drawPagesForPrintingCompleted(printError, adoptGRef(printOperation).get());
- }));
+ page->drawPagesForPrinting(webFrame, printInfo, PrintFinishedCallback::create(g_object_ref(printOperation), &drawPagesForPrintingCompleted));
}
WebKitPrintOperationResponse webkitPrintOperationRunDialogForFrame(WebKitPrintOperation* printOperation, GtkWindow* parent, WebFrameProxy* webFrame)
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.cpp
index 2b1e12497..d34b9c471 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.cpp
@@ -20,9 +20,6 @@
#include "config.h"
#include "WebKitPrivate.h"
-#include "ErrorsGtk.h"
-#include "WebEvent.h"
-#include "WebKitError.h"
#include <gdk/gdk.h>
unsigned wkEventModifiersToGdkModifiers(WKEventModifiers wkModifiers)
@@ -39,57 +36,6 @@ unsigned wkEventModifiersToGdkModifiers(WKEventModifiers wkModifiers)
return modifiers;
}
-unsigned toGdkModifiers(WebKit::WebEvent::Modifiers wkModifiers)
-{
- unsigned modifiers = 0;
- if (wkModifiers & WebKit::WebEvent::Modifiers::ShiftKey)
- modifiers |= GDK_SHIFT_MASK;
- if (wkModifiers & WebKit::WebEvent::Modifiers::ControlKey)
- modifiers |= GDK_CONTROL_MASK;
- if (wkModifiers & WebKit::WebEvent::Modifiers::AltKey)
- modifiers |= GDK_MOD1_MASK;
- if (wkModifiers & WebKit::WebEvent::Modifiers::MetaKey)
- modifiers |= GDK_META_MASK;
- return modifiers;
-}
-
-WebKitNavigationType toWebKitNavigationType(WebCore::NavigationType type)
-{
- switch (type) {
- case WebCore::NavigationType::LinkClicked:
- return WEBKIT_NAVIGATION_TYPE_LINK_CLICKED;
- case WebCore::NavigationType::FormSubmitted:
- return WEBKIT_NAVIGATION_TYPE_FORM_SUBMITTED;
- case WebCore::NavigationType::BackForward:
- return WEBKIT_NAVIGATION_TYPE_BACK_FORWARD;
- case WebCore::NavigationType::Reload:
- return WEBKIT_NAVIGATION_TYPE_RELOAD;
- case WebCore::NavigationType::FormResubmitted:
- return WEBKIT_NAVIGATION_TYPE_FORM_RESUBMITTED;
- case WebCore::NavigationType::Other:
- return WEBKIT_NAVIGATION_TYPE_OTHER;
- default:
- ASSERT_NOT_REACHED();
- return WEBKIT_NAVIGATION_TYPE_OTHER;
- }
-}
-
-unsigned toWebKitMouseButton(WebKit::WebMouseEvent::Button button)
-{
- switch (button) {
- case WebKit::WebMouseEvent::Button::NoButton:
- return 0;
- case WebKit::WebMouseEvent::Button::LeftButton:
- return 1;
- case WebKit::WebMouseEvent::Button::MiddleButton:
- return 2;
- case WebKit::WebMouseEvent::Button::RightButton:
- return 3;
- }
- ASSERT_NOT_REACHED();
- return 0;
-}
-
unsigned wkEventMouseButtonToWebKitMouseButton(WKEventMouseButton wkButton)
{
switch (wkButton) {
@@ -105,109 +51,3 @@ unsigned wkEventMouseButtonToWebKitMouseButton(WKEventMouseButton wkButton)
ASSERT_NOT_REACHED();
return 0;
}
-
-unsigned toWebKitError(unsigned webCoreError)
-{
- switch (webCoreError) {
- case WebCore::NetworkErrorFailed:
- return WEBKIT_NETWORK_ERROR_FAILED;
- case WebCore::NetworkErrorTransport:
- return WEBKIT_NETWORK_ERROR_TRANSPORT;
- case WebCore::NetworkErrorUnknownProtocol:
- return WEBKIT_NETWORK_ERROR_UNKNOWN_PROTOCOL;
- case WebCore::NetworkErrorCancelled:
- return WEBKIT_NETWORK_ERROR_CANCELLED;
- case WebCore::NetworkErrorFileDoesNotExist:
- return WEBKIT_NETWORK_ERROR_FILE_DOES_NOT_EXIST;
- case WebCore::PolicyErrorFailed:
- return WEBKIT_POLICY_ERROR_FAILED;
- case WebCore::PolicyErrorCannotShowMimeType:
- return WEBKIT_POLICY_ERROR_CANNOT_SHOW_MIME_TYPE;
- case WebCore::PolicyErrorCannotShowURL:
- return WEBKIT_POLICY_ERROR_CANNOT_SHOW_URI;
- case WebCore::PolicyErrorFrameLoadInterruptedByPolicyChange:
- return WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE;
- case WebCore::PolicyErrorCannotUseRestrictedPort:
- return WEBKIT_POLICY_ERROR_CANNOT_USE_RESTRICTED_PORT;
- case WebCore::PluginErrorFailed:
- return WEBKIT_PLUGIN_ERROR_FAILED;
- case WebCore::PluginErrorCannotFindPlugin:
- return WEBKIT_PLUGIN_ERROR_CANNOT_FIND_PLUGIN;
- case WebCore::PluginErrorCannotLoadPlugin:
- return WEBKIT_PLUGIN_ERROR_CANNOT_LOAD_PLUGIN;
- case WebCore::PluginErrorJavaUnavailable:
- return WEBKIT_PLUGIN_ERROR_JAVA_UNAVAILABLE;
- case WebCore::PluginErrorConnectionCancelled:
- return WEBKIT_PLUGIN_ERROR_CONNECTION_CANCELLED;
- case WebCore::PluginErrorWillHandleLoad:
- return WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD;
- case WebCore::DownloadErrorNetwork:
- return WEBKIT_DOWNLOAD_ERROR_NETWORK;
- case WebCore::DownloadErrorCancelledByUser:
- return WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER;
- case WebCore::DownloadErrorDestination:
- return WEBKIT_DOWNLOAD_ERROR_DESTINATION;
- case WebCore::PrintErrorGeneral:
- return WEBKIT_PRINT_ERROR_GENERAL;
- case WebCore::PrintErrorPrinterNotFound:
- return WEBKIT_PRINT_ERROR_PRINTER_NOT_FOUND;
- case WebCore::PrintErrorInvalidPageRange:
- return WEBKIT_PRINT_ERROR_INVALID_PAGE_RANGE;
- default:
- // This may be a user app defined error, which needs to be passed as-is.
- return webCoreError;
- }
-}
-
-unsigned toWebCoreError(unsigned webKitError)
-{
- switch (webKitError) {
- case WEBKIT_NETWORK_ERROR_FAILED:
- return WebCore::NetworkErrorFailed;
- case WEBKIT_NETWORK_ERROR_TRANSPORT:
- return WebCore::NetworkErrorTransport;
- case WEBKIT_NETWORK_ERROR_UNKNOWN_PROTOCOL:
- return WebCore::NetworkErrorUnknownProtocol;
- case WEBKIT_NETWORK_ERROR_CANCELLED:
- return WebCore::NetworkErrorCancelled;
- case WEBKIT_NETWORK_ERROR_FILE_DOES_NOT_EXIST:
- return WebCore::NetworkErrorFileDoesNotExist;
- case WEBKIT_POLICY_ERROR_FAILED:
- return WebCore::PolicyErrorFailed;
- case WEBKIT_POLICY_ERROR_CANNOT_SHOW_MIME_TYPE:
- return WebCore::PolicyErrorCannotShowMimeType;
- case WEBKIT_POLICY_ERROR_CANNOT_SHOW_URI:
- return WebCore::PolicyErrorCannotShowURL;
- case WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE:
- return WebCore::PolicyErrorFrameLoadInterruptedByPolicyChange;
- case WEBKIT_POLICY_ERROR_CANNOT_USE_RESTRICTED_PORT:
- return WebCore::PolicyErrorCannotUseRestrictedPort;
- case WEBKIT_PLUGIN_ERROR_FAILED:
- return WebCore::PluginErrorFailed;
- case WEBKIT_PLUGIN_ERROR_CANNOT_FIND_PLUGIN:
- return WebCore::PluginErrorCannotFindPlugin;
- case WEBKIT_PLUGIN_ERROR_CANNOT_LOAD_PLUGIN:
- return WebCore::PluginErrorCannotLoadPlugin;
- case WEBKIT_PLUGIN_ERROR_JAVA_UNAVAILABLE:
- return WebCore::PluginErrorJavaUnavailable;
- case WEBKIT_PLUGIN_ERROR_CONNECTION_CANCELLED:
- return WebCore::PluginErrorConnectionCancelled;
- case WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD:
- return WebCore::PluginErrorWillHandleLoad;
- case WEBKIT_DOWNLOAD_ERROR_NETWORK:
- return WebCore::DownloadErrorNetwork;
- case WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER:
- return WebCore::DownloadErrorCancelledByUser;
- case WEBKIT_DOWNLOAD_ERROR_DESTINATION:
- return WebCore::DownloadErrorDestination;
- case WEBKIT_PRINT_ERROR_GENERAL:
- return WebCore::PrintErrorGeneral;
- case WEBKIT_PRINT_ERROR_PRINTER_NOT_FOUND:
- return WebCore::PrintErrorPrinterNotFound;
- case WEBKIT_PRINT_ERROR_INVALID_PAGE_RANGE:
- return WebCore::PrintErrorInvalidPageRange;
- default:
- // This may be a user app defined error, which needs to be passed as-is.
- return webKitError;
- }
-}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h
index c995cd5c0..bd060ed32 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h
@@ -26,23 +26,22 @@
#ifndef WebKitPrivate_h
#define WebKitPrivate_h
-#include "WebKitNavigationAction.h"
-#include <WebKit/WKAPICast.h>
-#include <WebKit/WKDownload.h>
-#include <WebKit/WKFindOptions.h>
-#include <WebKit/WKFullScreenClientGtk.h>
-#include <WebKit/WKGeolocationManager.h>
-#include <WebKit/WKGeolocationPermissionRequest.h>
-#include <WebKit/WKGeolocationPosition.h>
-#include <WebKit/WKIconDatabase.h>
-#include <WebKit/WKInspector.h>
-#include <WebKit/WKInspectorClientGtk.h>
-#include <WebKit/WKRetainPtr.h>
-#include <WebKit/WKSerializedScriptValue.h>
-#include <WebKit/WKSoupCustomProtocolRequestManager.h>
-#include <WebKit/WKString.h>
-#include <WebKit/WKUserMediaPermissionRequest.h>
-#include <WebKit/WebKit2_C.h>
+#include <WebKit2/WKAPICast.h>
+#include <WebKit2/WKDownload.h>
+#include <WebKit2/WKFindOptions.h>
+#include <WebKit2/WKFullScreenClientGtk.h>
+#include <WebKit2/WKGeolocationManager.h>
+#include <WebKit2/WKGeolocationPermissionRequest.h>
+#include <WebKit2/WKGeolocationPosition.h>
+#include <WebKit2/WKIconDatabase.h>
+#include <WebKit2/WKInspector.h>
+#include <WebKit2/WKInspectorClientGtk.h>
+#include <WebKit2/WKRetainPtr.h>
+#include <WebKit2/WKSerializedScriptValue.h>
+#include <WebKit2/WKSoupCustomProtocolRequestManager.h>
+#include <WebKit2/WKString.h>
+#include <WebKit2/WKTextChecker.h>
+#include <WebKit2/WebKit2_C.h>
#include <glib.h>
#include <wtf/Assertions.h>
@@ -50,17 +49,20 @@
#define WEBKIT_PARAM_WRITABLE (static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB))
#define WEBKIT_PARAM_READWRITE (static_cast<GParamFlags>(G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB))
+#define COMPILE_ASSERT_MATCHING_ENUM(webkitName, webcoreName) \
+ COMPILE_ASSERT(int(webkitName) == int(webcoreName), mismatchingEnums)
+
#define WEBKIT_DEFINE_ASYNC_DATA_STRUCT(structName) \
static structName* create##structName() \
{ \
- structName* data = static_cast<structName*>(fastZeroedMalloc(sizeof(structName))); \
+ structName* data = g_slice_new0(structName); \
new (data) structName(); \
return data; \
} \
static void destroy##structName(structName* data) \
{ \
data->~structName(); \
- fastFree(data); \
+ g_slice_free(structName, data); \
}
#define WEBKIT_DEFINE_TYPE(TypeName, type_name, TYPE_PARENT) _WEBKIT_DEFINE_TYPE_EXTENDED(TypeName, type_name, TYPE_PARENT, 0, { })
@@ -116,21 +118,10 @@ GType type_name##_get_type(void) \
unsigned wkEventModifiersToGdkModifiers(WKEventModifiers);
unsigned wkEventMouseButtonToWebKitMouseButton(WKEventMouseButton);
-unsigned toGdkModifiers(WebKit::WebEvent::Modifiers);
-WebKitNavigationType toWebKitNavigationType(WebCore::NavigationType);
-unsigned toWebKitMouseButton(WebKit::WebMouseEvent::Button);
-unsigned toWebKitError(unsigned webCoreError);
-unsigned toWebCoreError(unsigned webKitError);
enum SnapshotRegion {
SnapshotRegionVisible,
SnapshotRegionFullDocument
};
-#if ENABLE(NETWORK_CACHE)
-static const char networkCacheSubdirectory[] = "WebKitCache";
-#else
-static const char networkCacheSubdirectory[] = "webkit";
-#endif
-
#endif // WebKitPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitRequestManagerClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitRequestManagerClient.cpp
index f9189c916..72f91ec2e 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitRequestManagerClient.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitRequestManagerClient.cpp
@@ -24,7 +24,7 @@
using namespace WebKit;
-static void startLoading(WKSoupCustomProtocolRequestManagerRef, uint64_t customProtocolID, WKURLRequestRef requestRef, const void* clientInfo)
+static void startLoading(WKSoupCustomProtocolRequestManagerRef soupRequestManagerRef, uint64_t customProtocolID, WKURLRequestRef requestRef, const void* clientInfo)
{
webkitWebContextStartLoadingCustomProtocol(WEBKIT_WEB_CONTEXT(clientInfo), customProtocolID, toImpl(requestRef));
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp
index 69b241f85..b6054b814 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp
@@ -20,16 +20,17 @@
#include "config.h"
#include "WebKitResponsePolicyDecision.h"
+#include "APIURLRequest.h"
+#include "APIURLResponse.h"
#include "WebKitPolicyDecisionPrivate.h"
#include "WebKitPrivate.h"
#include "WebKitURIRequestPrivate.h"
#include "WebKitURIResponsePrivate.h"
#include <glib/gi18n-lib.h>
-#include <wtf/glib/GRefPtr.h>
+#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/CString.h>
using namespace WebKit;
-using namespace WebCore;
/**
* SECTION: WebKitResponsePolicyDecision
@@ -154,13 +155,12 @@ gboolean webkit_response_policy_decision_is_mime_type_supported(WebKitResponsePo
return decision->priv->canShowMIMEType;
}
-WebKitPolicyDecision* webkitResponsePolicyDecisionCreate(const ResourceRequest& request, const ResourceResponse& response, bool canShowMIMEType, WebFramePolicyListenerProxy* listener)
+WebKitResponsePolicyDecision* webkitResponsePolicyDecisionCreate(API::URLRequest* request, API::URLResponse* response, bool canShowMIMEType, WebFramePolicyListenerProxy* listener)
{
- WebKitResponsePolicyDecision* responseDecision = WEBKIT_RESPONSE_POLICY_DECISION(g_object_new(WEBKIT_TYPE_RESPONSE_POLICY_DECISION, nullptr));
- responseDecision->priv->request = adoptGRef(webkitURIRequestCreateForResourceRequest(request));
- responseDecision->priv->response = adoptGRef(webkitURIResponseCreateForResourceResponse(response));
- responseDecision->priv->canShowMIMEType = canShowMIMEType;
- WebKitPolicyDecision* decision = WEBKIT_POLICY_DECISION(responseDecision);
- webkitPolicyDecisionSetListener(decision, listener);
+ WebKitResponsePolicyDecision* decision = WEBKIT_RESPONSE_POLICY_DECISION(g_object_new(WEBKIT_TYPE_RESPONSE_POLICY_DECISION, NULL));
+ decision->priv->request = adoptGRef(webkitURIRequestCreateForResourceRequest(request->resourceRequest()));
+ decision->priv->response = adoptGRef(webkitURIResponseCreateForResourceResponse(response->resourceResponse()));
+ decision->priv->canShowMIMEType = canShowMIMEType;
+ webkitPolicyDecisionSetListener(WEBKIT_POLICY_DECISION(decision), listener);
return decision;
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecisionPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecisionPrivate.h
index 2ff91085b..ff83a7df3 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecisionPrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecisionPrivate.h
@@ -23,6 +23,6 @@
#include "WebKitPrivate.h"
#include "WebKitResponsePolicyDecision.h"
-WebKitPolicyDecision* webkitResponsePolicyDecisionCreate(const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, bool canShowMIMEType, WebKit::WebFramePolicyListenerProxy*);
+WebKitResponsePolicyDecision* webkitResponsePolicyDecisionCreate(API::URLRequest*, API::URLResponse*, bool canShowMIMEType, WebKit::WebFramePolicyListenerProxy*);
#endif // WebKitResponsePolicyDecisionPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitScriptDialog.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitScriptDialog.cpp
index 9cf86ab0a..863665d71 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitScriptDialog.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitScriptDialog.cpp
@@ -24,7 +24,7 @@
static WebKitScriptDialog* webkitScriptDialogCopy(WebKitScriptDialog* dialog)
{
- WebKitScriptDialog* copy = static_cast<WebKitScriptDialog*>(fastZeroedMalloc(sizeof(WebKitScriptDialog)));
+ WebKitScriptDialog* copy = g_slice_new0(WebKitScriptDialog);
new (copy) WebKitScriptDialog(dialog);
return copy;
}
@@ -32,7 +32,7 @@ static WebKitScriptDialog* webkitScriptDialogCopy(WebKitScriptDialog* dialog)
static void webkitScriptDialogFree(WebKitScriptDialog* dialog)
{
dialog->~WebKitScriptDialog();
- fastFree(dialog);
+ g_slice_free(WebKitScriptDialog, dialog);
}
G_DEFINE_BOXED_TYPE(WebKitScriptDialog, webkit_script_dialog, webkitScriptDialogCopy, webkitScriptDialogFree)
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityManager.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityManager.cpp
index 0a1ca8681..9b849a825 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityManager.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityManager.cpp
@@ -20,9 +20,9 @@
#include "config.h"
#include "WebKitSecurityManager.h"
+#include "WebContext.h"
#include "WebKitSecurityManagerPrivate.h"
#include "WebKitWebContextPrivate.h"
-#include "WebProcessPool.h"
#include <WebCore/SchemeRegistry.h>
using namespace WebKit;
@@ -55,7 +55,7 @@ struct _WebKitSecurityManagerPrivate {
WEBKIT_DEFINE_TYPE(WebKitSecurityManager, webkit_security_manager, G_TYPE_OBJECT)
-static void webkit_security_manager_class_init(WebKitSecurityManagerClass*)
+static void webkit_security_manager_class_init(WebKitSecurityManagerClass* klass)
{
}
@@ -69,7 +69,7 @@ WebKitSecurityManager* webkitSecurityManagerCreate(WebKitWebContext* webContext)
static void registerSecurityPolicyForURIScheme(WebKitSecurityManager* manager, const char* scheme, SecurityPolicy policy)
{
String urlScheme = String::fromUTF8(scheme);
- WebProcessPool* webContext = webkitWebContextGetContext(manager->priv->webContext);
+ WebContext* webContext = webkitWebContextGetContext(manager->priv->webContext);
// We keep the WebCore::SchemeRegistry of the UI process in sync with the
// web process one, so that we can return the SecurityPolicy for
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp
index 3e0c48899..7c49ccd82 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp
@@ -34,21 +34,15 @@
#include "ExperimentalFeatures.h"
#include "WebKitPrivate.h"
#include "WebKitSettingsPrivate.h"
-#include "WebPageProxy.h"
-#include "WebPreferences.h"
#include <WebCore/UserAgentGtk.h>
#include <glib/gi18n-lib.h>
#include <wtf/text/CString.h>
-#if PLATFORM(WAYLAND)
-#include <WebCore/PlatformDisplay.h>
-#endif
-
using namespace WebKit;
struct _WebKitSettingsPrivate {
_WebKitSettingsPrivate()
- : preferences(WebPreferences::create(String(), "WebKit2.", "WebKit2."))
+ : preferences(WebPreferences::create())
{
defaultFontFamily = preferences->standardFontFamily().utf8();
monospaceFontFamily = preferences->fixedFontFamily().utf8();
@@ -58,10 +52,6 @@ struct _WebKitSettingsPrivate {
fantasyFontFamily = preferences->fantasyFontFamily().utf8();
pictographFontFamily = preferences->pictographFontFamily().utf8();
defaultCharset = preferences->defaultTextEncodingName().utf8();
-
-#if USE(COORDINATED_GRAPHICS_THREADED)
- preferences->setForceCompositingMode(true);
-#endif
}
RefPtr<WebPreferences> preferences;
@@ -80,12 +70,13 @@ struct _WebKitSettingsPrivate {
/**
* SECTION:WebKitSettings
- * @short_description: Control the behaviour of a #WebKitWebView
+ * @short_description: Control the behaviour of #WebKitWebView<!-- -->s
+ * @see_also: #WebKitWebViewGroup, #WebKitWebView
*
- * #WebKitSettings can be applied to a #WebKitWebView to control text charset,
+ * #WebKitSettings can be applied to a #WebKitWebViewGroup to control text charset,
* color, font sizes, printing mode, script support, loading of images and various
- * other things on a #WebKitWebView. After creation, a #WebKitSettings object
- * contains default settings.
+ * other things on the #WebKitWebView<!-- -->s of the group.
+ * After creation, a #WebKitSettings object contains default settings.
*
* <informalexample><programlisting>
* /<!-- -->* Disable JavaScript. *<!-- -->/
@@ -147,8 +138,7 @@ enum {
PROP_ENABLE_WRITE_CONSOLE_MESSAGES_TO_STDOUT,
PROP_ENABLE_MEDIA_STREAM,
PROP_ENABLE_SPATIAL_NAVIGATION,
- PROP_ENABLE_MEDIASOURCE,
- PROP_ALLOW_FILE_ACCESS_FROM_FILE_URLS
+ PROP_ENABLE_MEDIASOURCE
};
static void webKitSettingsConstructed(GObject* object)
@@ -156,6 +146,14 @@ static void webKitSettingsConstructed(GObject* object)
G_OBJECT_CLASS(webkit_settings_parent_class)->constructed(object);
WebPreferences* prefs = WEBKIT_SETTINGS(object)->priv->preferences.get();
+ ExperimentalFeatures features;
+ bool cssGridLayoutEnabled = features.isEnabled(ExperimentalFeatures::CSSGridLayout);
+ if (prefs->cssGridLayoutEnabled() != cssGridLayoutEnabled)
+ prefs->setCSSGridLayoutEnabled(cssGridLayoutEnabled);
+ bool regionBasedColumnsEnabled = features.isEnabled(ExperimentalFeatures::RegionBasedColumns);
+ if (prefs->regionBasedColumnsEnabled() != regionBasedColumnsEnabled)
+ prefs->setRegionBasedColumnsEnabled(regionBasedColumnsEnabled);
+
prefs->setShouldRespectImageOrientation(true);
}
@@ -314,9 +312,6 @@ static void webKitSettingsSetProperty(GObject* object, guint propId, const GValu
case PROP_ENABLE_MEDIASOURCE:
webkit_settings_set_enable_mediasource(settings, g_value_get_boolean(value));
break;
- case PROP_ALLOW_FILE_ACCESS_FROM_FILE_URLS:
- webkit_settings_set_allow_file_access_from_file_urls(settings, g_value_get_boolean(value));
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
break;
@@ -472,9 +467,7 @@ static void webKitSettingsGetProperty(GObject* object, guint propId, GValue* val
case PROP_ENABLE_MEDIASOURCE:
g_value_set_boolean(value, webkit_settings_get_enable_mediasource(settings));
break;
- case PROP_ALLOW_FILE_ACCESS_FROM_FILE_URLS:
- g_value_set_boolean(value, webkit_settings_get_allow_file_access_from_file_urls(settings));
- break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
break;
@@ -1227,25 +1220,6 @@ static void webkit_settings_class_init(WebKitSettingsClass* klass)
_("Whether MediaSource should be enabled."),
FALSE,
readWriteConstructParamFlags));
-
- /**
- * WebKitSettings:allow-file-access-from-file-urls:
- *
- * Whether file access is allowed from file URLs. By default, when
- * something is loaded in a #WebKitWebView using a file URI, cross
- * origin requests to other file resources are not allowed. This
- * setting allows you to change that behaviour, so that it would be
- * possible to do a XMLHttpRequest of a local file, for example.
- *
- * Since: 2.10
- */
- g_object_class_install_property(gObjectClass,
- PROP_ALLOW_FILE_ACCESS_FROM_FILE_URLS,
- g_param_spec_boolean("allow-file-access-from-file-urls",
- _("Allow file access from file URLs"),
- _("Whether file access is allowed from file URLs."),
- FALSE,
- readWriteConstructParamFlags));
}
WebPreferences* webkitSettingsGetPreferences(WebKitSettings* settings)
@@ -1257,7 +1231,7 @@ WebPreferences* webkitSettingsGetPreferences(WebKitSettings* settings)
* webkit_settings_new:
*
* Creates a new #WebKitSettings instance with default values. It must
- * be manually attached to a #WebKitWebView.
+ * be manually attached to a #WebKitWebViewGroup.
* See also webkit_settings_new_with_settings().
*
* Returns: a new #WebKitSettings instance.
@@ -1274,7 +1248,7 @@ WebKitSettings* webkit_settings_new()
* %NULL-terminated
*
* Creates a new #WebKitSettings instance with the given settings. It must
- * be manually attached to a #WebKitWebView.
+ * be manually attached to a #WebKitWebViewGroup.
*
* Returns: a new #WebKitSettings instance.
*/
@@ -1594,12 +1568,6 @@ void webkit_settings_set_enable_plugins(WebKitSettings* settings, gboolean enabl
{
g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
-#if PLATFORM(WAYLAND)
- // Do not allow to change this setting in Wayland, since plugins are not supported.
- if (WebCore::PlatformDisplay::sharedDisplay().type() == WebCore::PlatformDisplay::Type::Wayland)
- return;
-#endif
-
WebKitSettingsPrivate* priv = settings->priv;
bool currentValue = priv->preferences->pluginsEnabled();
if (currentValue == enabled)
@@ -2583,7 +2551,7 @@ gboolean webkit_settings_get_media_playback_requires_user_gesture(WebKitSettings
{
g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
- return settings->priv->preferences->requiresUserGestureForMediaPlayback();
+ return settings->priv->preferences->mediaPlaybackRequiresUserGesture();
}
/**
@@ -2598,11 +2566,11 @@ void webkit_settings_set_media_playback_requires_user_gesture(WebKitSettings* se
g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
WebKitSettingsPrivate* priv = settings->priv;
- bool currentValue = priv->preferences->requiresUserGestureForMediaPlayback();
+ bool currentValue = priv->preferences->mediaPlaybackRequiresUserGesture();
if (currentValue == enabled)
return;
- priv->preferences->setRequiresUserGestureForMediaPlayback(enabled);
+ priv->preferences->setMediaPlaybackRequiresUserGesture(enabled);
g_object_notify(G_OBJECT(settings), "media-playback-requires-user-gesture");
}
@@ -2619,7 +2587,7 @@ gboolean webkit_settings_get_media_playback_allows_inline(WebKitSettings* settin
{
g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), TRUE);
- return settings->priv->preferences->allowsInlineMediaPlayback();
+ return settings->priv->preferences->mediaPlaybackAllowsInline();
}
/**
@@ -2634,11 +2602,11 @@ void webkit_settings_set_media_playback_allows_inline(WebKitSettings* settings,
g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
WebKitSettingsPrivate* priv = settings->priv;
- bool currentValue = priv->preferences->allowsInlineMediaPlayback();
+ bool currentValue = priv->preferences->mediaPlaybackAllowsInline();
if (currentValue == enabled)
return;
- priv->preferences->setAllowsInlineMediaPlayback(enabled);
+ priv->preferences->setMediaPlaybackAllowsInline(enabled);
g_object_notify(G_OBJECT(settings), "media-playback-allows-inline");
}
@@ -3034,41 +3002,3 @@ void webkit_settings_set_enable_mediasource(WebKitSettings* settings, gboolean e
priv->preferences->setMediaSourceEnabled(enabled);
g_object_notify(G_OBJECT(settings), "enable-mediasource");
}
-
-/**
- * webkit_settings_get_allow_file_access_from_file_urls:
- * @settings: a #WebKitSettings
- *
- * Get the #WebKitSettings:allow-file-access-from-file-urls property.
- *
- * Returns: %TRUE If file access from file URLs is allowed or %FALSE otherwise.
- *
- * Since: 2.10
- */
-gboolean webkit_settings_get_allow_file_access_from_file_urls(WebKitSettings* settings)
-{
- g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
-
- return settings->priv->preferences->allowFileAccessFromFileURLs();
-}
-
-/**
- * webkit_settings_set_allow_file_access_from_file_urls:
- * @settings: a #WebKitSettings
- * @allowed: Value to be set
- *
- * Set the #WebKitSettings:allow-file-access-from-file-urls property.
- *
- * Since: 2.10
- */
-void webkit_settings_set_allow_file_access_from_file_urls(WebKitSettings* settings, gboolean allowed)
-{
- g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
-
- WebKitSettingsPrivate* priv = settings->priv;
- if (priv->preferences->allowFileAccessFromFileURLs() == allowed)
- return;
-
- priv->preferences->setAllowFileAccessFromFileURLs(allowed);
- g_object_notify(G_OBJECT(settings), "allow-file-access-from-file-urls");
-}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h
index d9ec48034..66e687f3d 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h
@@ -414,13 +414,6 @@ WEBKIT_API void
webkit_settings_set_enable_mediasource (WebKitSettings *settings,
gboolean enabled);
-WEBKIT_API gboolean
-webkit_settings_get_allow_file_access_from_file_urls (WebKitSettings *settings);
-
-WEBKIT_API void
-webkit_settings_set_allow_file_access_from_file_urls (WebKitSettings *settings,
- gboolean allowed);
-
G_END_DECLS
#endif /* WebKitSettings_h */
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp
new file mode 100644
index 000000000..69b4b091b
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitTextChecker.h"
+
+#if ENABLE(SPELLCHECK)
+
+#include "WebKitPrivate.h"
+
+using namespace WebKit;
+
+static inline WebKitTextChecker* toTextChecker(const void* clientInfo)
+{
+ return static_cast<WebKitTextChecker*>(const_cast<void*>(clientInfo));
+}
+
+static bool continuousSpellCheckingEnabledCallback(const void* clientInfo)
+{
+ return toTextChecker(clientInfo)->isSpellCheckingEnabled();
+}
+
+static void setContinuousSpellCheckingEnabledCallback(bool enabled, const void* clientInfo)
+{
+ toTextChecker(clientInfo)->setSpellCheckingEnabled(enabled);
+}
+
+static void checkSpellingOfStringCallback(uint64_t tag, WKStringRef text, int32_t* misspellingLocation, int32_t* misspellingLength, const void* clientInfo)
+{
+ toTextChecker(clientInfo)->checkSpellingOfString(toImpl(text)->string(), *misspellingLocation, *misspellingLength);
+}
+
+static WKArrayRef guessesForWordCallback(uint64_t tag, WKStringRef word, const void* clientInfo)
+{
+ Vector<String> guesses = toTextChecker(clientInfo)->getGuessesForWord(toImpl(word)->string());
+ if (guesses.isEmpty())
+ return 0;
+
+ WKMutableArrayRef wkSuggestions = WKMutableArrayCreate();
+ for (Vector<String>::const_iterator iter = guesses.begin(); iter != guesses.end(); ++iter) {
+ WKRetainPtr<WKStringRef> wkSuggestion(AdoptWK, WKStringCreateWithUTF8CString(iter->utf8().data()));
+ WKArrayAppendItem(wkSuggestions, wkSuggestion.get());
+ }
+
+ return wkSuggestions;
+}
+
+static void learnWordCallback(uint64_t tag, WKStringRef word, const void* clientInfo)
+{
+ toTextChecker(clientInfo)->learnWord(toImpl(word)->string());
+}
+
+static void ignoreWordCallback(uint64_t tag, WKStringRef word, const void* clientInfo)
+{
+ toTextChecker(clientInfo)->ignoreWord(toImpl(word)->string());
+}
+
+WebKitTextChecker::~WebKitTextChecker()
+{
+}
+
+WebKitTextChecker::WebKitTextChecker()
+ : m_textChecker(WebCore::TextCheckerEnchant::create())
+ , m_spellCheckingEnabled(false)
+{
+ WKTextCheckerClientV0 wkTextCheckerClient = {
+ {
+ 0, // version
+ this, // clientInfo
+ },
+ 0, // continuousSpellCheckingAllowed
+ continuousSpellCheckingEnabledCallback,
+ setContinuousSpellCheckingEnabledCallback,
+ 0, // grammarCheckingEnabled
+ 0, // setGrammarCheckingEnabled
+ 0, // uniqueSpellDocumentTag
+ 0, // closeSpellDocumentWithTag
+ checkSpellingOfStringCallback,
+ 0, // checkGrammarOfString
+ 0, // spellingUIIsShowing
+ 0, // toggleSpellingUIIsShowing
+ 0, // updateSpellingUIWithMisspelledWord
+ 0, // updateSpellingUIWithGrammarString
+ guessesForWordCallback,
+ learnWordCallback,
+ ignoreWordCallback,
+ };
+ WKTextCheckerSetClient(&wkTextCheckerClient.base);
+}
+
+void WebKitTextChecker::checkSpellingOfString(const String& string, int& misspellingLocation, int& misspellingLength)
+{
+ m_textChecker->checkSpellingOfString(string, misspellingLocation, misspellingLength);
+}
+
+Vector<String> WebKitTextChecker::getGuessesForWord(const String& word)
+{
+ return m_textChecker->getGuessesForWord(word);
+}
+
+void WebKitTextChecker::learnWord(const String& word)
+{
+ m_textChecker->learnWord(word);
+}
+
+void WebKitTextChecker::ignoreWord(const String& word)
+{
+ m_textChecker->ignoreWord(word);
+}
+
+void WebKitTextChecker::setSpellCheckingEnabled(bool enabled)
+{
+ if (m_spellCheckingEnabled == enabled)
+ return;
+ m_spellCheckingEnabled = enabled;
+
+ // We need to notify the Web process that this has changed.
+ WKTextCheckerContinuousSpellCheckingEnabledStateChanged(enabled);
+}
+
+const char* const* WebKitTextChecker::getSpellCheckingLanguages()
+{
+ Vector<String> spellCheckingLanguages = m_textChecker->loadedSpellCheckingLanguages();
+ if (spellCheckingLanguages.isEmpty())
+ return 0;
+
+ m_spellCheckingLanguages = adoptGRef(g_ptr_array_new_with_free_func(g_free));
+ for (size_t i = 0; i < spellCheckingLanguages.size(); ++i)
+ g_ptr_array_add(m_spellCheckingLanguages.get(), g_strdup(spellCheckingLanguages[i].utf8().data()));
+ g_ptr_array_add(m_spellCheckingLanguages.get(), 0);
+
+ return reinterpret_cast<char**>(m_spellCheckingLanguages->pdata);
+}
+
+void WebKitTextChecker::setSpellCheckingLanguages(const char* const* languages)
+{
+ Vector<String> spellCheckingLanguages;
+ for (size_t i = 0; languages[i]; ++i)
+ spellCheckingLanguages.append(String::fromUTF8(languages[i]));
+ m_textChecker->updateSpellCheckingLanguages(spellCheckingLanguages);
+}
+#endif // ENABLE(SPELLCHECK)
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.h b/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.h
new file mode 100644
index 000000000..45424c584
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebKitTextChecker_h
+#define WebKitTextChecker_h
+
+#if ENABLE(SPELLCHECK)
+
+#include <WebCore/TextCheckerEnchant.h>
+#include <wtf/FastMalloc.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/Vector.h>
+#include <wtf/gobject/GRefPtr.h>
+#include <wtf/text/CString.h>
+
+class WebKitTextChecker {
+ WTF_MAKE_FAST_ALLOCATED;
+
+public:
+ static PassOwnPtr<WebKitTextChecker> create() { return adoptPtr(new WebKitTextChecker()); }
+ virtual ~WebKitTextChecker();
+
+ // For implementing TextCheckerClient.
+ bool isSpellCheckingEnabled() { return m_spellCheckingEnabled; }
+ void setSpellCheckingEnabled(bool enabled);
+ void checkSpellingOfString(const String& string, int& misspellingLocation, int& misspellingLength);
+ Vector<String> getGuessesForWord(const String& word);
+ void learnWord(const String& word);
+ void ignoreWord(const String& word);
+
+ // To be called from WebKitWebContext only.
+ const char* const* getSpellCheckingLanguages();
+ void setSpellCheckingLanguages(const char* const* spellCheckingLanguages);
+
+private:
+ WebKitTextChecker();
+
+ OwnPtr<WebCore::TextCheckerEnchant> m_textChecker;
+ GRefPtr<GPtrArray> m_spellCheckingLanguages;
+ bool m_spellCheckingEnabled;
+};
+
+#endif // ENABLE(SPELLCHECK)
+
+#endif // WebKitTextChecker_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp
index ff2cb61ff..483b82786 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp
@@ -20,190 +20,199 @@
#include "config.h"
#include "WebKitUIClient.h"
-#include "APIUIClient.h"
#include "WebKitFileChooserRequestPrivate.h"
#include "WebKitGeolocationPermissionRequestPrivate.h"
-#include "WebKitNavigationActionPrivate.h"
-#include "WebKitNotificationPermissionRequestPrivate.h"
#include "WebKitPrivate.h"
-#include "WebKitURIRequestPrivate.h"
-#include "WebKitUserMediaPermissionRequestPrivate.h"
#include "WebKitWebViewBasePrivate.h"
#include "WebKitWebViewPrivate.h"
#include "WebKitWindowPropertiesPrivate.h"
#include "WebPageProxy.h"
#include <WebCore/GtkUtilities.h>
-#include <wtf/glib/GRefPtr.h>
+#include <wtf/gobject/GRefPtr.h>
using namespace WebKit;
-class UIClient : public API::UIClient {
-public:
- explicit UIClient(WebKitWebView* webView)
- : m_webView(webView)
- {
- }
-
-private:
- virtual PassRefPtr<WebPageProxy> createNewPage(WebPageProxy*, WebFrameProxy*, const SecurityOriginData&, const WebCore::ResourceRequest& resourceRequest, const WebCore::WindowFeatures& windowFeatures, const NavigationActionData& navigationActionData) override
- {
- GRefPtr<WebKitURIRequest> request = adoptGRef(webkitURIRequestCreateForResourceRequest(resourceRequest));
- WebKitNavigationAction navigationAction(request.get(), navigationActionData);
- return webkitWebViewCreateNewPage(m_webView, windowFeatures, &navigationAction);
- }
-
- virtual void showPage(WebPageProxy*) override
- {
- webkitWebViewReadyToShowPage(m_webView);
- }
-
- virtual void close(WebPageProxy*) override
- {
- webkitWebViewClosePage(m_webView);
- }
-
- virtual void runJavaScriptAlert(WebPageProxy*, const String& message, WebFrameProxy*, const SecurityOriginData&, std::function<void ()> completionHandler) override
- {
- webkitWebViewRunJavaScriptAlert(m_webView, message.utf8());
- completionHandler();
- }
-
- virtual void runJavaScriptConfirm(WebPageProxy*, const String& message, WebFrameProxy*, const SecurityOriginData&, std::function<void (bool)> completionHandler) override
- {
- completionHandler(webkitWebViewRunJavaScriptConfirm(m_webView, message.utf8()));
- }
-
- virtual void runJavaScriptPrompt(WebPageProxy*, const String& message, const String& defaultValue, WebFrameProxy*, const SecurityOriginData&, std::function<void (const String&)> completionHandler) override
- {
- CString result = webkitWebViewRunJavaScriptPrompt(m_webView, message.utf8(), defaultValue.utf8());
- if (result.isNull()) {
- completionHandler(String());
- return;
- }
-
- completionHandler(String::fromUTF8(result.data()));
- }
-
- virtual void mouseDidMoveOverElement(WebPageProxy*, const WebHitTestResult::Data& data, WebEvent::Modifiers modifiers, API::Object*) override
- {
- webkitWebViewMouseTargetChanged(m_webView, data, toGdkModifiers(modifiers));
- }
+static WKPageRef createNewPage(WKPageRef page, WKURLRequestRef, WKDictionaryRef wkWindowFeatures, WKEventModifiers, WKEventMouseButton, const void* clientInfo)
+{
+ return static_cast<WKPageRef>(toAPI(webkitWebViewCreateNewPage(WEBKIT_WEB_VIEW(clientInfo), toImpl(wkWindowFeatures))));
+}
- virtual bool toolbarsAreVisible(WebPageProxy*) override
- {
- return webkit_window_properties_get_toolbar_visible(webkit_web_view_get_window_properties(m_webView));
- }
+static void showPage(WKPageRef page, const void* clientInfo)
+{
+ webkitWebViewReadyToShowPage(WEBKIT_WEB_VIEW(clientInfo));
+}
- virtual void setToolbarsAreVisible(WebPageProxy*, bool visible) override
- {
- webkitWindowPropertiesSetToolbarVisible(webkit_web_view_get_window_properties(m_webView), visible);
- }
+static void closePage(WKPageRef page, const void* clientInfo)
+{
+ webkitWebViewClosePage(WEBKIT_WEB_VIEW(clientInfo));
+}
- virtual bool menuBarIsVisible(WebPageProxy*) override
- {
- return webkit_window_properties_get_menubar_visible(webkit_web_view_get_window_properties(m_webView));
- }
+static void runJavaScriptAlert(WKPageRef page, WKStringRef message, WKFrameRef, const void* clientInfo)
+{
+ webkitWebViewRunJavaScriptAlert(WEBKIT_WEB_VIEW(clientInfo), toImpl(message)->string().utf8());
+}
- virtual void setMenuBarIsVisible(WebPageProxy*, bool visible) override
- {
- webkitWindowPropertiesSetToolbarVisible(webkit_web_view_get_window_properties(m_webView), visible);
- }
+static bool runJavaScriptConfirm(WKPageRef page, WKStringRef message, WKFrameRef, const void* clientInfo)
+{
+ return webkitWebViewRunJavaScriptConfirm(WEBKIT_WEB_VIEW(clientInfo), toImpl(message)->string().utf8());
+}
- virtual bool statusBarIsVisible(WebPageProxy*) override
- {
- return webkit_window_properties_get_statusbar_visible(webkit_web_view_get_window_properties(m_webView));
- }
+static WKStringRef runJavaScriptPrompt(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef, const void* clientInfo)
+{
+ CString result = webkitWebViewRunJavaScriptPrompt(WEBKIT_WEB_VIEW(clientInfo), toImpl(message)->string().utf8(),
+ toImpl(defaultValue)->string().utf8());
+ return WKStringCreateWithUTF8CString(result.data());
+}
- virtual void setStatusBarIsVisible(WebPageProxy*, bool visible) override
- {
- webkitWindowPropertiesSetStatusbarVisible(webkit_web_view_get_window_properties(m_webView), visible);
- }
+static bool toolbarsAreVisible(WKPageRef page, const void* clientInfo)
+{
+ WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
+ return webkit_window_properties_get_toolbar_visible(windowProperties);
+}
- virtual bool isResizable(WebPageProxy*) override
- {
- return webkit_window_properties_get_resizable(webkit_web_view_get_window_properties(m_webView));
- }
+static void setToolbarsAreVisible(WKPageRef page, bool toolbarsVisible, const void* clientInfo)
+{
+ WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
+ webkitWindowPropertiesSetToolbarVisible(windowProperties, toolbarsVisible);
+}
- virtual void setIsResizable(WebPageProxy*, bool resizable) override
- {
- webkitWindowPropertiesSetResizable(webkit_web_view_get_window_properties(m_webView), resizable);
- }
+static bool menuBarIsVisible(WKPageRef page, const void* clientInfo)
+{
+ WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
+ return webkit_window_properties_get_menubar_visible(windowProperties);
+}
- virtual void setWindowFrame(WebPageProxy*, const WebCore::FloatRect& frame) override
- {
- GdkRectangle geometry = WebCore::IntRect(frame);
- webkitWindowPropertiesSetGeometry(webkit_web_view_get_window_properties(m_webView), &geometry);
- }
+static void setMenuBarIsVisible(WKPageRef page, bool menuBarVisible, const void* clientInfo)
+{
+ WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
+ webkitWindowPropertiesSetMenubarVisible(windowProperties, menuBarVisible);
+}
- virtual WebCore::FloatRect windowFrame(WebPageProxy*) override
- {
- GdkRectangle geometry = { 0, 0, 0, 0 };
- GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(m_webView));
- if (WebCore::widgetIsOnscreenToplevelWindow(window) && gtk_widget_get_visible(window)) {
- gtk_window_get_position(GTK_WINDOW(window), &geometry.x, &geometry.y);
- gtk_window_get_size(GTK_WINDOW(window), &geometry.width, &geometry.height);
- }
- return WebCore::FloatRect(geometry);
- }
+static bool statusBarIsVisible(WKPageRef page, const void* clientInfo)
+{
+ WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
+ return webkit_window_properties_get_statusbar_visible(windowProperties);
+}
- virtual void exceededDatabaseQuota(WebPageProxy*, WebFrameProxy*, API::SecurityOrigin*, const String&, const String&, unsigned long long /*currentQuota*/, unsigned long long /*currentOriginUsage*/, unsigned long long /*currentDatabaseUsage*/, unsigned long long /*expectedUsage*/, std::function<void (unsigned long long)> completionHandler) override
- {
- static const unsigned long long defaultQuota = 5 * 1024 * 1204; // 5 MB
- // FIXME: Provide API for this.
- completionHandler(defaultQuota);
- }
+static void setStatusBarIsVisible(WKPageRef page, bool statusBarVisible, const void* clientInfo)
+{
+ WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
+ webkitWindowPropertiesSetStatusbarVisible(windowProperties, statusBarVisible);
+}
- virtual bool runOpenPanel(WebPageProxy*, WebFrameProxy*, WebOpenPanelParameters* parameters, WebOpenPanelResultListenerProxy* listener) override
- {
- GRefPtr<WebKitFileChooserRequest> request = adoptGRef(webkitFileChooserRequestCreate(parameters, listener));
- webkitWebViewRunFileChooserRequest(m_webView, request.get());
- return true;
- }
+static bool isResizable(WKPageRef page, const void* clientInfo)
+{
+ WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
+ return webkit_window_properties_get_resizable(windowProperties);
+}
- virtual bool decidePolicyForGeolocationPermissionRequest(WebPageProxy*, WebFrameProxy*, API::SecurityOrigin*, GeolocationPermissionRequestProxy* permissionRequest) override
- {
- GRefPtr<WebKitGeolocationPermissionRequest> geolocationPermissionRequest = adoptGRef(webkitGeolocationPermissionRequestCreate(permissionRequest));
- webkitWebViewMakePermissionRequest(m_webView, WEBKIT_PERMISSION_REQUEST(geolocationPermissionRequest.get()));
- return true;
- }
+static void setIsResizable(WKPageRef page, bool resizable, const void* clientInfo)
+{
+ WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
+ webkitWindowPropertiesSetResizable(windowProperties, resizable);
+}
- virtual bool decidePolicyForUserMediaPermissionRequest(WebPageProxy&, WebFrameProxy&, API::SecurityOrigin& securityOrigin, UserMediaPermissionRequestProxy& permissionRequest) override
- {
- GRefPtr<WebKitUserMediaPermissionRequest> userMediaPermissionRequest = adoptGRef(webkitUserMediaPermissionRequestCreate(permissionRequest, securityOrigin));
- webkitWebViewMakePermissionRequest(m_webView, WEBKIT_PERMISSION_REQUEST(userMediaPermissionRequest.get()));
- return true;
+static WKRect getWindowFrame(WKPageRef page, const void* clientInfo)
+{
+ GdkRectangle geometry = { 0, 0, 0, 0 };
+ GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(clientInfo));
+ if (WebCore::widgetIsOnscreenToplevelWindow(window) && gtk_widget_get_visible(window)) {
+ gtk_window_get_position(GTK_WINDOW(window), &geometry.x, &geometry.y);
+ gtk_window_get_size(GTK_WINDOW(window), &geometry.width, &geometry.height);
}
+ return WKRectMake(geometry.x, geometry.y, geometry.width, geometry.height);
+}
- virtual bool decidePolicyForNotificationPermissionRequest(WebPageProxy*, API::SecurityOrigin*, NotificationPermissionRequest* permissionRequest) override
- {
- GRefPtr<WebKitNotificationPermissionRequest> notificationPermissionRequest = adoptGRef(webkitNotificationPermissionRequestCreate(permissionRequest));
- webkitWebViewMakePermissionRequest(m_webView, WEBKIT_PERMISSION_REQUEST(notificationPermissionRequest.get()));
- return true;
- }
+static void setWindowFrame(WKPageRef page, WKRect frame, const void* clientInfo)
+{
+ WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
+ GdkRectangle geometry = { static_cast<int>(frame.origin.x), static_cast<int>(frame.origin.y),
+ static_cast<int>(frame.size.width), static_cast<int>(frame.size.height) };
+ webkitWindowPropertiesSetGeometry(windowProperties, &geometry);
+}
- virtual void printFrame(WebPageProxy*, WebFrameProxy* frame) override
- {
- webkitWebViewPrintFrame(m_webView, frame);
- }
+static void mouseDidMoveOverElement(WKPageRef page, WKHitTestResultRef hitTestResult, WKEventModifiers modifiers, WKTypeRef userData, const void* clientInfo)
+{
+ webkitWebViewMouseTargetChanged(WEBKIT_WEB_VIEW(clientInfo), toImpl(hitTestResult), wkEventModifiersToGdkModifiers(modifiers));
+}
- virtual bool canRunModal() const override { return true; }
+static void printFrame(WKPageRef page, WKFrameRef frame, const void*)
+{
+ webkitWebViewPrintFrame(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()), toImpl(frame));
+}
- virtual void runModal(WebPageProxy*) override
- {
- webkitWebViewRunAsModal(m_webView);
- }
+static void runOpenPanel(WKPageRef page, WKFrameRef frame, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener, const void *clientInfo)
+{
+ GRefPtr<WebKitFileChooserRequest> request = adoptGRef(webkitFileChooserRequestCreate(toImpl(parameters), toImpl(listener)));
+ webkitWebViewRunFileChooserRequest(WEBKIT_WEB_VIEW(clientInfo), request.get());
+}
- virtual void isPlayingAudioDidChange(WebPageProxy&) override
- {
- webkitWebViewIsPlayingAudioChanged(m_webView);
- }
+static void decidePolicyForGeolocationPermissionRequest(WKPageRef, WKFrameRef, WKSecurityOriginRef, WKGeolocationPermissionRequestRef request, const void* clientInfo)
+{
+ GRefPtr<WebKitGeolocationPermissionRequest> geolocationPermissionRequest = adoptGRef(webkitGeolocationPermissionRequestCreate(toImpl(request)));
+ webkitWebViewMakePermissionRequest(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_PERMISSION_REQUEST(geolocationPermissionRequest.get()));
+}
- WebKitWebView* m_webView;
-};
+static void runModal(WKPageRef page, const void* clientInfo)
+{
+ webkitWebViewRunAsModal(WEBKIT_WEB_VIEW(clientInfo));
+}
void attachUIClientToView(WebKitWebView* webView)
{
- WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView));
- page->setUIClient(std::make_unique<UIClient>(webView));
+ WKPageUIClientV2 wkUIClient = {
+ {
+ 2, // version
+ webView, // clientInfo
+ },
+ 0, // createNewPage_deprecatedForUseWithV0
+ showPage,
+ closePage,
+ 0, // takeFocus
+ 0, // focus
+ 0, // unfocus
+ runJavaScriptAlert,
+ runJavaScriptConfirm,
+ runJavaScriptPrompt,
+ 0, // setStatusText
+ 0, // mouseDidMoveOverElement_deprecatedForUseWithV0
+ 0, // missingPluginButtonClicked
+ 0, // didNotHandleKeyEvent
+ 0, // didNotHandleWheelEvent
+ toolbarsAreVisible,
+ setToolbarsAreVisible,
+ menuBarIsVisible,
+ setMenuBarIsVisible,
+ statusBarIsVisible,
+ setStatusBarIsVisible,
+ isResizable,
+ setIsResizable,
+ getWindowFrame,
+ setWindowFrame,
+ 0, // runBeforeUnloadConfirmPanel
+ 0, // didDraw
+ 0, // pageDidScroll
+ 0, // exceededDatabaseQuota
+ runOpenPanel,
+ decidePolicyForGeolocationPermissionRequest,
+ 0, // headerHeight
+ 0, // footerHeight
+ 0, // drawHeader
+ 0, // drawFooter
+ printFrame,
+ runModal,
+ 0, // didCompleteRubberBandForMainFrame
+ 0, // saveDataToFileInDownloadsFolder
+ 0, // shouldInterruptJavaScript
+ createNewPage,
+ mouseDidMoveOverElement,
+ 0, // decidePolicyForNotificationPermissionRequest
+ 0, // unavailablePluginButtonClicked
+ 0, // showColorPicker
+ 0, // hideColorPicker
+ 0, // pluginLoadPolicy
+ };
+ WKPageRef wkPage = toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView)));
+ WKPageSetPageUIClient(wkPage, &wkUIClient.base);
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp
index b85fc4300..20ab248a5 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp
@@ -22,7 +22,6 @@
#include "WebKitPrivate.h"
#include "WebKitURIResponsePrivate.h"
-#include <WebCore/GUniquePtrSoup.h>
#include <glib/gi18n-lib.h>
#include <wtf/text/CString.h>
@@ -47,8 +46,7 @@ enum {
PROP_STATUS_CODE,
PROP_CONTENT_LENGTH,
PROP_MIME_TYPE,
- PROP_SUGGESTED_FILENAME,
- PROP_HTTP_HEADERS
+ PROP_SUGGESTED_FILENAME
};
struct _WebKitURIResponsePrivate {
@@ -56,7 +54,6 @@ struct _WebKitURIResponsePrivate {
CString uri;
CString mimeType;
CString suggestedFilename;
- GUniquePtr<SoupMessageHeaders> httpHeaders;
};
WEBKIT_DEFINE_TYPE(WebKitURIResponse, webkit_uri_response, G_TYPE_OBJECT)
@@ -81,9 +78,6 @@ static void webkitURIResponseGetProperty(GObject* object, guint propId, GValue*
case PROP_SUGGESTED_FILENAME:
g_value_set_string(value, webkit_uri_response_get_suggested_filename(response));
break;
- case PROP_HTTP_HEADERS:
- g_value_set_boxed(value, webkit_uri_response_get_http_headers(response));
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
}
@@ -157,23 +151,6 @@ static void webkit_uri_response_class_init(WebKitURIResponseClass* responseClass
_("The suggested filename for the URI response"),
0,
WEBKIT_PARAM_READABLE));
-
- /**
- * WebKitURIResponse:http-headers:
- *
- * The HTTP headers of the response, or %NULL if the response is not an HTTP response.
- *
- * Since: 2.6
- */
- g_object_class_install_property(
- objectClass,
- PROP_HTTP_HEADERS,
- g_param_spec_boxed(
- "http-headers",
- _("HTTP Headers"),
- _("The The HTTP headers of the response"),
- SOUP_TYPE_MESSAGE_HEADERS,
- WEBKIT_PARAM_READABLE));
}
/**
@@ -260,31 +237,6 @@ const gchar* webkit_uri_response_get_suggested_filename(WebKitURIResponse* respo
return response->priv->suggestedFilename.data();
}
-/**
- * webkit_uri_response_get_http_headers:
- * @response: a #WebKitURIResponse
- *
- * Get the HTTP headers of a #WebKitURIResponse as a #SoupMessageHeaders.
- *
- * Returns: (transfer none): a #SoupMessageHeaders with the HTTP headers of @response
- * or %NULL if @response is not an HTTP response.
- * Since: 2.6
- */
-SoupMessageHeaders* webkit_uri_response_get_http_headers(WebKitURIResponse* response)
-{
- g_return_val_if_fail(WEBKIT_IS_URI_RESPONSE(response), nullptr);
-
- if (response->priv->httpHeaders)
- return response->priv->httpHeaders.get();
-
- if (!response->priv->resourceResponse.url().protocolIsInHTTPFamily())
- return nullptr;
-
- response->priv->httpHeaders.reset(soup_message_headers_new(SOUP_MESSAGE_HEADERS_RESPONSE));
- response->priv->resourceResponse.updateSoupMessageHeaders(response->priv->httpHeaders.get());
- return response->priv->httpHeaders.get();
-}
-
WebKitURIResponse* webkitURIResponseCreateForResourceResponse(const WebCore::ResourceResponse& resourceResponse)
{
WebKitURIResponse* uriResponse = WEBKIT_URI_RESPONSE(g_object_new(WEBKIT_TYPE_URI_RESPONSE, NULL));
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h
index 67316165f..d43eca13f 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h
@@ -25,7 +25,6 @@
#define WebKitURIResponse_h
#include <gio/gio.h>
-#include <libsoup/soup.h>
#include <webkit2/WebKitDefines.h>
G_BEGIN_DECLS
@@ -75,9 +74,6 @@ webkit_uri_response_get_mime_type (WebKitURIResponse *response);
WEBKIT_API const gchar *
webkit_uri_response_get_suggested_filename (WebKitURIResponse *response);
-WEBKIT_API SoupMessageHeaders *
-webkit_uri_response_get_http_headers (WebKitURIResponse *response);
-
G_END_DECLS
#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.cpp
index d66cb3ac7..6d8c68418 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.cpp
@@ -21,7 +21,6 @@
#include "WebKitURISchemeRequest.h"
#include "APIData.h"
-#include "WebKitPrivate.h"
#include "WebKitURISchemeRequestPrivate.h"
#include "WebKitWebContextPrivate.h"
#include "WebKitWebView.h"
@@ -29,7 +28,7 @@
#include <WebCore/GUniquePtrSoup.h>
#include <WebCore/ResourceError.h>
#include <libsoup/soup.h>
-#include <wtf/glib/GRefPtr.h>
+#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/CString.h>
using namespace WebKit;
@@ -70,7 +69,7 @@ struct _WebKitURISchemeRequestPrivate {
WEBKIT_DEFINE_TYPE(WebKitURISchemeRequest, webkit_uri_scheme_request, G_TYPE_OBJECT)
-static void webkit_uri_scheme_request_class_init(WebKitURISchemeRequestClass*)
+static void webkit_uri_scheme_request_class_init(WebKitURISchemeRequestClass* requestClass)
{
}
@@ -167,16 +166,16 @@ static void webkitURISchemeRequestReadCallback(GInputStream* inputStream, GAsync
}
WebKitURISchemeRequestPrivate* priv = request->priv;
- Ref<API::Data> webData = API::Data::create(reinterpret_cast<const unsigned char*>(priv->readBuffer), bytesRead);
+ RefPtr<API::Data> webData = API::Data::create(reinterpret_cast<const unsigned char*>(priv->readBuffer), bytesRead);
if (!priv->bytesRead) {
// First chunk read. In case of empty reply an empty API::Data is sent to the networking process.
WebCore::ResourceResponse response(WebCore::URL(WebCore::URL(), String::fromUTF8(priv->uri)), String::fromUTF8(priv->mimeType.data()),
- priv->streamLength, emptyString());
+ priv->streamLength, emptyString(), emptyString());
priv->webRequestManager->didReceiveResponse(priv->requestID, response);
- priv->webRequestManager->didLoadData(priv->requestID, webData.ptr());
+ priv->webRequestManager->didLoadData(priv->requestID, webData.get());
} else if (bytesRead || (!bytesRead && !priv->streamLength)) {
// Subsequent chunk read. We only send an empty API::Data to the networking process when stream length is unknown.
- priv->webRequestManager->didLoadData(priv->requestID, webData.ptr());
+ priv->webRequestManager->didLoadData(priv->requestID, webData.get());
}
if (!bytesRead) {
@@ -231,7 +230,7 @@ void webkit_uri_scheme_request_finish_error(WebKitURISchemeRequest* request, GEr
WebKitURISchemeRequestPrivate* priv = request->priv;
- WebCore::ResourceError resourceError(g_quark_to_string(error->domain), toWebCoreError(error->code), priv->uri.data(), String::fromUTF8(error->message));
+ WebCore::ResourceError resourceError(g_quark_to_string(error->domain), error->code, priv->uri.data(), String::fromUTF8(error->message));
priv->webRequestManager->didFailWithError(priv->requestID, resourceError);
webkitWebContextDidFinishLoadingCustomProtocol(priv->webContext, priv->requestID);
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitUserContent.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitUserContent.cpp
deleted file mode 100644
index b81ee2666..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitUserContent.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Copyright (C) 2014 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "WebKitUserContent.h"
-
-#include "WebKitPrivate.h"
-#include "WebKitUserContentPrivate.h"
-#include <wtf/text/CString.h>
-#include <wtf/text/StringBuilder.h>
-
-using namespace WebCore;
-
-/**
- * SECTION:WebKitUserContent
- * @short_description: Defines user content types which affect web pages.
- * @title: User content
- *
- * See also: #WebKitUserContentManager
- *
- * Since: 2.6
- */
-
-static inline UserContentInjectedFrames toUserContentInjectedFrames(WebKitUserContentInjectedFrames injectedFrames)
-{
- switch (injectedFrames) {
- case WEBKIT_USER_CONTENT_INJECT_TOP_FRAME:
- return InjectInTopFrameOnly;
- case WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES:
- return InjectInAllFrames;
- default:
- ASSERT_NOT_REACHED();
- return InjectInAllFrames;
- }
-}
-
-static inline UserStyleLevel toUserStyleLevel(WebKitUserStyleLevel styleLevel)
-{
- switch (styleLevel) {
- case WEBKIT_USER_STYLE_LEVEL_USER:
- return UserStyleUserLevel;
- case WEBKIT_USER_STYLE_LEVEL_AUTHOR:
- return UserStyleAuthorLevel;
- default:
- ASSERT_NOT_REACHED();
- return UserStyleAuthorLevel;
- }
-}
-
-static inline UserScriptInjectionTime toUserScriptInjectionTime(WebKitUserScriptInjectionTime injectionTime)
-{
- switch (injectionTime) {
- case WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_START:
- return InjectAtDocumentStart;
- case WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_END:
- return InjectAtDocumentEnd;
- default:
- ASSERT_NOT_REACHED();
- return InjectAtDocumentStart;
- }
-}
-
-static inline Vector<String> toStringVector(const char* const* strv)
-{
- if (!strv)
- return Vector<String>();
-
- Vector<String> result;
- for (auto str = strv; *str; ++str)
- result.append(String::fromUTF8(*str));
- return result;
-}
-
-struct _WebKitUserStyleSheet {
- _WebKitUserStyleSheet(const gchar* source, WebKitUserContentInjectedFrames injectedFrames, WebKitUserStyleLevel level, const char* const* whitelist, const char* const* blacklist)
- : userStyleSheet(std::make_unique<UserStyleSheet>(
- String::fromUTF8(source), URL { },
- toStringVector(whitelist), toStringVector(blacklist),
- toUserContentInjectedFrames(injectedFrames),
- toUserStyleLevel(level)))
- , referenceCount(1)
- {
- }
-
- std::unique_ptr<UserStyleSheet> userStyleSheet;
- int referenceCount;
-};
-
-G_DEFINE_BOXED_TYPE(WebKitUserStyleSheet, webkit_user_style_sheet, webkit_user_style_sheet_ref, webkit_user_style_sheet_unref)
-
-/**
- * webkit_user_style_sheet_ref:
- * @user_style_sheet: a #WebKitUserStyleSheet
- *
- * Atomically increments the reference count of @user_style_sheet by one.
- * This function is MT-safe and may be called from any thread.
- *
- * Returns: The passed #WebKitUserStyleSheet
- *
- * Since: 2.6
- */
-WebKitUserStyleSheet* webkit_user_style_sheet_ref(WebKitUserStyleSheet* userStyleSheet)
-{
- g_atomic_int_inc(&userStyleSheet->referenceCount);
- return userStyleSheet;
-}
-
-/**
- * webkit_user_style_sheet_unref:
- * @user_style_sheet: a #WebKitUserStyleSheet
- *
- * Atomically decrements the reference count of @user_style_sheet by one.
- * If the reference count drops to 0, all memory allocated by
- * #WebKitUserStyleSheet is released. This function is MT-safe and may be
- * called from any thread.
- *
- * Since: 2.6
- */
-void webkit_user_style_sheet_unref(WebKitUserStyleSheet* userStyleSheet)
-{
- if (g_atomic_int_dec_and_test(&userStyleSheet->referenceCount)) {
- userStyleSheet->~WebKitUserStyleSheet();
- fastFree(userStyleSheet);
- }
-}
-
-/**
- * webkit_user_style_sheet_new:
- * @source: Source code of the user style sheet.
- * @injected_frames: A #WebKitUserContentInjectedFrames value
- * @level: A #WebKitUserStyleLevel
- * @whitelist: (array zero-terminated=1) (allow-none): A whitelist of URI patterns or %NULL
- * @blacklist: (array zero-terminated=1) (allow-none): A blacklist of URI patterns or %NULL
- *
- * Creates a new user style sheet. Style sheets can be applied to some URIs
- * only by passing non-null values for @whitelist or @blacklist. Passing a
- * %NULL whitelist implies that all URIs are on the whitelist. The style
- * sheet is applied if an URI matches the whitelist and not the blacklist.
- * URI patterns must be of the form `[protocol]://[host]/[path]`, where the
- * *host* and *path* components can contain the wildcard character (`*`) to
- * represent zero or more other characters.
- *
- * Returns: A new #WebKitUserStyleSheet
- *
- * Since: 2.6
- */
-WebKitUserStyleSheet* webkit_user_style_sheet_new(const gchar* source, WebKitUserContentInjectedFrames injectedFrames, WebKitUserStyleLevel level, const char* const* whitelist, const char* const* blacklist)
-{
- g_return_val_if_fail(source, nullptr);
- WebKitUserStyleSheet* userStyleSheet = static_cast<WebKitUserStyleSheet*>(fastMalloc(sizeof(WebKitUserStyleSheet)));
- new (userStyleSheet) WebKitUserStyleSheet(source, injectedFrames, level, whitelist, blacklist);
- return userStyleSheet;
-}
-
-const UserStyleSheet& webkitUserStyleSheetGetUserStyleSheet(WebKitUserStyleSheet* userStyleSheet)
-{
- return *userStyleSheet->userStyleSheet;
-}
-
-struct _WebKitUserScript {
- _WebKitUserScript(const gchar* source, WebKitUserContentInjectedFrames injectedFrames, WebKitUserScriptInjectionTime injectionTime, const gchar* const* whitelist, const gchar* const* blacklist)
- : userScript(adoptRef(new API::UserScript(UserScript {
- String::fromUTF8(source), URL { },
- toStringVector(whitelist), toStringVector(blacklist),
- toUserScriptInjectionTime(injectionTime),
- toUserContentInjectedFrames(injectedFrames) })))
- , referenceCount(1)
- {
- }
-
- RefPtr<API::UserScript> userScript;
- int referenceCount;
-};
-
-G_DEFINE_BOXED_TYPE(WebKitUserScript, webkit_user_script, webkit_user_script_ref, webkit_user_script_unref)
-
-/**
- * webkit_user_script_ref:
- * @user_script: a #WebKitUserScript
- *
- * Atomically increments the reference count of @user_script by one.
- * This function is MT-safe and may be called from any thread.
- *
- * Returns: The passed #WebKitUserScript
- *
- * Since: 2.6
- */
-WebKitUserScript* webkit_user_script_ref(WebKitUserScript* userScript)
-{
- g_atomic_int_inc(&userScript->referenceCount);
- return userScript;
-}
-
-/**
- * webkit_user_script_unref:
- * @user_script: a #WebKitUserScript
- *
- * Atomically decrements the reference count of @user_script by one.
- * If the reference count drops to 0, all memory allocated by
- * #WebKitUserScript is released. This function is MT-safe and may be called
- * from any thread.
- *
- * Since: 2.6
- */
-void webkit_user_script_unref(WebKitUserScript* userScript)
-{
- if (g_atomic_int_dec_and_test(&userScript->referenceCount)) {
- userScript->~WebKitUserScript();
- fastFree(userScript);
- }
-}
-
-/**
- * webkit_user_script_new:
- * @source: Source code of the user script.
- * @injected_frames: A #WebKitUserContentInjectedFrames value
- * @injection_time: A #WebKitUserScriptInjectionTime value
- * @whitelist: (array zero-terminated=1) (allow-none): A whitelist of URI patterns or %NULL
- * @blacklist: (array zero-terminated=1) (allow-none): A blacklist of URI patterns or %NULL
- *
- * Creates a new user script. Scripts can be applied to some URIs
- * only by passing non-null values for @whitelist or @blacklist. Passing a
- * %NULL whitelist implies that all URIs are on the whitelist. The script
- * is applied if an URI matches the whitelist and not the blacklist.
- * URI patterns must be of the form `[protocol]://[host]/[path]`, where the
- * *host* and *path* components can contain the wildcard character (`*`) to
- * represent zero or more other characters.
- *
- * Returns: A new #WebKitUserScript
- *
- * Since: 2.6
- */
-WebKitUserScript* webkit_user_script_new(const gchar* source, WebKitUserContentInjectedFrames injectedFrames, WebKitUserScriptInjectionTime injectionTime, const gchar* const* whitelist, const gchar* const* blacklist)
-{
- g_return_val_if_fail(source, nullptr);
- WebKitUserScript* userScript = static_cast<WebKitUserScript*>(fastMalloc(sizeof(WebKitUserScript)));
- new (userScript) WebKitUserScript(source, injectedFrames, injectionTime, whitelist, blacklist);
- return userScript;
-}
-
-API::UserScript& webkitUserScriptGetUserScript(WebKitUserScript* userScript)
-{
- return *userScript->userScript;
-}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitUserContent.h b/Source/WebKit2/UIProcess/API/gtk/WebKitUserContent.h
deleted file mode 100644
index c3f1ed569..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitUserContent.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2014 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
-#error "Only <webkit2/webkit2.h> can be included directly."
-#endif
-
-#ifndef WebKitUserContent_h
-#define WebKitUserContent_h
-
-#include <glib-object.h>
-#include <webkit2/WebKitDefines.h>
-
-G_BEGIN_DECLS
-
-/**
- * WebKitUserContentInjectedFrames:
- * @WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES: Insert the user style
- * sheet in all the frames loaded by the web view, including
- * nested frames. This is the default.
- * @WEBKIT_USER_CONTENT_INJECT_TOP_FRAME: Insert the user style
- * sheet *only* in the top-level frame loaded by the web view,
- * and *not* in the nested frames.
- *
- * Specifies in which frames user style sheets are to be inserted in.
- *
- * Since: 2.6
- */
-typedef enum {
- WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES,
- WEBKIT_USER_CONTENT_INJECT_TOP_FRAME,
-} WebKitUserContentInjectedFrames;
-
-/**
- * WebKitUserStyleLevel:
- * @WEBKIT_USER_STYLE_LEVEL_USER: The style sheet is an user style sheet,
- * its contents always override other style sheets. This is the default.
- * @WEBKIT_USER_STYLE_LEVEL_AUTHOR: The style sheet will be treated as if
- * it was provided by the loaded documents. That means other user style
- * sheets may still override it.
- *
- * Specifies how to treat an user style sheet.
- *
- * Since: 2.6
- */
-typedef enum {
- WEBKIT_USER_STYLE_LEVEL_USER,
- WEBKIT_USER_STYLE_LEVEL_AUTHOR,
-} WebKitUserStyleLevel;
-
-#define WEBKIT_TYPE_USER_STYLE_SHEET (webkit_user_style_sheet_get_type())
-
-typedef struct _WebKitUserStyleSheet WebKitUserStyleSheet;
-
-WEBKIT_API GType
-webkit_user_style_sheet_get_type (void);
-
-WEBKIT_API WebKitUserStyleSheet *
-webkit_user_style_sheet_ref (WebKitUserStyleSheet *user_style_sheet);
-
-WEBKIT_API void
-webkit_user_style_sheet_unref (WebKitUserStyleSheet *user_style_sheet);
-
-WEBKIT_API WebKitUserStyleSheet *
-webkit_user_style_sheet_new (const gchar *source,
- WebKitUserContentInjectedFrames injected_frames,
- WebKitUserStyleLevel level,
- const gchar* const *whitelist,
- const gchar* const *blacklist);
-
-/**
- * WebKitUserScriptInjectionTime:
- * @WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_START: Insert the code of the user
- * script at the beginning of loaded documents. This is the default.
- * @WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_END: Insert the code of the user
- * script at the end of the loaded documents.
- *
- * Specifies at which place of documents an user script will be inserted.
- *
- * Since: 2.6
- */
-typedef enum {
- WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_START,
- WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_END,
-} WebKitUserScriptInjectionTime;
-
-#define WEBKIT_TYPE_USER_SCRIPT (webkit_user_script_get_type())
-
-typedef struct _WebKitUserScript WebKitUserScript;
-
-WEBKIT_API GType
-webkit_user_script_get_type (void);
-
-WEBKIT_API WebKitUserScript *
-webkit_user_script_ref (WebKitUserScript *user_script);
-
-WEBKIT_API void
-webkit_user_script_unref (WebKitUserScript *user_script);
-
-WEBKIT_API WebKitUserScript *
-webkit_user_script_new (const gchar *source,
- WebKitUserContentInjectedFrames injected_frames,
- WebKitUserScriptInjectionTime injection_time,
- const gchar* const *whitelist,
- const gchar* const *blacklist);
-
-G_END_DECLS
-
-#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManager.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManager.cpp
deleted file mode 100644
index 79d8f64e9..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManager.cpp
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Copyright (C) 2014 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "WebKitUserContentManager.h"
-
-#include "APISerializedScriptValue.h"
-#include "WebKitJavascriptResultPrivate.h"
-#include "WebKitPrivate.h"
-#include "WebKitUserContentManagerPrivate.h"
-#include "WebKitUserContentPrivate.h"
-#include "WebKitWebContextPrivate.h"
-#include "WebScriptMessageHandler.h"
-#include <wtf/glib/GRefPtr.h>
-
-using namespace WebCore;
-using namespace WebKit;
-
-struct _WebKitUserContentManagerPrivate {
- _WebKitUserContentManagerPrivate()
- : userContentController(adoptRef(new WebUserContentControllerProxy))
- {
- }
-
- RefPtr<WebUserContentControllerProxy> userContentController;
-};
-
-/**
- * SECTION:WebKitUserContentManager
- * @short_description: Manages user-defined content which affects web pages.
- * @title: WebKitUserContentManager
- *
- * Using a #WebKitUserContentManager user CSS style sheets can be set to
- * be injected in the web pages loaded by a #WebKitWebView, by
- * webkit_user_content_manager_add_style_sheet().
- *
- * To use a #WebKitUserContentManager, it must be created using
- * webkit_user_content_manager_new(), and then passed to
- * webkit_web_view_new_with_user_content_manager(). User style
- * sheets can be created with webkit_user_style_sheet_new().
- *
- * User style sheets can be added and removed at any time, but
- * they will affect the web pages loaded afterwards.
- *
- * Since: 2.6
- */
-
-WEBKIT_DEFINE_TYPE(WebKitUserContentManager, webkit_user_content_manager, G_TYPE_OBJECT)
-
-enum {
- SCRIPT_MESSAGE_RECEIVED,
-
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0, };
-
-static void webkit_user_content_manager_class_init(WebKitUserContentManagerClass* klass)
-{
- GObjectClass* gObjectClass = G_OBJECT_CLASS(klass);
-
- /**
- * WebKitUserContentManager::script-message-received:
- * @manager: the #WebKitUserContentManager
- * @js_result: the #WebKitJavascriptResult holding the value received from the JavaScript world.
- *
- * This signal is emitted when JavaScript in a web view calls
- * <code>window.webkit.messageHandlers.&lt;name&gt;.postMessage()</code>, after registering
- * <code>&lt;name&gt;</code> using
- * webkit_user_content_manager_register_script_message_handler()
- *
- * Since: 2.8
- */
- signals[SCRIPT_MESSAGE_RECEIVED] =
- g_signal_new(
- "script-message-received",
- G_TYPE_FROM_CLASS(gObjectClass),
- static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED),
- 0, nullptr, nullptr,
- g_cclosure_marshal_VOID__BOXED,
- G_TYPE_NONE, 1,
- WEBKIT_TYPE_JAVASCRIPT_RESULT);
-}
-
-/**
- * webkit_user_content_manager_new:
- *
- * Creates a new user content manager.
- *
- * Returns: A #WebKitUserContentManager
- *
- * Since: 2.6
- */
-WebKitUserContentManager* webkit_user_content_manager_new()
-{
- return WEBKIT_USER_CONTENT_MANAGER(g_object_new(WEBKIT_TYPE_USER_CONTENT_MANAGER, nullptr));
-}
-
-/**
- * webkit_user_content_manager_add_style_sheet:
- * @manager: A #WebKitUserContentManager
- * @stylesheet: A #WebKitUserStyleSheet
- *
- * Adds a #WebKitUserStyleSheet to the given #WebKitUserContentManager.
- * The same #WebKitUserStyleSheet can be reused with multiple
- * #WebKitUserContentManager instances.
- *
- * Since: 2.6
- */
-void webkit_user_content_manager_add_style_sheet(WebKitUserContentManager* manager, WebKitUserStyleSheet* styleSheet)
-{
- g_return_if_fail(WEBKIT_IS_USER_CONTENT_MANAGER(manager));
- g_return_if_fail(styleSheet);
- manager->priv->userContentController->addUserStyleSheet(webkitUserStyleSheetGetUserStyleSheet(styleSheet));
-}
-
-/**
- * webkit_user_content_manager_remove_all_style_sheets:
- * @manager: A #WebKitUserContentManager
- *
- * Removes all user style sheets from the given #WebKitUserContentManager.
- *
- * Since: 2.6
- */
-void webkit_user_content_manager_remove_all_style_sheets(WebKitUserContentManager* manager)
-{
- g_return_if_fail(WEBKIT_IS_USER_CONTENT_MANAGER(manager));
- manager->priv->userContentController->removeAllUserStyleSheets();
-}
-
-/**
- * webkit_user_content_manager_add_script:
- * @manager: A #WebKitUserContentManager
- * @script: A #WebKitUserScript
- *
- * Adds a #WebKitUserScript to the given #WebKitUserContentManager.
- * The same #WebKitUserScript can be reused with multiple
- * #WebKitUserContentManager instances.
- *
- * Since: 2.6
- */
-void webkit_user_content_manager_add_script(WebKitUserContentManager* manager, WebKitUserScript* script)
-{
- g_return_if_fail(WEBKIT_IS_USER_CONTENT_MANAGER(manager));
- g_return_if_fail(script);
- manager->priv->userContentController->addUserScript(webkitUserScriptGetUserScript(script));
-}
-
-/**
- * webkit_user_content_manager_remove_all_scripts:
- * @manager: A #WebKitUserContentManager
- *
- * Removes all user scripts from the given #WebKitUserContentManager
- *
- * Since: 2.6
- */
-void webkit_user_content_manager_remove_all_scripts(WebKitUserContentManager* manager)
-{
- g_return_if_fail(WEBKIT_IS_USER_CONTENT_MANAGER(manager));
- manager->priv->userContentController->removeAllUserScripts();
-}
-
-class ScriptMessageClientGtk final : public WebScriptMessageHandler::Client {
-public:
- ScriptMessageClientGtk(WebKitUserContentManager* manager, const char* handlerName)
- : m_handlerName(g_quark_from_string(handlerName))
- , m_manager(manager)
- {
- }
-
- virtual void didPostMessage(WebPageProxy& page, WebFrameProxy&, const SecurityOriginData&, WebCore::SerializedScriptValue& serializedScriptValue)
- {
- WebKitJavascriptResult* jsResult = webkitJavascriptResultCreate(WEBKIT_WEB_VIEW(page.viewWidget()), serializedScriptValue);
- g_signal_emit(m_manager, signals[SCRIPT_MESSAGE_RECEIVED], m_handlerName, jsResult);
- webkit_javascript_result_unref(jsResult);
- }
-
- virtual ~ScriptMessageClientGtk() { }
-
-private:
- GQuark m_handlerName;
- WebKitUserContentManager* m_manager;
-};
-
-/**
- * webkit_user_content_manager_register_script_message_handler:
- * @manager: A #WebKitUserContentManager
- * @name: Name of the script message channel
- *
- * Registers a new user script message handler. After it is registered,
- * scripts can use `window.webkit.messageHandlers.&lt;name&gt;.postMessage(value)`
- * to send messages. Those messages are received by connecting handlers
- * to the #WebKitUserContentManager::script-message-received signal. The
- * handler name is used as the detail of the signal. To avoid race
- * conditions between registering the handler name, and starting to
- * receive the signals, it is recommended to connect to the signal
- * *before* registering the handler name:
- *
- * <informalexample><programlisting>
- * WebKitWebView *view = webkit_web_view_new ();
- * WebKitUserContentManager *manager = webkit_web_view_get_user_content_manager ();
- * g_signal_connect (manager, "script-message-received::foobar",
- * G_CALLBACK (handle_script_message), NULL);
- * webkit_user_content_manager_register_script_message_handler (manager, "foobar");
- * </programlisting></informalexample>
- *
- * Registering a script message handler will fail if the requested
- * name has been already registered before.
- *
- * Returns: %TRUE if message handler was registered successfully, or %FALSE otherwise.
- *
- * Since: 2.8
- */
-gboolean webkit_user_content_manager_register_script_message_handler(WebKitUserContentManager* manager, const char* name)
-{
- g_return_val_if_fail(WEBKIT_IS_USER_CONTENT_MANAGER(manager), FALSE);
- g_return_val_if_fail(name, FALSE);
-
- RefPtr<WebScriptMessageHandler> handler =
- WebScriptMessageHandler::create(std::make_unique<ScriptMessageClientGtk>(manager, name), String::fromUTF8(name));
- return manager->priv->userContentController->addUserScriptMessageHandler(handler.get());
-}
-
-/**
- * webkit_user_content_manager_unregister_script_message_handler:
- * @manager: A #WebKitUserContentManager
- * @name: Name of the script message channel
- *
- * Unregisters a previously registered message handler.
- *
- * Note that this does *not* disconnect handlers for the
- * #WebKitUserContentManager::script-message-received signal,
- * they will be kept connected, but the signal will not be emitted
- * unless the handler name is registered again.
- *
- * See also webkit_user_content_manager_register_script_message_handler()
- *
- * Since: 2.8
- */
-void webkit_user_content_manager_unregister_script_message_handler(WebKitUserContentManager* manager, const char* name)
-{
- g_return_if_fail(WEBKIT_IS_USER_CONTENT_MANAGER(manager));
- g_return_if_fail(name);
- manager->priv->userContentController->removeUserMessageHandlerForName(String::fromUTF8(name));
-}
-
-WebUserContentControllerProxy* webkitUserContentManagerGetUserContentControllerProxy(WebKitUserContentManager* manager)
-{
- return manager->priv->userContentController.get();
-}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManager.h b/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManager.h
deleted file mode 100644
index 86d24a113..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManager.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2014 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
-#error "Only <webkit2/webkit2.h> can be included directly."
-#endif
-
-#ifndef WebKitUserContentManager_h
-#define WebKitUserContentManager_h
-
-#include <glib-object.h>
-#include <webkit2/WebKitDefines.h>
-#include <webkit2/WebKitUserContent.h>
-
-G_BEGIN_DECLS
-
-#define WEBKIT_TYPE_USER_CONTENT_MANAGER (webkit_user_content_manager_get_type())
-#define WEBKIT_USER_CONTENT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_USER_CONTENT_MANAGER, WebKitUserContentManager))
-#define WEBKIT_IS_USER_CONTENT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_USER_CONTENT_MANAGER))
-#define WEBKIT_USER_CONTENT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_USER_CONTENT_MANAGER, WebKitUserContentManagerClass))
-#define WEBKIT_IS_USER_CONTENT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_USER_CONTENT_MANAGER))
-#define WEBKIT_USER_CONTENT_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_USER_CONTENT_MANAGER, WebKitUserContentManagerClass))
-
-typedef struct _WebKitUserContentManager WebKitUserContentManager;
-typedef struct _WebKitUserContentManagerClass WebKitUserContentManagerClass;
-typedef struct _WebKitUserContentManagerPrivate WebKitUserContentManagerPrivate;
-
-
-struct _WebKitUserContentManager {
- GObject parent;
-
- /*< private >*/
- WebKitUserContentManagerPrivate *priv;
-};
-
-struct _WebKitUserContentManagerClass {
- GObjectClass parent_class;
-
- void (*_webkit_reserved0) (void);
- void (*_webkit_reserved1) (void);
- void (*_webkit_reserved2) (void);
- void (*_webkit_reserved3) (void);
-};
-
-
-WEBKIT_API GType
-webkit_user_content_manager_get_type (void);
-
-WEBKIT_API WebKitUserContentManager *
-webkit_user_content_manager_new (void);
-
-WEBKIT_API void
-webkit_user_content_manager_add_style_sheet (WebKitUserContentManager *manager,
- WebKitUserStyleSheet *stylesheet);
-WEBKIT_API void
-webkit_user_content_manager_remove_all_style_sheets (WebKitUserContentManager *manager);
-
-WEBKIT_API gboolean
-webkit_user_content_manager_register_script_message_handler (WebKitUserContentManager *manager,
- const gchar *name);
-WEBKIT_API void
-webkit_user_content_manager_unregister_script_message_handler (WebKitUserContentManager *manager,
- const gchar *name);
-
-WEBKIT_API void
-webkit_user_content_manager_add_script (WebKitUserContentManager *manager,
- WebKitUserScript *script);
-
-WEBKIT_API void
-webkit_user_content_manager_remove_all_scripts (WebKitUserContentManager *manager);
-
-G_END_DECLS
-
-#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManagerPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManagerPrivate.h
deleted file mode 100644
index f791a5357..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManagerPrivate.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2014 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef WebKitUserContentManagerPrivate_h
-#define WebKitUserContentManagerPrivate_h
-
-#include "WebKitUserContentManager.h"
-#include "WebUserContentControllerProxy.h"
-
-WebKit::WebUserContentControllerProxy* webkitUserContentManagerGetUserContentControllerProxy(WebKitUserContentManager*);
-
-#endif // WebKitUserContentManagerPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentPrivate.h
deleted file mode 100644
index e6a295948..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitUserContentPrivate.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2014 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef WebKitUserContentPrivate_h
-#define WebKitUserContentPrivate_h
-
-#include "APIUserScript.h"
-#include "WebKitUserContent.h"
-#include <WebCore/UserScript.h>
-#include <WebCore/UserStyleSheet.h>
-
-API::UserScript& webkitUserScriptGetUserScript(WebKitUserScript*);
-const WebCore::UserStyleSheet& webkitUserStyleSheetGetUserStyleSheet(WebKitUserStyleSheet*);
-
-#endif // WebKitUserContentPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitUserMediaPermissionRequest.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitUserMediaPermissionRequest.cpp
deleted file mode 100644
index 25038a448..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitUserMediaPermissionRequest.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (C) 2014 Igalia S.L
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "WebKitUserMediaPermissionRequest.h"
-
-#include "UserMediaPermissionRequestProxy.h"
-#include "WebKitPermissionRequest.h"
-#include "WebKitUserMediaPermissionRequestPrivate.h"
-#include <glib/gi18n-lib.h>
-
-using namespace WebKit;
-
-/**
- * SECTION: WebKitUserMediaPermissionRequest
- * @Short_description: A permission request for accessing user's audio/video devices.
- * @Title: WebKitUserMediaPermissionRequest
- * @See_also: #WebKitPermissionRequest, #WebKitWebView
- *
- * WebKitUserMediaPermissionRequest represents a request for
- * permission to decide whether WebKit should be allowed to access the user's
- * audio and video source devices when requested throught the getUserMedia API.
- *
- * When a WebKitUserMediaPermissionRequest is not handled by the user,
- * it is denied by default.
- *
- * Since: 2.8
- */
-
-enum {
- PROP_0,
- PROP_IS_FOR_AUDIO_DEVICE,
- PROP_IS_FOR_VIDEO_DEVICE
-};
-
-static void webkit_permission_request_interface_init(WebKitPermissionRequestIface*);
-
-struct _WebKitUserMediaPermissionRequestPrivate {
- RefPtr<UserMediaPermissionRequestProxy> request;
- bool madeDecision;
-};
-
-WEBKIT_DEFINE_TYPE_WITH_CODE(
- WebKitUserMediaPermissionRequest, webkit_user_media_permission_request, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE(WEBKIT_TYPE_PERMISSION_REQUEST, webkit_permission_request_interface_init))
-
-static void webkitUserMediaPermissionRequestAllow(WebKitPermissionRequest* request)
-{
- ASSERT(WEBKIT_IS_USER_MEDIA_PERMISSION_REQUEST(request));
-
- WebKitUserMediaPermissionRequestPrivate* priv = WEBKIT_USER_MEDIA_PERMISSION_REQUEST(request)->priv;
-
- // Only one decision at a time.
- if (priv->madeDecision)
- return;
-
- priv->madeDecision = true;
- priv->request->allow();
-}
-
-static void webkitUserMediaPermissionRequestDeny(WebKitPermissionRequest* request)
-{
- ASSERT(WEBKIT_IS_USER_MEDIA_PERMISSION_REQUEST(request));
-
- WebKitUserMediaPermissionRequestPrivate* priv = WEBKIT_USER_MEDIA_PERMISSION_REQUEST(request)->priv;
-
- // Only one decision at a time.
- if (priv->madeDecision)
- return;
-
- priv->madeDecision = true;
- priv->request->deny();
-}
-
-static void webkit_permission_request_interface_init(WebKitPermissionRequestIface* iface)
-{
- iface->allow = webkitUserMediaPermissionRequestAllow;
- iface->deny = webkitUserMediaPermissionRequestDeny;
-}
-
-static void webkitUserMediaPermissionRequestDispose(GObject* object)
-{
- // Default behaviour when no decision has been made is denying the request.
- webkitUserMediaPermissionRequestDeny(WEBKIT_PERMISSION_REQUEST(object));
- G_OBJECT_CLASS(webkit_user_media_permission_request_parent_class)->dispose(object);
-}
-
-/**
- * webkit_user_media_permission_is_for_audio_device:
- * @request: a #WebKitUserMediaPermissionRequest
- *
- * Returns: %TRUE if access to an audio device was requested.
- *
- * Since: 2.8
- */
-gboolean webkit_user_media_permission_is_for_audio_device(WebKitUserMediaPermissionRequest* request)
-{
- g_return_val_if_fail(request->priv->request, FALSE);
- return request->priv->request->requiresAudio();
-}
-
-/**
- * webkit_user_media_permission_is_for_video_device:
- * @request: a #WebKitUserMediaPermissionRequest
- *
- * Returns: %TRUE if access to a video device was requested.
- *
- * Since: 2.8
- */
-gboolean webkit_user_media_permission_is_for_video_device(WebKitUserMediaPermissionRequest* request)
-{
- g_return_val_if_fail(request->priv->request, FALSE);
- return request->priv->request->requiresVideo();
-}
-
-static void webkitUserMediaPermissionRequestGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec)
-{
- WebKitUserMediaPermissionRequest* request = WEBKIT_USER_MEDIA_PERMISSION_REQUEST(object);
-
- switch (propId) {
- case PROP_IS_FOR_AUDIO_DEVICE:
- g_value_set_boolean(value, webkit_user_media_permission_is_for_audio_device(request));
- break;
- case PROP_IS_FOR_VIDEO_DEVICE:
- g_value_set_boolean(value, webkit_user_media_permission_is_for_video_device(request));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
- }
-}
-
-static void webkit_user_media_permission_request_class_init(WebKitUserMediaPermissionRequestClass* klass)
-{
- GObjectClass* objectClass = G_OBJECT_CLASS(klass);
- objectClass->dispose = webkitUserMediaPermissionRequestDispose;
- objectClass->get_property = webkitUserMediaPermissionRequestGetProperty;
-
- /**
- * WebKitUserPermissionRequest:is-for-audio-device:
- *
- * Wether the media device to which the permission was requested has a microphone or not.
- *
- * Since: 2.8
- */
- g_object_class_install_property(objectClass, PROP_IS_FOR_AUDIO_DEVICE,
- g_param_spec_boolean("is-for-audio-device", _("Is for audio device"),
- _("Wether the media device to which the permission was requested has a microphone or not."),
- FALSE,
- WEBKIT_PARAM_READABLE));
-
- /**
- * WebKitUserPermissionRequest:is-for-video-device:
- *
- * Wether the media device to which the permission was requested has a video capture capability or not.
- *
- * Since: 2.8
- */
- g_object_class_install_property(objectClass, PROP_IS_FOR_VIDEO_DEVICE,
- g_param_spec_boolean("is-for-video-device", _("Is for video device"),
- _("Wether the media device to which the permission was requested has a video capture capability or not."),
- FALSE,
- WEBKIT_PARAM_READABLE));
-}
-
-WebKitUserMediaPermissionRequest* webkitUserMediaPermissionRequestCreate(UserMediaPermissionRequestProxy& request, API::SecurityOrigin& securityOrigin)
-{
- WebKitUserMediaPermissionRequest* usermediaPermissionRequest = WEBKIT_USER_MEDIA_PERMISSION_REQUEST(g_object_new(WEBKIT_TYPE_USER_MEDIA_PERMISSION_REQUEST, nullptr));
-
- // FIXME: store SecurityOrigin
- UNUSED_PARAM(securityOrigin);
-
- usermediaPermissionRequest->priv->request = &request;
- return usermediaPermissionRequest;
-}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitUserMediaPermissionRequest.h b/Source/WebKit2/UIProcess/API/gtk/WebKitUserMediaPermissionRequest.h
deleted file mode 100644
index ad382b1ba..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitUserMediaPermissionRequest.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2014 Igalia S.L
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
-#error "Only <webkit2/webkit2.h> can be included directly."
-#endif
-
-#ifndef WebKitUserMediaPermissionRequest_h
-#define WebKitUserMediaPermissionRequest_h
-
-#include <glib-object.h>
-#include <webkit2/WebKitDefines.h>
-
-G_BEGIN_DECLS
-
-#define WEBKIT_TYPE_USER_MEDIA_PERMISSION_REQUEST (webkit_user_media_permission_request_get_type())
-#define WEBKIT_USER_MEDIA_PERMISSION_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_USER_MEDIA_PERMISSION_REQUEST, WebKitUserMediaPermissionRequest))
-#define WEBKIT_USER_MEDIA_PERMISSION_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_USER_MEDIA_PERMISSION_REQUEST, WebKitUserMediaPermissionRequestClass))
-#define WEBKIT_IS_USER_MEDIA_PERMISSION_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_USER_MEDIA_PERMISSION_REQUEST))
-#define WEBKIT_IS_USER_MEDIA_PERMISSION_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_USER_MEDIA_PERMISSION_REQUEST))
-#define WEBKIT_USER_MEDIA_PERMISSION_REQUEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_USER_MEDIA_PERMISSION_REQUEST, WebKitUserMediaPermissionRequestClass))
-
-typedef struct _WebKitUserMediaPermissionRequest WebKitUserMediaPermissionRequest;
-typedef struct _WebKitUserMediaPermissionRequestClass WebKitUserMediaPermissionRequestClass;
-typedef struct _WebKitUserMediaPermissionRequestPrivate WebKitUserMediaPermissionRequestPrivate;
-
-struct _WebKitUserMediaPermissionRequest {
- GObject parent;
-
- /*< private >*/
- WebKitUserMediaPermissionRequestPrivate *priv;
-};
-
-struct _WebKitUserMediaPermissionRequestClass {
- GObjectClass parent_class;
-
- void (*_webkit_reserved0) (void);
- void (*_webkit_reserved1) (void);
- void (*_webkit_reserved2) (void);
- void (*_webkit_reserved3) (void);
-};
-
-WEBKIT_API GType
-webkit_user_media_permission_request_get_type (void);
-
-WEBKIT_API gboolean
-webkit_user_media_permission_is_for_audio_device (WebKitUserMediaPermissionRequest *request);
-
-WEBKIT_API gboolean
-webkit_user_media_permission_is_for_video_device (WebKitUserMediaPermissionRequest *request);
-
-G_END_DECLS
-
-#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitUserMediaPermissionRequestPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitUserMediaPermissionRequestPrivate.h
deleted file mode 100644
index a729d9112..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitUserMediaPermissionRequestPrivate.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2014 Igalia S.L
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef WebKitUserMediaPermissionRequestPrivate_h
-#define WebKitUserMediaPermissionRequestPrivate_h
-
-#include "WebKitPrivate.h"
-#include "WebKitUserMediaPermissionRequest.h"
-
-class SecurityOrigin;
-
-WebKitUserMediaPermissionRequest* webkitUserMediaPermissionRequestCreate(WebKit::UserMediaPermissionRequestProxy&, API::SecurityOrigin&);
-
-#endif // WebKitUserMediaPermissionRequestPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitVersion.h.in b/Source/WebKit2/UIProcess/API/gtk/WebKitVersion.h.in
index 1364bf602..b1c5af45d 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitVersion.h.in
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitVersion.h.in
@@ -35,7 +35,7 @@ G_BEGIN_DECLS
* application compile time, rather than from the library linked
* against at application run time.
*/
-#define WEBKIT_MAJOR_VERSION (@PROJECT_VERSION_MAJOR@)
+#define WEBKIT_MAJOR_VERSION (@WEBKIT_MAJOR_VERSION@)
/**
* WEBKIT_MINOR_VERSION:
@@ -44,7 +44,7 @@ G_BEGIN_DECLS
* application compile time, rather than from the library linked
* against at application run time.
*/
-#define WEBKIT_MINOR_VERSION (@PROJECT_VERSION_MINOR@)
+#define WEBKIT_MINOR_VERSION (@WEBKIT_MINOR_VERSION@)
/**
* WEBKIT_MICRO_VERSION:
@@ -53,7 +53,7 @@ G_BEGIN_DECLS
* application compile time, rather than from the library linked
* against at application run time.
*/
-#define WEBKIT_MICRO_VERSION (@PROJECT_VERSION_MICRO@)
+#define WEBKIT_MICRO_VERSION (@WEBKIT_MICRO_VERSION@)
/**
* WEBKIT_CHECK_VERSION:
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
index 9e8d8a6e2..1528324ba 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
@@ -20,48 +20,39 @@
#include "config.h"
#include "WebKitWebContext.h"
-#include "APIDownloadClient.h"
-#include "APIPageConfiguration.h"
-#include "APIProcessPoolConfiguration.h"
#include "APIString.h"
-#include "TextChecker.h"
-#include "TextCheckerState.h"
#include "WebBatteryManagerProxy.h"
#include "WebCertificateInfo.h"
#include "WebCookieManagerProxy.h"
#include "WebGeolocationManagerProxy.h"
#include "WebKitBatteryProvider.h"
+#include "WebKitCertificateInfoPrivate.h"
#include "WebKitCookieManagerPrivate.h"
#include "WebKitDownloadClient.h"
#include "WebKitDownloadPrivate.h"
#include "WebKitFaviconDatabasePrivate.h"
#include "WebKitGeolocationProvider.h"
#include "WebKitInjectedBundleClient.h"
-#include "WebKitNotificationProvider.h"
#include "WebKitPluginPrivate.h"
#include "WebKitPrivate.h"
#include "WebKitRequestManagerClient.h"
#include "WebKitSecurityManagerPrivate.h"
-#include "WebKitSettingsPrivate.h"
+#include "WebKitTextChecker.h"
#include "WebKitURISchemeRequestPrivate.h"
-#include "WebKitUserContentManagerPrivate.h"
#include "WebKitWebContextPrivate.h"
#include "WebKitWebViewBasePrivate.h"
-#include "WebKitWebViewPrivate.h"
-#include "WebKitWebsiteDataManagerPrivate.h"
-#include "WebNotificationManagerProxy.h"
+#include "WebKitWebViewGroupPrivate.h"
+#include "WebResourceCacheManagerProxy.h"
#include <WebCore/FileSystem.h>
#include <WebCore/IconDatabase.h>
#include <WebCore/Language.h>
-#include <glib/gi18n-lib.h>
#include <libintl.h>
-#include <memory>
#include <wtf/HashMap.h>
-#include <wtf/NeverDestroyed.h>
+#include <wtf/OwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
-#include <wtf/glib/GRefPtr.h>
-#include <wtf/glib/GUniquePtr.h>
+#include <wtf/gobject/GRefPtr.h>
+#include <wtf/gobject/GUniquePtr.h>
#include <wtf/text/CString.h>
using namespace WebKit;
@@ -91,23 +82,9 @@ using namespace WebKit;
* You can use webkit_web_context_register_uri_scheme() to register
* custom URI schemes, and manage several other settings.
*
- * TLS certificate validation failure is now treated as a transport
- * error by default. To handle TLS failures differently, you can
- * connect to #WebKitWebView::load-failed-with-tls-errors.
- * Alternatively, you can use webkit_web_context_set_tls_errors_policy()
- * to set the policy %WEBKIT_TLS_ERRORS_POLICY_IGNORE; however, this is
- * not appropriate for Internet applications.
- *
*/
enum {
- PROP_0,
-
- PROP_LOCAL_STORAGE_DIRECTORY,
- PROP_WEBSITE_DATA_MANAGER
-};
-
-enum {
DOWNLOAD_STARTED,
INITIALIZE_WEB_EXTENSIONS,
@@ -157,8 +134,7 @@ typedef HashMap<String, RefPtr<WebKitURISchemeHandler> > URISchemeHandlerMap;
typedef HashMap<uint64_t, GRefPtr<WebKitURISchemeRequest> > URISchemeRequestMap;
struct _WebKitWebContextPrivate {
- RefPtr<WebProcessPool> context;
- bool clientsDetached;
+ RefPtr<WebContext> context;
GRefPtr<WebKitCookieManager> cookieManager;
GRefPtr<WebKitFaviconDatabase> faviconDatabase;
@@ -172,218 +148,27 @@ struct _WebKitWebContextPrivate {
#if ENABLE(BATTERY_STATUS)
RefPtr<WebKitBatteryProvider> batteryProvider;
#endif
-#if ENABLE(NOTIFICATIONS)
- RefPtr<WebKitNotificationProvider> notificationProvider;
+#if ENABLE(SPELLCHECK)
+ OwnPtr<WebKitTextChecker> textChecker;
#endif
- GRefPtr<WebKitWebsiteDataManager> websiteDataManager;
-
CString faviconDatabaseDirectory;
WebKitTLSErrorsPolicy tlsErrorsPolicy;
HashMap<uint64_t, WebKitWebView*> webViews;
+ GRefPtr<WebKitWebViewGroup> defaultWebViewGroup;
CString webExtensionsDirectory;
GRefPtr<GVariant> webExtensionsInitializationUserData;
-
- CString localStorageDirectory;
- CString indexedDBDirectory;
};
static guint signals[LAST_SIGNAL] = { 0, };
WEBKIT_DEFINE_TYPE(WebKitWebContext, webkit_web_context, G_TYPE_OBJECT)
-static inline WebKit::ProcessModel toProcessModel(WebKitProcessModel webKitProcessModel)
-{
- switch (webKitProcessModel) {
- case WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS:
- return ProcessModelSharedSecondaryProcess;
- case WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES:
- return ProcessModelMultipleSecondaryProcesses;
- default:
- ASSERT_NOT_REACHED();
- return ProcessModelSharedSecondaryProcess;
- }
-}
-
-static inline WebKitProcessModel toWebKitProcessModel(WebKit::ProcessModel processModel)
-{
- switch (processModel) {
- case ProcessModelSharedSecondaryProcess:
- return WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS;
- case ProcessModelMultipleSecondaryProcesses:
- return WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES;
- default:
- ASSERT_NOT_REACHED();
- return WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS;
- }
-}
-
-static const char* injectedBundleDirectory()
-{
-#if ENABLE(DEVELOPER_MODE)
- const char* bundleDirectory = g_getenv("WEBKIT_INJECTED_BUNDLE_PATH");
- if (bundleDirectory && g_file_test(bundleDirectory, G_FILE_TEST_IS_DIR))
- return bundleDirectory;
-#endif
-
- static const char* injectedBundlePath = LIBDIR G_DIR_SEPARATOR_S "webkit2gtk-" WEBKITGTK_API_VERSION_STRING
- G_DIR_SEPARATOR_S "injected-bundle" G_DIR_SEPARATOR_S;
- return injectedBundlePath;
-}
-
-static void webkitWebContextGetProperty(GObject* object, guint propID, GValue* value, GParamSpec* paramSpec)
-{
- WebKitWebContext* context = WEBKIT_WEB_CONTEXT(object);
-
- switch (propID) {
- case PROP_LOCAL_STORAGE_DIRECTORY:
- g_value_set_string(value, context->priv->localStorageDirectory.data());
- break;
- case PROP_WEBSITE_DATA_MANAGER:
- g_value_set_object(value, webkit_web_context_get_website_data_manager(context));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, paramSpec);
- }
-}
-
-static void webkitWebContextSetProperty(GObject* object, guint propID, const GValue* value, GParamSpec* paramSpec)
-{
- WebKitWebContext* context = WEBKIT_WEB_CONTEXT(object);
-
- switch (propID) {
- case PROP_LOCAL_STORAGE_DIRECTORY:
- context->priv->localStorageDirectory = g_value_get_string(value);
- break;
- case PROP_WEBSITE_DATA_MANAGER: {
- gpointer manager = g_value_get_object(value);
- context->priv->websiteDataManager = manager ? WEBKIT_WEBSITE_DATA_MANAGER(manager) : nullptr;
- break;
- }
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, paramSpec);
- }
-}
-
-static inline WebsiteDataStore::Configuration websiteDataStoreConfigurationForWebProcessPoolConfiguration(const API::ProcessPoolConfiguration& processPoolconfigurarion)
-{
- WebsiteDataStore::Configuration configuration;
- configuration.applicationCacheDirectory = processPoolconfigurarion.applicationCacheDirectory();
- configuration.networkCacheDirectory = processPoolconfigurarion.diskCacheDirectory();
- configuration.webSQLDatabaseDirectory = processPoolconfigurarion.webSQLDatabaseDirectory();
- configuration.localStorageDirectory = processPoolconfigurarion.localStorageDirectory();
- configuration.mediaKeysStorageDirectory = processPoolconfigurarion.mediaKeysStorageDirectory();
- return configuration;
-}
-
-static void webkitWebContextConstructed(GObject* object)
-{
- G_OBJECT_CLASS(webkit_web_context_parent_class)->constructed(object);
-
- GUniquePtr<char> bundleFilename(g_build_filename(injectedBundleDirectory(), "libwebkit2gtkinjectedbundle.so", nullptr));
-
- API::ProcessPoolConfiguration configuration;
- configuration.setInjectedBundlePath(WebCore::filenameToString(bundleFilename.get()));
- configuration.setProcessModel(ProcessModelSharedSecondaryProcess);
- configuration.setUseNetworkProcess(false);
-
- WebKitWebContext* webContext = WEBKIT_WEB_CONTEXT(object);
- WebKitWebContextPrivate* priv = webContext->priv;
- if (priv->websiteDataManager) {
- configuration.setLocalStorageDirectory(WebCore::filenameToString(webkit_website_data_manager_get_local_storage_directory(priv->websiteDataManager.get())));
- configuration.setDiskCacheDirectory(WebCore::pathByAppendingComponent(WebCore::filenameToString(webkit_website_data_manager_get_disk_cache_directory(priv->websiteDataManager.get())), networkCacheSubdirectory));
- configuration.setApplicationCacheDirectory(WebCore::filenameToString(webkit_website_data_manager_get_offline_application_cache_directory(priv->websiteDataManager.get())));
- configuration.setIndexedDBDatabaseDirectory(WebCore::filenameToString(webkit_website_data_manager_get_indexeddb_directory(priv->websiteDataManager.get())));
- configuration.setWebSQLDatabaseDirectory(WebCore::filenameToString(webkit_website_data_manager_get_websql_directory(priv->websiteDataManager.get())));
- } else if (!priv->localStorageDirectory.isNull())
- configuration.setLocalStorageDirectory(WebCore::filenameToString(priv->localStorageDirectory.data()));
-
- priv->context = WebProcessPool::create(configuration);
-
- if (!priv->websiteDataManager)
- priv->websiteDataManager = webkitWebsiteDataManagerCreate(websiteDataStoreConfigurationForWebProcessPoolConfiguration(configuration));
-
- priv->requestManager = priv->context->supplement<WebSoupCustomProtocolRequestManager>();
-
- priv->tlsErrorsPolicy = WEBKIT_TLS_ERRORS_POLICY_FAIL;
- priv->context->setIgnoreTLSErrors(false);
-
- attachInjectedBundleClientToContext(webContext);
- attachDownloadClientToContext(webContext);
- attachRequestManagerClientToContext(webContext);
-
-#if ENABLE(GEOLOCATION)
- priv->geolocationProvider = WebKitGeolocationProvider::create(priv->context->supplement<WebGeolocationManagerProxy>());
-#endif
-#if ENABLE(BATTERY_STATUS)
- priv->batteryProvider = WebKitBatteryProvider::create(priv->context->supplement<WebBatteryManagerProxy>());
-#endif
-#if ENABLE(NOTIFICATIONS)
- priv->notificationProvider = WebKitNotificationProvider::create(priv->context->supplement<WebNotificationManagerProxy>());
-#endif
-}
-
-static void webkitWebContextDispose(GObject* object)
-{
- WebKitWebContextPrivate* priv = WEBKIT_WEB_CONTEXT(object)->priv;
- if (!priv->clientsDetached) {
- priv->clientsDetached = true;
- priv->context->initializeInjectedBundleClient(nullptr);
- priv->context->setDownloadClient(nullptr);
- }
-
- G_OBJECT_CLASS(webkit_web_context_parent_class)->dispose(object);
-}
-
static void webkit_web_context_class_init(WebKitWebContextClass* webContextClass)
{
GObjectClass* gObjectClass = G_OBJECT_CLASS(webContextClass);
- bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
- bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
-
- gObjectClass->get_property = webkitWebContextGetProperty;
- gObjectClass->set_property = webkitWebContextSetProperty;
- gObjectClass->constructed = webkitWebContextConstructed;
- gObjectClass->dispose = webkitWebContextDispose;
-
- /**
- * WebKitWebContext:local-storage-directory:
- *
- * The directory where local storage data will be saved.
- *
- * Since: 2.8
- *
- * Deprecated: 2.10. Use #WebKitWebsiteDataManager:local-storage-directory instead.
- */
- g_object_class_install_property(
- gObjectClass,
- PROP_LOCAL_STORAGE_DIRECTORY,
- g_param_spec_string(
- "local-storage-directory",
- _("Local Storage Directory"),
- _("The directory where local storage data will be saved"),
- nullptr,
- static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
-
- /**
- * WebKitWebContext:website-data-manager:
- *
- * The #WebKitWebsiteDataManager associated with this context.
- *
- * Since: 2.10
- */
- g_object_class_install_property(
- gObjectClass,
- PROP_WEBSITE_DATA_MANAGER,
- g_param_spec_object(
- "website-data-manager",
- _("Website Data Manager"),
- _("The WebKitWebsiteDataManager associated with this context"),
- WEBKIT_TYPE_WEBSITE_DATA_MANAGER,
- static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
-
/**
* WebKitWebContext::download-started:
* @context: the #WebKitWebContext
@@ -393,13 +178,12 @@ static void webkit_web_context_class_init(WebKitWebContextClass* webContextClass
*/
signals[DOWNLOAD_STARTED] =
g_signal_new("download-started",
- G_TYPE_FROM_CLASS(gObjectClass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(WebKitWebContextClass, download_started),
- nullptr, nullptr,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- WEBKIT_TYPE_DOWNLOAD);
+ G_TYPE_FROM_CLASS(gObjectClass),
+ G_SIGNAL_RUN_LAST,
+ 0, 0, 0,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ WEBKIT_TYPE_DOWNLOAD);
/**
* WebKitWebContext::initialize-web-extensions:
@@ -416,77 +200,68 @@ static void webkit_web_context_class_init(WebKitWebContextClass* webContextClass
g_signal_new("initialize-web-extensions",
G_TYPE_FROM_CLASS(gObjectClass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(WebKitWebContextClass, initialize_web_extensions),
- nullptr, nullptr,
+ 0, nullptr, nullptr,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
-static gpointer createDefaultWebContext(gpointer)
+static CString injectedBundleDirectory()
{
- static GRefPtr<WebKitWebContext> webContext = adoptGRef(WEBKIT_WEB_CONTEXT(g_object_new(WEBKIT_TYPE_WEB_CONTEXT, nullptr)));
- return webContext.get();
-}
+ const char* bundleDirectory = g_getenv("WEBKIT_INJECTED_BUNDLE_PATH");
+ if (bundleDirectory && g_file_test(bundleDirectory, G_FILE_TEST_IS_DIR))
+ return bundleDirectory;
-/**
- * webkit_web_context_get_default:
- *
- * Gets the default web context
- *
- * Returns: (transfer none): a #WebKitWebContext
- */
-WebKitWebContext* webkit_web_context_get_default(void)
-{
- static GOnce onceInit = G_ONCE_INIT;
- return WEBKIT_WEB_CONTEXT(g_once(&onceInit, createDefaultWebContext, 0));
+ static const char* injectedBundlePath = LIBDIR G_DIR_SEPARATOR_S "webkit2gtk-" WEBKITGTK_API_VERSION_STRING
+ G_DIR_SEPARATOR_S "injected-bundle" G_DIR_SEPARATOR_S;
+ return injectedBundlePath;
}
-/**
- * webkit_web_context_new:
- *
- * Create a new #WebKitWebContext
- *
- * Returns: (transfer full): a newly created #WebKitWebContext
- *
- * Since: 2.8
- */
-WebKitWebContext* webkit_web_context_new(void)
+static CString injectedBundleFilename()
{
- return WEBKIT_WEB_CONTEXT(g_object_new(WEBKIT_TYPE_WEB_CONTEXT, nullptr));
+ GUniquePtr<char> bundleFilename(g_build_filename(injectedBundleDirectory().data(), "libwebkit2gtkinjectedbundle.so", NULL));
+ return bundleFilename.get();
}
-/**
- * webkit_web_context_new_with_website_data_manager:
- * @manager: a #WebKitWebsiteDataManager
- *
- * Create a new #WebKitWebContext with a #WebKitWebsiteDataManager.
- *
- * Returns: (transfer full): a newly created #WebKitWebContext
- *
- * Since: 2.10
- */
-WebKitWebContext* webkit_web_context_new_with_website_data_manager(WebKitWebsiteDataManager* manager)
+static gpointer createDefaultWebContext(gpointer)
{
- g_return_val_if_fail(WEBKIT_IS_WEBSITE_DATA_MANAGER(manager), nullptr);
+ bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+ bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+
+ static GRefPtr<WebKitWebContext> webContext = adoptGRef(WEBKIT_WEB_CONTEXT(g_object_new(WEBKIT_TYPE_WEB_CONTEXT, NULL)));
+ WebKitWebContextPrivate* priv = webContext->priv;
+
+ priv->context = WebContext::create(WebCore::filenameToString(injectedBundleFilename().data()));
+ priv->requestManager = webContext->priv->context->supplement<WebSoupCustomProtocolRequestManager>();
+ priv->context->setCacheModel(CacheModelPrimaryWebBrowser);
+ priv->tlsErrorsPolicy = WEBKIT_TLS_ERRORS_POLICY_IGNORE;
- return WEBKIT_WEB_CONTEXT(g_object_new(WEBKIT_TYPE_WEB_CONTEXT, "website-data-manager", manager, nullptr));
+ attachInjectedBundleClientToContext(webContext.get());
+ attachDownloadClientToContext(webContext.get());
+ attachRequestManagerClientToContext(webContext.get());
+
+#if ENABLE(GEOLOCATION)
+ priv->geolocationProvider = WebKitGeolocationProvider::create(priv->context->supplement<WebGeolocationManagerProxy>());
+#endif
+#if ENABLE(BATTERY_STATUS)
+ priv->batteryProvider = WebKitBatteryProvider::create(priv->context->supplement<WebBatteryManagerProxy>());
+#endif
+#if ENABLE(SPELLCHECK)
+ priv->textChecker = WebKitTextChecker::create();
+#endif
+ return webContext.get();
}
/**
- * webkit_web_context_get_website_data_manager:
- * @context: the #WebKitWebContext
- *
- * Get the #WebKitWebsiteDataManager of @context.
+ * webkit_web_context_get_default:
*
- * Returns: (transfer none): a #WebKitWebsiteDataManager
+ * Gets the default web context
*
- * Since: 2.10
+ * Returns: (transfer none): a #WebKitWebContext
*/
-WebKitWebsiteDataManager* webkit_web_context_get_website_data_manager(WebKitWebContext* context)
+WebKitWebContext* webkit_web_context_get_default(void)
{
- g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), nullptr);
-
- return context->priv->websiteDataManager.get();
+ static GOnce onceInit = G_ONCE_INIT;
+ return WEBKIT_WEB_CONTEXT(g_once(&onceInit, createDefaultWebContext, 0));
}
/**
@@ -576,15 +351,14 @@ void webkit_web_context_clear_cache(WebKitWebContext* context)
{
g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));
- // FIXME: https://bugs.webkit.org/show_bug.cgi?id=146041
- // context->priv->context->supplement<WebResourceCacheManagerProxy>()->clearCacheForAllOrigins(AllResourceCaches);
+ context->priv->context->supplement<WebResourceCacheManagerProxy>()->clearCacheForAllOrigins(AllResourceCaches);
}
typedef HashMap<DownloadProxy*, GRefPtr<WebKitDownload> > DownloadsMap;
static DownloadsMap& downloadsMap()
{
- static NeverDestroyed<DownloadsMap> downloads;
+ DEFINE_STATIC_LOCAL(DownloadsMap, downloads, ());
return downloads;
}
@@ -754,9 +528,7 @@ void webkit_web_context_set_additional_plugins_directory(WebKitWebContext* conte
g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));
g_return_if_fail(directory);
-#if ENABLE(NETSCAPE_PLUGIN_API)
context->priv->context->setAdditionalPluginsDirectory(WebCore::filenameToString(directory));
-#endif
}
static void destroyPluginList(GList* plugins)
@@ -764,14 +536,12 @@ static void destroyPluginList(GList* plugins)
g_list_free_full(plugins, g_object_unref);
}
-static void webkitWebContextGetPluginThread(GTask* task, gpointer object, gpointer /* taskData */, GCancellable*)
+static void webkitWebContextGetPluginThread(GTask* task, gpointer object, gpointer taskData, GCancellable*)
{
- GList* returnValue = 0;
-#if ENABLE(NETSCAPE_PLUGIN_API)
Vector<PluginModuleInfo> plugins = WEBKIT_WEB_CONTEXT(object)->priv->context->pluginInfoStore().plugins();
+ GList* returnValue = 0;
for (size_t i = 0; i < plugins.size(); ++i)
returnValue = g_list_prepend(returnValue, webkitPluginCreate(plugins[i]));
-#endif
g_task_return_pointer(task, returnValue, reinterpret_cast<GDestroyNotify>(destroyPluginList));
}
@@ -889,7 +659,7 @@ gboolean webkit_web_context_get_spell_checking_enabled(WebKitWebContext* context
g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), FALSE);
#if ENABLE(SPELLCHECK)
- return TextChecker::state().isContinuousSpellCheckingEnabled;
+ return context->priv->textChecker->isSpellCheckingEnabled();
#else
return false;
#endif
@@ -907,7 +677,7 @@ void webkit_web_context_set_spell_checking_enabled(WebKitWebContext* context, gb
g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));
#if ENABLE(SPELLCHECK)
- TextChecker::setContinuousSpellCheckingEnabled(enabled);
+ context->priv->textChecker->setSpellCheckingEnabled(enabled);
#endif
}
@@ -926,20 +696,10 @@ void webkit_web_context_set_spell_checking_enabled(WebKitWebContext* context, gb
*/
const gchar* const* webkit_web_context_get_spell_checking_languages(WebKitWebContext* context)
{
- g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), nullptr);
+ g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), 0);
#if ENABLE(SPELLCHECK)
- Vector<String> spellCheckingLanguages = TextChecker::loadedSpellCheckingLanguages();
- if (spellCheckingLanguages.isEmpty())
- return nullptr;
-
- static GRefPtr<GPtrArray> languagesToReturn;
- languagesToReturn = adoptGRef(g_ptr_array_new_with_free_func(g_free));
- for (const auto& language : spellCheckingLanguages)
- g_ptr_array_add(languagesToReturn.get(), g_strdup(language.utf8().data()));
- g_ptr_array_add(languagesToReturn.get(), nullptr);
-
- return reinterpret_cast<char**>(languagesToReturn->pdata);
+ return context->priv->textChecker->getSpellCheckingLanguages();
#else
return 0;
#endif
@@ -968,10 +728,7 @@ void webkit_web_context_set_spell_checking_languages(WebKitWebContext* context,
g_return_if_fail(languages);
#if ENABLE(SPELLCHECK)
- Vector<String> spellCheckingLanguages;
- for (size_t i = 0; languages[i]; ++i)
- spellCheckingLanguages.append(String::fromUTF8(languages[i]));
- TextChecker::setSpellCheckingLanguages(spellCheckingLanguages);
+ context->priv->textChecker->setSpellCheckingLanguages(languages);
#endif
}
@@ -1085,19 +842,13 @@ void webkit_web_context_set_web_extensions_initialization_user_data(WebKitWebCon
* Set the directory where disk cache files will be stored
* This method must be called before loading anything in this context, otherwise
* it will not have any effect.
- *
- * Note that this method overrides the directory set in the #WebKitWebsiteDataManager,
- * but it doesn't change the value returned by webkit_website_data_manager_get_disk_cache_directory()
- * since the #WebKitWebsiteDataManager is immutable.
- *
- * Deprecated: 2.10. Use webkit_web_context_new_with_website_data_manager() instead.
*/
void webkit_web_context_set_disk_cache_directory(WebKitWebContext* context, const char* directory)
{
g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));
g_return_if_fail(directory);
- context->priv->context->configuration().setDiskCacheDirectory(WebCore::pathByAppendingComponent(WebCore::filenameToString(directory), networkCacheSubdirectory));
+ context->priv->context->setDiskCacheDirectory(WebCore::filenameToString(directory));
}
/**
@@ -1113,28 +864,28 @@ void webkit_web_context_prefetch_dns(WebKitWebContext* context, const char* host
g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));
g_return_if_fail(hostname);
- API::Dictionary::MapType message;
+ ImmutableDictionary::MapType message;
message.set(String::fromUTF8("Hostname"), API::String::create(String::fromUTF8(hostname)));
- context->priv->context->postMessageToInjectedBundle(String::fromUTF8("PrefetchDNS"), API::Dictionary::create(WTF::move(message)).ptr());
+ context->priv->context->postMessageToInjectedBundle(String::fromUTF8("PrefetchDNS"), ImmutableDictionary::create(std::move(message)).get());
}
/**
* webkit_web_context_allow_tls_certificate_for_host:
* @context: a #WebKitWebContext
- * @certificate: a #GTlsCertificate
+ * @info: a #WebKitCertificateInfo
* @host: the host for which a certificate is to be allowed
*
* Ignore further TLS errors on the @host for the certificate present in @info.
*
- * Since: 2.6
+ * Since: 2.4
*/
-void webkit_web_context_allow_tls_certificate_for_host(WebKitWebContext* context, GTlsCertificate* certificate, const gchar* host)
+void webkit_web_context_allow_tls_certificate_for_host(WebKitWebContext* context, WebKitCertificateInfo* info, const gchar* host)
{
g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));
- g_return_if_fail(G_IS_TLS_CERTIFICATE(certificate));
+ g_return_if_fail(info);
g_return_if_fail(host);
- RefPtr<WebCertificateInfo> webCertificateInfo = WebCertificateInfo::create(WebCore::CertificateInfo(certificate, static_cast<GTlsCertificateFlags>(0)));
+ RefPtr<WebCertificateInfo> webCertificateInfo = WebCertificateInfo::create(webkitCertificateInfoGetCertificateInfo(info));
context->priv->context->allowSpecificHTTPSCertificateForHost(webCertificateInfo.get(), String::fromUTF8(host));
}
@@ -1159,7 +910,7 @@ void webkit_web_context_allow_tls_certificate_for_host(WebKitWebContext* context
* the rest of the WebViews in the application will still function
* normally.
*
- * This method **must be called before any web process has been created**,
+ * This method **must be called before any other functions**,
* as early as possible in your application. Calling it later will make
* your application crash.
*
@@ -1169,7 +920,18 @@ void webkit_web_context_set_process_model(WebKitWebContext* context, WebKitProce
{
g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));
- ProcessModel newProcessModel(toProcessModel(processModel));
+ ProcessModel newProcessModel;
+
+ switch (processModel) {
+ case WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS:
+ newProcessModel = ProcessModelSharedSecondaryProcess;
+ break;
+ case WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES:
+ newProcessModel = ProcessModelMultipleSecondaryProcesses;
+ break;
+ default:
+ g_assert_not_reached();
+ }
if (newProcessModel == context->priv->context->processModel())
return;
@@ -1193,48 +955,14 @@ WebKitProcessModel webkit_web_context_get_process_model(WebKitWebContext* contex
{
g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS);
- return toWebKitProcessModel(context->priv->context->processModel());
-}
-
-/**
- * webkit_web_context_set_web_process_count_limit:
- * @context: the #WebKitWebContext
- * @limit: the maximum number of web processes
- *
- * Sets the maximum number of web processes that can be created at the same time for the @context.
- * The default value is 0 and means no limit.
- *
- * This method **must be called before any web process has been created**,
- * as early as possible in your application. Calling it later will make
- * your application crash.
- *
- * Since: 2.10
- */
-void webkit_web_context_set_web_process_count_limit(WebKitWebContext* context, guint limit)
-{
- g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));
-
- if (limit == context->priv->context->configuration().maximumProcessCount())
- return;
-
- context->priv->context->setMaximumNumberOfProcesses(limit);
-}
-
-/**
- * webkit_web_context_get_web_process_count_limit:
- * @context: the #WebKitWebContext
- *
- * Gets the maximum number of web processes that can be created at the same time for the @context.
- *
- * Returns: the maximum limit of web processes, or 0 if there isn't a limit.
- *
- * Since: 2.10
- */
-guint webkit_web_context_get_web_process_count_limit(WebKitWebContext* context)
-{
- g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), 0);
-
- return context->priv->context->configuration().maximumProcessCount();
+ switch (context->priv->context->processModel()) {
+ case ProcessModelSharedSecondaryProcess:
+ return WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS;
+ case ProcessModelMultipleSecondaryProcesses:
+ return WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES;
+ default:
+ g_assert_not_reached();
+ }
}
WebKitDownload* webkitWebContextGetOrCreateDownload(DownloadProxy* downloadProxy)
@@ -1275,7 +1003,7 @@ GVariant* webkitWebContextInitializeWebExtensions(WebKitWebContext* context)
context->priv->webExtensionsInitializationUserData.get());
}
-WebProcessPool* webkitWebContextGetContext(WebKitWebContext* context)
+WebContext* webkitWebContextGetContext(WebKitWebContext* context)
{
g_assert(WEBKIT_IS_WEB_CONTEXT(context));
@@ -1313,20 +1041,18 @@ void webkitWebContextDidFinishLoadingCustomProtocol(WebKitWebContext* context, u
context->priv->uriSchemeRequests.remove(customProtocolID);
}
-void webkitWebContextCreatePageForWebView(WebKitWebContext* context, WebKitWebView* webView, WebKitUserContentManager* userContentManager, WebKitWebView* relatedView)
+void webkitWebContextCreatePageForWebView(WebKitWebContext* context, WebKitWebView* webView, WebKitWebViewGroup* webViewGroup, WebKitWebView* relatedView)
{
WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(webView);
-
- auto pageConfiguration = API::PageConfiguration::create();
- pageConfiguration->setPreferences(webkitSettingsGetPreferences(webkit_web_view_get_settings(webView)));
- pageConfiguration->setRelatedPage(relatedView ? webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(relatedView)) : nullptr);
- pageConfiguration->setUserContentController(userContentManager ? webkitUserContentManagerGetUserContentControllerProxy(userContentManager) : nullptr);
- pageConfiguration->setWebsiteDataStore(&webkitWebsiteDataManagerGetDataStore(context->priv->websiteDataManager.get()));
- pageConfiguration->setSessionID(pageConfiguration->websiteDataStore()->websiteDataStore().sessionID());
- webkitWebViewBaseCreateWebPage(webViewBase, context->priv->context.get(), WTF::move(pageConfiguration));
+ WebPageGroup* pageGroup = webViewGroup ? webkitWebViewGroupGetPageGroup(webViewGroup) : 0;
+ WebPageProxy* relatedPage = relatedView ? webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(relatedView)) : nullptr;
+ webkitWebViewBaseCreateWebPage(webViewBase, context->priv->context.get(), pageGroup, relatedPage);
WebPageProxy* page = webkitWebViewBaseGetPage(webViewBase);
context->priv->webViews.set(page->pageID(), webView);
+
+ if (!pageGroup && !context->priv->defaultWebViewGroup)
+ context->priv->defaultWebViewGroup = adoptGRef(webkitWebViewGroupCreate(&page->pageGroup()));
}
void webkitWebContextWebViewDestroyed(WebKitWebContext* context, WebKitWebView* webView)
@@ -1339,3 +1065,8 @@ WebKitWebView* webkitWebContextGetWebViewForPage(WebKitWebContext* context, WebP
{
return page ? context->priv->webViews.get(page->pageID()) : 0;
}
+
+WebKitWebViewGroup* webkitWebContextGetDefaultWebViewGroup(WebKitWebContext* context)
+{
+ return context->priv->defaultWebViewGroup.get();
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h
index cd55486f4..3ce281b9b 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h
@@ -25,13 +25,13 @@
#define WebKitWebContext_h
#include <glib-object.h>
+#include <webkit2/WebKitCertificateInfo.h>
#include <webkit2/WebKitCookieManager.h>
#include <webkit2/WebKitDefines.h>
#include <webkit2/WebKitDownload.h>
#include <webkit2/WebKitFaviconDatabase.h>
#include <webkit2/WebKitSecurityManager.h>
#include <webkit2/WebKitURISchemeRequest.h>
-#include <webkit2/WebKitWebsiteDataManager.h>
G_BEGIN_DECLS
@@ -128,16 +128,14 @@ struct _WebKitWebContext {
struct _WebKitWebContextClass {
GObjectClass parent;
- void (* download_started) (WebKitWebContext *context,
- WebKitDownload *download);
- void (* initialize_web_extensions) (WebKitWebContext *context);
-
void (*_webkit_reserved0) (void);
void (*_webkit_reserved1) (void);
void (*_webkit_reserved2) (void);
void (*_webkit_reserved3) (void);
void (*_webkit_reserved4) (void);
void (*_webkit_reserved5) (void);
+ void (*_webkit_reserved6) (void);
+ void (*_webkit_reserved7) (void);
};
WEBKIT_API GType
@@ -146,15 +144,6 @@ webkit_web_context_get_type (void);
WEBKIT_API WebKitWebContext *
webkit_web_context_get_default (void);
-WEBKIT_API WebKitWebContext *
-webkit_web_context_new (void);
-
-WEBKIT_API WebKitWebContext *
-webkit_web_context_new_with_website_data_manager (WebKitWebsiteDataManager *manager);
-
-WEBKIT_API WebKitWebsiteDataManager *
-webkit_web_context_get_website_data_manager (WebKitWebContext *context);
-
WEBKIT_API void
webkit_web_context_set_cache_model (WebKitWebContext *context,
WebKitCacheModel cache_model);
@@ -162,13 +151,6 @@ WEBKIT_API WebKitCacheModel
webkit_web_context_get_cache_model (WebKitWebContext *context);
WEBKIT_API void
-webkit_web_context_set_web_process_count_limit (WebKitWebContext *context,
- guint limit);
-
-WEBKIT_API guint
-webkit_web_context_get_web_process_count_limit (WebKitWebContext *context);
-
-WEBKIT_API void
webkit_web_context_clear_cache (WebKitWebContext *context);
WEBKIT_API WebKitDownload *
@@ -248,13 +230,13 @@ WEBKIT_API void
webkit_web_context_prefetch_dns (WebKitWebContext *context,
const gchar *hostname);
-WEBKIT_DEPRECATED_FOR(webkit_web_context_new_with_website_data_manager) void
+WEBKIT_API void
webkit_web_context_set_disk_cache_directory (WebKitWebContext *context,
const gchar *directory);
WEBKIT_API void
webkit_web_context_allow_tls_certificate_for_host (WebKitWebContext *context,
- GTlsCertificate *certificate,
+ WebKitCertificateInfo *info,
const gchar *host);
WEBKIT_API void
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h
index 6ea7f2aaf..06474a1ef 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h
@@ -27,13 +27,13 @@
#define WebKitWebContextPrivate_h
#include "DownloadProxy.h"
+#include "WebContext.h"
#include "WebKitPrivate.h"
-#include "WebKitUserContentManager.h"
#include "WebKitWebContext.h"
-#include "WebProcessPool.h"
+#include "WebKitWebViewGroup.h"
#include "WebSoupCustomProtocolRequestManager.h"
-WebKit::WebProcessPool* webkitWebContextGetContext(WebKitWebContext*);
+WebKit::WebContext* webkitWebContextGetContext(WebKitWebContext*);
WebKitDownload* webkitWebContextGetOrCreateDownload(WebKit::DownloadProxy*);
WebKitDownload* webkitWebContextStartDownload(WebKitWebContext*, const char* uri, WebKit::WebPageProxy*);
void webkitWebContextRemoveDownload(WebKit::DownloadProxy*);
@@ -42,9 +42,10 @@ WebKit::WebSoupCustomProtocolRequestManager* webkitWebContextGetRequestManager(W
void webkitWebContextStartLoadingCustomProtocol(WebKitWebContext*, uint64_t customProtocolID, API::URLRequest*);
void webkitWebContextStopLoadingCustomProtocol(WebKitWebContext*, uint64_t customProtocolID);
void webkitWebContextDidFinishLoadingCustomProtocol(WebKitWebContext*, uint64_t customProtocolID);
-void webkitWebContextCreatePageForWebView(WebKitWebContext*, WebKitWebView*, WebKitUserContentManager*, WebKitWebView*);
+void webkitWebContextCreatePageForWebView(WebKitWebContext*, WebKitWebView*, WebKitWebViewGroup*, WebKitWebView*);
void webkitWebContextWebViewDestroyed(WebKitWebContext*, WebKitWebView*);
WebKitWebView* webkitWebContextGetWebViewForPage(WebKitWebContext*, WebKit::WebPageProxy*);
+WebKitWebViewGroup* webkitWebContextGetDefaultWebViewGroup(WebKitWebContext*);
GVariant* webkitWebContextInitializeWebExtensions(WebKitWebContext*);
#endif // WebKitWebContextPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp
index 7b46d527f..083d27c84 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp
@@ -24,7 +24,7 @@
#include "WebKitMarshal.h"
#include "WebKitWebInspectorPrivate.h"
#include <glib/gi18n-lib.h>
-#include <wtf/glib/GRefPtr.h>
+#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/CString.h>
using namespace WebKit;
@@ -72,8 +72,7 @@ enum {
PROP_0,
PROP_INSPECTED_URI,
- PROP_ATTACHED_HEIGHT,
- PROP_CAN_ATTACH
+ PROP_ATTACHED_HEIGHT
};
struct _WebKitWebInspectorPrivate {
@@ -85,7 +84,6 @@ struct _WebKitWebInspectorPrivate {
RefPtr<WebInspectorProxy> webInspector;
CString inspectedURI;
unsigned attachedHeight;
- bool canAttach;
};
WEBKIT_DEFINE_TYPE(WebKitWebInspector, webkit_web_inspector, G_TYPE_OBJECT)
@@ -103,9 +101,6 @@ static void webkitWebInspectorGetProperty(GObject* object, guint propId, GValue*
case PROP_ATTACHED_HEIGHT:
g_value_set_uint(value, webkit_web_inspector_get_attached_height(inspector));
break;
- case PROP_CAN_ATTACH:
- g_value_set_boolean(value, webkit_web_inspector_get_can_attach(inspector));
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
}
@@ -142,24 +137,6 @@ static void webkit_web_inspector_class_init(WebKitWebInspectorClass* findClass)
WEBKIT_PARAM_READABLE));
/**
- * WebKitWebInspector:can-attach:
- *
- * Whether the @inspector can be attached to the same window that contains
- * the inspected view.
- *
- * Since: 2.8
- */
- g_object_class_install_property(
- gObjectClass,
- PROP_CAN_ATTACH,
- g_param_spec_boolean(
- "can-attach",
- _("Can Attach"),
- _("Whether the inspector can be attached to the same window that contains the inspected view"),
- FALSE,
- WEBKIT_PARAM_READABLE));
-
- /**
* WebKitWebInspector::open-window:
* @inspector: the #WebKitWebInspector on which the signal is emitted
*
@@ -318,7 +295,7 @@ static bool attach(WKInspectorRef, const void* clientInfo)
return returnValue;
}
-static bool detach(WKInspectorRef, const void* clientInfo)
+static bool detach(WKInspectorRef inspector, const void* clientInfo)
{
gboolean returnValue;
g_signal_emit(WEBKIT_WEB_INSPECTOR(clientInfo), signals[DETACH], 0, &returnValue);
@@ -334,15 +311,6 @@ static void didChangeAttachedHeight(WKInspectorRef, unsigned height, const void*
g_object_notify(G_OBJECT(inspector), "attached-height");
}
-static void didChangeAttachAvailability(WKInspectorRef, bool available, const void* clientInfo)
-{
- WebKitWebInspector* inspector = WEBKIT_WEB_INSPECTOR(clientInfo);
- if (inspector->priv->canAttach == available)
- return;
- inspector->priv->canAttach = available;
- g_object_notify(G_OBJECT(clientInfo), "can-attach");
-}
-
WebKitWebInspector* webkitWebInspectorCreate(WebInspectorProxy* webInspector)
{
WebKitWebInspector* inspector = WEBKIT_WEB_INSPECTOR(g_object_new(WEBKIT_TYPE_WEB_INSPECTOR, NULL));
@@ -360,8 +328,7 @@ WebKitWebInspector* webkitWebInspectorCreate(WebInspectorProxy* webInspector)
attach,
detach,
didChangeAttachedHeight,
- nullptr, // didChangeAttachedWidth
- didChangeAttachAvailability
+ nullptr // didChangeAttachedWidth
};
WKInspectorSetInspectorClientGtk(toAPI(webInspector), &wkInspectorClientGtk.base);
@@ -404,25 +371,6 @@ const char* webkit_web_inspector_get_inspected_uri(WebKitWebInspector* inspector
}
/**
- * webkit_web_inspector_get_can_attach:
- * @inspector: a #WebKitWebInspector
- *
- * Whether the @inspector can be attached to the same window that contains
- * the inspected view.
- *
- * Returns: %TRUE if there is enough room for the inspector view inside the
- * window that contains the inspected view, or %FALSE otherwise.
- *
- * Since: 2.8
- */
-gboolean webkit_web_inspector_get_can_attach(WebKitWebInspector* inspector)
-{
- g_return_val_if_fail(WEBKIT_IS_WEB_INSPECTOR(inspector), FALSE);
-
- return inspector->priv->canAttach;
-}
-
-/**
* webkit_web_inspector_is_attached:
* @inspector: a #WebKitWebInspector
*
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.h
index 686f949ac..67f0f4957 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.h
@@ -83,9 +83,6 @@ webkit_web_inspector_close (WebKitWebInspector *inspector);
WEBKIT_API guint
webkit_web_inspector_get_attached_height (WebKitWebInspector *inspector);
-WEBKIT_API gboolean
-webkit_web_inspector_get_can_attach (WebKitWebInspector* inspector);
-
G_END_DECLS
#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebResource.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebResource.cpp
index dba7f7000..b4e11e90c 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebResource.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebResource.cpp
@@ -26,7 +26,7 @@
#include "WebKitURIRequest.h"
#include "WebKitWebResourcePrivate.h"
#include <glib/gi18n-lib.h>
-#include <wtf/glib/GRefPtr.h>
+#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/CString.h>
using namespace WebKit;
@@ -53,7 +53,6 @@ enum {
RECEIVED_DATA,
FINISHED,
FAILED,
- FAILED_WITH_TLS_ERRORS,
LAST_SIGNAL
};
@@ -198,26 +197,6 @@ static void webkit_web_resource_class_init(WebKitWebResourceClass* resourceClass
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
-
- /**
- * WebKitWebResource::failed-with-tls-errors:
- * @resource: the #WebKitWebResource
- * @certificate: a #GTlsCertificate
- * @errors: a #GTlsCertificateFlags with the verification status of @certificate
- *
- * This signal is emitted when a TLS error occurs during the resource load operation.
- *
- * Since: 2.8
- */
- signals[FAILED_WITH_TLS_ERRORS] =
- g_signal_new("failed-with-tls-errors",
- G_TYPE_FROM_CLASS(objectClass),
- G_SIGNAL_RUN_LAST,
- 0, nullptr, nullptr,
- g_cclosure_marshal_generic,
- G_TYPE_NONE, 2,
- G_TYPE_TLS_CERTIFICATE,
- G_TYPE_TLS_CERTIFICATE_FLAGS);
}
static void webkitWebResourceUpdateURI(WebKitWebResource* resource, const CString& requestURI)
@@ -267,12 +246,6 @@ void webkitWebResourceFailed(WebKitWebResource* resource, GError* error)
g_signal_emit(resource, signals[FINISHED], 0, NULL);
}
-void webkitWebResourceFailedWithTLSErrors(WebKitWebResource* resource, GTlsCertificateFlags tlsErrors, GTlsCertificate* certificate)
-{
- g_signal_emit(resource, signals[FAILED_WITH_TLS_ERRORS], 0, certificate, tlsErrors);
- g_signal_emit(resource, signals[FINISHED], 0, nullptr);
-}
-
WebFrameProxy* webkitWebResourceGetFrame(WebKitWebResource* resource)
{
return resource->priv->frame.get();
@@ -341,11 +314,12 @@ struct ResourceGetDataAsyncData {
};
WEBKIT_DEFINE_ASYNC_DATA_STRUCT(ResourceGetDataAsyncData)
-static void resourceDataCallback(API::Data* wkData, GTask* task)
+static void resourceDataCallback(WKDataRef wkData, WKErrorRef, void* context)
{
- ResourceGetDataAsyncData* data = static_cast<ResourceGetDataAsyncData*>(g_task_get_task_data(task));
- data->webData = wkData;
- g_task_return_boolean(task, TRUE);
+ GRefPtr<GTask> task = adoptGRef(G_TASK(context));
+ ResourceGetDataAsyncData* data = static_cast<ResourceGetDataAsyncData*>(g_task_get_task_data(task.get()));
+ data->webData = toImpl(wkData);
+ g_task_return_boolean(task.get(), TRUE);
}
/**
@@ -367,14 +341,10 @@ void webkit_web_resource_get_data(WebKitWebResource* resource, GCancellable* can
GTask* task = g_task_new(resource, cancellable, callback, userData);
g_task_set_task_data(task, createResourceGetDataAsyncData(), reinterpret_cast<GDestroyNotify>(destroyResourceGetDataAsyncData));
if (resource->priv->isMainResource)
- resource->priv->frame->getMainResourceData([task](API::Data* data, CallbackBase::Error) {
- resourceDataCallback(data, adoptGRef(task).get());
- });
+ resource->priv->frame->getMainResourceData(DataCallback::create(task, resourceDataCallback));
else {
String url = String::fromUTF8(resource->priv->uri.data());
- resource->priv->frame->getResourceData(API::URL::create(url).ptr(), [task](API::Data* data, CallbackBase::Error) {
- resourceDataCallback(data, adoptGRef(task).get());
- });
+ resource->priv->frame->getResourceData(API::URL::create(url).get(), DataCallback::create(task, resourceDataCallback));
}
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebResourcePrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebResourcePrivate.h
index de9e36b5f..82e2d8f5a 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebResourcePrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebResourcePrivate.h
@@ -29,7 +29,6 @@ void webkitWebResourceSetResponse(WebKitWebResource*, WebKitURIResponse*);
void webkitWebResourceNotifyProgress(WebKitWebResource*, guint64 bytesReceived);
void webkitWebResourceFinished(WebKitWebResource*);
void webkitWebResourceFailed(WebKitWebResource*, GError*);
-void webkitWebResourceFailedWithTLSErrors(WebKitWebResource*, GTlsCertificateFlags, GTlsCertificate*);
WebKit::WebFrameProxy* webkitWebResourceGetFrame(WebKitWebResource*);
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
index 03225da89..0abb35e12 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
@@ -1,7 +1,6 @@
/*
* Copyright (C) 2011 Igalia S.L.
* Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved.
- * Copyright (C) 2014 Collabora Ltd.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -23,7 +22,6 @@
#include "WebKitWebView.h"
#include "APIData.h"
-#include "APISerializedScriptValue.h"
#include "ImageOptions.h"
#include "WebCertificateInfo.h"
#include "WebContextMenuItem.h"
@@ -31,28 +29,25 @@
#include "WebKitAuthenticationDialog.h"
#include "WebKitAuthenticationRequestPrivate.h"
#include "WebKitBackForwardListPrivate.h"
+#include "WebKitCertificateInfoPrivate.h"
#include "WebKitContextMenuClient.h"
#include "WebKitContextMenuItemPrivate.h"
#include "WebKitContextMenuPrivate.h"
#include "WebKitDownloadPrivate.h"
-#include "WebKitEditorStatePrivate.h"
#include "WebKitEnumTypes.h"
#include "WebKitError.h"
#include "WebKitFaviconDatabasePrivate.h"
#include "WebKitFormClient.h"
#include "WebKitFullscreenClient.h"
#include "WebKitHitTestResultPrivate.h"
-#include "WebKitInstallMissingMediaPluginsPermissionRequestPrivate.h"
#include "WebKitJavascriptResultPrivate.h"
#include "WebKitLoaderClient.h"
#include "WebKitMarshal.h"
-#include "WebKitNotificationPrivate.h"
#include "WebKitPolicyClient.h"
#include "WebKitPrintOperationPrivate.h"
#include "WebKitPrivate.h"
#include "WebKitResponsePolicyDecision.h"
#include "WebKitScriptDialogPrivate.h"
-#include "WebKitSettingsPrivate.h"
#include "WebKitUIClient.h"
#include "WebKitURIRequestPrivate.h"
#include "WebKitURIResponsePrivate.h"
@@ -60,22 +55,20 @@
#include "WebKitWebInspectorPrivate.h"
#include "WebKitWebResourcePrivate.h"
#include "WebKitWebViewBasePrivate.h"
+#include "WebKitWebViewGroupPrivate.h"
#include "WebKitWebViewPrivate.h"
#include "WebKitWindowPropertiesPrivate.h"
#include <JavaScriptCore/APICast.h>
#include <WebCore/CertificateInfo.h>
+#include <WebCore/DragIcon.h>
#include <WebCore/GUniquePtrGtk.h>
#include <WebCore/GUniquePtrSoup.h>
#include <WebCore/GtkUtilities.h>
#include <WebCore/RefPtrCairo.h>
#include <glib/gi18n-lib.h>
-#include <wtf/glib/GRefPtr.h>
+#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/CString.h>
-#if USE(LIBNOTIFY)
-#include <libnotify/notify.h>
-#endif
-
using namespace WebKit;
using namespace WebCore;
@@ -131,10 +124,6 @@ enum {
AUTHENTICATE,
- SHOW_NOTIFICATION,
-
- RUN_COLOR_CHOOSER,
-
LAST_SIGNAL
};
@@ -143,23 +132,19 @@ enum {
PROP_WEB_CONTEXT,
PROP_RELATED_VIEW,
- PROP_SETTINGS,
- PROP_USER_CONTENT_MANAGER,
+ PROP_GROUP,
PROP_TITLE,
PROP_ESTIMATED_LOAD_PROGRESS,
PROP_FAVICON,
PROP_URI,
PROP_ZOOM_LEVEL,
PROP_IS_LOADING,
- PROP_IS_PLAYING_AUDIO,
- PROP_EDITABLE
+ PROP_VIEW_MODE
};
typedef HashMap<uint64_t, GRefPtr<WebKitWebResource> > LoadingResourcesMap;
typedef HashMap<uint64_t, GRefPtr<GTask> > SnapshotResultsMap;
-class PageLoadStateObserver;
-
struct _WebKitWebViewPrivate {
~_WebKitWebViewPrivate()
{
@@ -171,23 +156,24 @@ struct _WebKitWebViewPrivate {
g_main_loop_quit(modalLoop.get());
}
+ WebKitWebContext* context;
WebKitWebView* relatedView;
CString title;
CString customTextEncoding;
+ double estimatedLoadProgress;
CString activeURI;
bool isLoading;
+ WebKitViewMode viewMode;
- std::unique_ptr<PageLoadStateObserver> loadObserver;
bool waitingForMainResource;
unsigned long mainResourceResponseHandlerID;
WebKitLoadEvent lastDelayedEvent;
GRefPtr<WebKitBackForwardList> backForwardList;
GRefPtr<WebKitSettings> settings;
- GRefPtr<WebKitUserContentManager> userContentManager;
- GRefPtr<WebKitWebContext> context;
+ unsigned long settingsChangedHandlerID;
+ GRefPtr<WebKitWebViewGroup> group;
GRefPtr<WebKitWindowProperties> windowProperties;
- GRefPtr<WebKitEditorState> editorState;
GRefPtr<GMainLoop> modalLoop;
@@ -209,7 +195,6 @@ struct _WebKitWebViewPrivate {
SnapshotResultsMap snapshotResultsMap;
GRefPtr<WebKitAuthenticationRequest> authenticationRequest;
-
};
static guint signals[LAST_SIGNAL] = { 0, };
@@ -221,90 +206,6 @@ static inline WebPageProxy* getPage(WebKitWebView* webView)
return webkitWebViewBaseGetPage(reinterpret_cast<WebKitWebViewBase*>(webView));
}
-static void webkitWebViewSetIsLoading(WebKitWebView* webView, bool isLoading)
-{
- if (webView->priv->isLoading == isLoading)
- return;
-
- webView->priv->isLoading = isLoading;
- g_object_notify(G_OBJECT(webView), "is-loading");
-}
-
-void webkitWebViewIsPlayingAudioChanged(WebKitWebView* webView)
-{
- g_object_notify(G_OBJECT(webView), "is-playing-audio");
-}
-
-class PageLoadStateObserver final : public PageLoadState::Observer {
-public:
- PageLoadStateObserver(WebKitWebView* webView)
- : m_webView(webView)
- {
- }
-
-private:
- virtual void willChangeIsLoading() override
- {
- g_object_freeze_notify(G_OBJECT(m_webView));
- }
- virtual void didChangeIsLoading() override
- {
- if (m_webView->priv->waitingForMainResource) {
- // The actual load has finished but we haven't emitted the delayed load events yet, so we are still loading.
- g_object_thaw_notify(G_OBJECT(m_webView));
- return;
- }
- webkitWebViewSetIsLoading(m_webView, getPage(m_webView)->pageLoadState().isLoading());
- g_object_thaw_notify(G_OBJECT(m_webView));
- }
-
- virtual void willChangeTitle() override
- {
- g_object_freeze_notify(G_OBJECT(m_webView));
- }
- virtual void didChangeTitle() override
- {
- m_webView->priv->title = getPage(m_webView)->pageLoadState().title().utf8();
- g_object_notify(G_OBJECT(m_webView), "title");
- g_object_thaw_notify(G_OBJECT(m_webView));
- }
-
- virtual void willChangeActiveURL() override
- {
- g_object_freeze_notify(G_OBJECT(m_webView));
- }
- virtual void didChangeActiveURL() override
- {
- m_webView->priv->activeURI = getPage(m_webView)->pageLoadState().activeURL().utf8();
- g_object_notify(G_OBJECT(m_webView), "uri");
- g_object_thaw_notify(G_OBJECT(m_webView));
- }
-
- virtual void willChangeHasOnlySecureContent() override { }
- virtual void didChangeHasOnlySecureContent() override { }
-
- virtual void willChangeEstimatedProgress() override
- {
- g_object_freeze_notify(G_OBJECT(m_webView));
- }
- virtual void didChangeEstimatedProgress() override
- {
- g_object_notify(G_OBJECT(m_webView), "estimated-load-progress");
- g_object_thaw_notify(G_OBJECT(m_webView));
- }
-
- virtual void willChangeCanGoBack() override { }
- virtual void didChangeCanGoBack() override { }
- virtual void willChangeCanGoForward() override { }
- virtual void didChangeCanGoForward() override { }
- virtual void willChangeNetworkRequestsInProgress() override { }
- virtual void didChangeNetworkRequestsInProgress() override { }
- virtual void willChangeCertificateInfo() override { }
- virtual void didChangeCertificateInfo() override { }
-
- WebKitWebView* m_webView;
-};
-
static gboolean webkitWebViewLoadFail(WebKitWebView* webView, WebKitLoadEvent, const char* failingURI, GError* error)
{
if (g_error_matches(error, WEBKIT_NETWORK_ERROR, WEBKIT_NETWORK_ERROR_CANCELLED)
@@ -318,9 +219,9 @@ static gboolean webkitWebViewLoadFail(WebKitWebView* webView, WebKitLoadEvent, c
return TRUE;
}
-static GtkWidget* webkitWebViewCreate(WebKitWebView*, WebKitNavigationAction*)
+static GtkWidget* webkitWebViewCreate(WebKitWebView*)
{
- return nullptr;
+ return 0;
}
static GtkWidget* webkitWebViewCreateJavaScriptDialog(WebKitWebView* webView, GtkMessageType type, GtkButtonsType buttons, int defaultResponse, const char* message)
@@ -365,7 +266,7 @@ static gboolean webkitWebViewScriptDialog(WebKitWebView* webView, WebKitScriptDi
return TRUE;
}
-static gboolean webkitWebViewDecidePolicy(WebKitWebView*, WebKitPolicyDecision* decision, WebKitPolicyDecisionType decisionType)
+static gboolean webkitWebViewDecidePolicy(WebKitWebView* webView, WebKitPolicyDecision* decision, WebKitPolicyDecisionType decisionType)
{
if (decisionType != WEBKIT_POLICY_DECISION_TYPE_RESPONSE) {
webkit_policy_decision_use(decision);
@@ -452,7 +353,7 @@ static void webkitWebViewRequestFavicon(WebKitWebView* webView)
WebKitWebViewPrivate* priv = webView->priv;
priv->faviconCancellable = adoptGRef(g_cancellable_new());
- WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(priv->context.get());
+ WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(priv->context);
webkit_favicon_database_get_favicon(database, priv->activeURI.data(), priv->faviconCancellable.get(), gotFaviconCallback, webView);
}
@@ -465,7 +366,7 @@ static void webkitWebViewUpdateFaviconURI(WebKitWebView* webView, const char* fa
webkitWebViewRequestFavicon(webView);
}
-static void faviconChangedCallback(WebKitFaviconDatabase*, const char* pageURI, const char* faviconURI, WebKitWebView* webView)
+static void faviconChangedCallback(WebKitFaviconDatabase* database, const char* pageURI, const char* faviconURI, WebKitWebView* webView)
{
if (webView->priv->activeURI != pageURI)
return;
@@ -475,18 +376,16 @@ static void faviconChangedCallback(WebKitFaviconDatabase*, const char* pageURI,
static void webkitWebViewUpdateSettings(WebKitWebView* webView)
{
- // The "settings" property is set on construction, and in that
- // case webkit_web_view_set_settings() will be called *before* the
- // WebPageProxy has been created so we should do an early return.
- WebPageProxy* page = getPage(webView);
- if (!page)
- return;
+ // We keep a ref of the current settings to disconnect the signals when settings change in the group.
+ webView->priv->settings = webkit_web_view_get_settings(webView);
WebKitSettings* settings = webView->priv->settings.get();
- page->setPreferences(*webkitSettingsGetPreferences(settings));
+ WebPageProxy* page = getPage(webView);
page->setCanRunModal(webkit_settings_get_allow_modal_dialogs(settings));
page->setCustomUserAgent(String::fromUTF8(webkit_settings_get_user_agent(settings)));
+ webkitWebViewBaseUpdatePreferences(WEBKIT_WEB_VIEW_BASE(webView));
+
g_signal_connect(settings, "notify::allow-modal-dialogs", G_CALLBACK(allowModalDialogsChanged), webView);
g_signal_connect(settings, "notify::zoom-text-only", G_CALLBACK(zoomTextOnlyChanged), webView);
g_signal_connect(settings, "notify::user-agent", G_CALLBACK(userAgentChanged), webView);
@@ -500,6 +399,20 @@ static void webkitWebViewDisconnectSettingsSignalHandlers(WebKitWebView* webView
g_signal_handlers_disconnect_by_func(settings, reinterpret_cast<gpointer>(userAgentChanged), webView);
}
+static void webkitWebViewSettingsChanged(WebKitWebViewGroup* group, GParamSpec*, WebKitWebView* webView)
+{
+ webkitWebViewDisconnectSettingsSignalHandlers(webView);
+ webkitWebViewUpdateSettings(webView);
+}
+
+static void webkitWebViewDisconnectSettingsChangedSignalHandler(WebKitWebView* webView)
+{
+ WebKitWebViewPrivate* priv = webView->priv;
+ if (priv->settingsChangedHandlerID)
+ g_signal_handler_disconnect(webkit_web_view_get_group(webView), priv->settingsChangedHandlerID);
+ priv->settingsChangedHandlerID = 0;
+}
+
static void webkitWebViewDisconnectMainResourceResponseChangedSignalHandler(WebKitWebView* webView)
{
WebKitWebViewPrivate* priv = webView->priv;
@@ -514,7 +427,7 @@ static void webkitWebViewWatchForChangesInFavicon(WebKitWebView* webView)
if (priv->faviconChangedHandlerID)
return;
- WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(priv->context.get());
+ WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(priv->context);
priv->faviconChangedHandlerID = g_signal_connect(database, "favicon-changed", G_CALLBACK(faviconChangedCallback), webView);
}
@@ -522,7 +435,7 @@ static void webkitWebViewDisconnectFaviconDatabaseSignalHandlers(WebKitWebView*
{
WebKitWebViewPrivate* priv = webView->priv;
if (priv->faviconChangedHandlerID)
- g_signal_handler_disconnect(webkit_web_context_get_favicon_database(priv->context.get()), priv->faviconChangedHandlerID);
+ g_signal_handler_disconnect(webkit_web_context_get_favicon_database(priv->context), priv->faviconChangedHandlerID);
priv->faviconChangedHandlerID = 0;
}
@@ -583,71 +496,14 @@ static void webkitWebViewHandleDownloadRequest(WebKitWebViewBase* webViewBase, D
webkitDownloadSetWebView(download.get(), WEBKIT_WEB_VIEW(webViewBase));
}
-#if USE(LIBNOTIFY)
-static const char* gNotifyNotificationID = "wk-notify-notification";
-
-static void notifyNotificationClosed(NotifyNotification*, WebKitNotification* webNotification)
-{
- g_object_set_data(G_OBJECT(webNotification), gNotifyNotificationID, nullptr);
- webkit_notification_close(webNotification);
-}
-
-static void webNotificationClosed(WebKitNotification* webNotification)
-{
- NotifyNotification* notification = NOTIFY_NOTIFICATION(g_object_get_data(G_OBJECT(webNotification), gNotifyNotificationID));
- if (!notification)
- return;
-
- notify_notification_close(notification, nullptr);
- g_object_set_data(G_OBJECT(webNotification), gNotifyNotificationID, nullptr);
-}
-#endif // USE(LIBNOTIFY)
-
-static gboolean webkitWebViewShowNotification(WebKitWebView*, WebKitNotification* webNotification)
-{
-#if USE(LIBNOTIFY)
- if (!notify_is_initted())
- notify_init(g_get_prgname());
-
- NotifyNotification* notification = NOTIFY_NOTIFICATION(g_object_get_data(G_OBJECT(webNotification), gNotifyNotificationID));
- if (!notification) {
- notification = notify_notification_new(webkit_notification_get_title(webNotification),
- webkit_notification_get_body(webNotification), nullptr);
-
- g_signal_connect_object(notification, "closed", G_CALLBACK(notifyNotificationClosed), webNotification, static_cast<GConnectFlags>(0));
- g_signal_connect(webNotification, "closed", G_CALLBACK(webNotificationClosed), nullptr);
- g_object_set_data_full(G_OBJECT(webNotification), gNotifyNotificationID, notification, static_cast<GDestroyNotify>(g_object_unref));
- } else {
- notify_notification_update(notification, webkit_notification_get_title(webNotification),
- webkit_notification_get_body(webNotification), nullptr);
- }
-
- notify_notification_show(notification, nullptr);
- return TRUE;
-#else
- UNUSED_PARAM(webNotification);
- return FALSE;
-#endif
-}
-
static void webkitWebViewConstructed(GObject* object)
{
- G_OBJECT_CLASS(webkit_web_view_parent_class)->constructed(object);
+ if (G_OBJECT_CLASS(webkit_web_view_parent_class)->constructed)
+ G_OBJECT_CLASS(webkit_web_view_parent_class)->constructed(object);
WebKitWebView* webView = WEBKIT_WEB_VIEW(object);
WebKitWebViewPrivate* priv = webView->priv;
- if (priv->relatedView)
- priv->context = webkit_web_view_get_context(priv->relatedView);
- else if (!priv->context)
- priv->context = webkit_web_context_get_default();
- if (!priv->settings)
- priv->settings = adoptGRef(webkit_settings_new());
-
- webkitWebContextCreatePageForWebView(priv->context.get(), webView, priv->userContentManager.get(), priv->relatedView);
-
- priv->loadObserver = std::make_unique<PageLoadStateObserver>(webView);
- getPage(webView)->pageLoadState().addObserver(*priv->loadObserver);
-
+ webkitWebContextCreatePageForWebView(priv->context, webView, priv->group.get(), priv->relatedView);
// The related view is only valid during the construction.
priv->relatedView = nullptr;
@@ -660,12 +516,12 @@ static void webkitWebViewConstructed(GObject* object)
attachContextMenuClientToView(webView);
attachFormClientToView(webView);
- // This needs to be after attachUIClientToView() because WebPageProxy::setUIClient() calls setCanRunModal() with true.
- // See https://bugs.webkit.org/show_bug.cgi?id=135412.
- webkitWebViewUpdateSettings(webView);
-
priv->backForwardList = adoptGRef(webkitBackForwardListCreate(&getPage(webView)->backForwardList()));
priv->windowProperties = adoptGRef(webkitWindowPropertiesCreate());
+
+ webkitWebViewUpdateSettings(webView);
+ priv->settingsChangedHandlerID =
+ g_signal_connect(webkit_web_view_get_group(webView), "notify::settings", G_CALLBACK(webkitWebViewSettingsChanged), webView);
}
static void webkitWebViewSetProperty(GObject* object, guint propId, const GValue* value, GParamSpec* paramSpec)
@@ -675,7 +531,7 @@ static void webkitWebViewSetProperty(GObject* object, guint propId, const GValue
switch (propId) {
case PROP_WEB_CONTEXT: {
gpointer webContext = g_value_get_object(value);
- webView->priv->context = webContext ? WEBKIT_WEB_CONTEXT(webContext) : nullptr;
+ webView->priv->context = webContext ? WEBKIT_WEB_CONTEXT(webContext) : webkit_web_context_get_default();
break;
}
case PROP_RELATED_VIEW: {
@@ -683,21 +539,16 @@ static void webkitWebViewSetProperty(GObject* object, guint propId, const GValue
webView->priv->relatedView = relatedView ? WEBKIT_WEB_VIEW(relatedView) : nullptr;
break;
}
- case PROP_SETTINGS: {
- if (gpointer settings = g_value_get_object(value))
- webkit_web_view_set_settings(webView, WEBKIT_SETTINGS(settings));
- break;
- }
- case PROP_USER_CONTENT_MANAGER: {
- gpointer userContentManager = g_value_get_object(value);
- webView->priv->userContentManager = userContentManager ? WEBKIT_USER_CONTENT_MANAGER(userContentManager) : nullptr;
+ case PROP_GROUP: {
+ gpointer group = g_value_get_object(value);
+ webView->priv->group = group ? WEBKIT_WEB_VIEW_GROUP(group) : 0;
break;
}
case PROP_ZOOM_LEVEL:
webkit_web_view_set_zoom_level(webView, g_value_get_double(value));
break;
- case PROP_EDITABLE:
- webkit_web_view_set_editable(webView, g_value_get_boolean(value));
+ case PROP_VIEW_MODE:
+ webkit_web_view_set_view_mode(webView, static_cast<WebKitViewMode>(g_value_get_enum(value)));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
@@ -710,13 +561,10 @@ static void webkitWebViewGetProperty(GObject* object, guint propId, GValue* valu
switch (propId) {
case PROP_WEB_CONTEXT:
- g_value_set_object(value, webView->priv->context.get());
- break;
- case PROP_SETTINGS:
- g_value_set_object(value, webkit_web_view_get_settings(webView));
+ g_value_set_object(value, webView->priv->context);
break;
- case PROP_USER_CONTENT_MANAGER:
- g_value_set_object(value, webkit_web_view_get_user_content_manager(webView));
+ case PROP_GROUP:
+ g_value_set_object(value, webkit_web_view_get_group(webView));
break;
case PROP_TITLE:
g_value_set_string(value, webView->priv->title.data());
@@ -736,11 +584,8 @@ static void webkitWebViewGetProperty(GObject* object, guint propId, GValue* valu
case PROP_IS_LOADING:
g_value_set_boolean(value, webkit_web_view_is_loading(webView));
break;
- case PROP_IS_PLAYING_AUDIO:
- g_value_set_boolean(value, webkit_web_view_is_playing_audio(webView));
- break;
- case PROP_EDITABLE:
- g_value_set_boolean(value, webkit_web_view_is_editable(webView));
+ case PROP_VIEW_MODE:
+ g_value_set_enum(value, webkit_web_view_get_view_mode(webView));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
@@ -752,15 +597,11 @@ static void webkitWebViewDispose(GObject* object)
WebKitWebView* webView = WEBKIT_WEB_VIEW(object);
webkitWebViewCancelFaviconRequest(webView);
webkitWebViewDisconnectMainResourceResponseChangedSignalHandler(webView);
+ webkitWebViewDisconnectSettingsChangedSignalHandler(webView);
webkitWebViewDisconnectSettingsSignalHandlers(webView);
webkitWebViewDisconnectFaviconDatabaseSignalHandlers(webView);
- if (webView->priv->loadObserver) {
- getPage(webView)->pageLoadState().removeObserver(*webView->priv->loadObserver);
- webView->priv->loadObserver.reset();
- }
-
- webkitWebContextWebViewDestroyed(webView->priv->context.get(), webView);
+ webkitWebContextWebViewDestroyed(webView->priv->context, webView);
G_OBJECT_CLASS(webkit_web_view_parent_class)->dispose(object);
}
@@ -790,7 +631,6 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
webViewClass->permission_request = webkitWebViewPermissionRequest;
webViewClass->run_file_chooser = webkitWebViewRunFileChooser;
webViewClass->authenticate = webkitWebViewAuthenticate;
- webViewClass->show_notification = webkitWebViewShowNotification;
/**
* WebKitWebView:web-context:
@@ -824,37 +664,18 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
static_cast<GParamFlags>(WEBKIT_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)));
/**
- * WebKitWebView:settings:
- *
- * The #WebKitSettings of the view.
+ * WebKitWebView:group:
*
- * Since: 2.6
+ * The #WebKitWebViewGroup of the view.
*/
g_object_class_install_property(
gObjectClass,
- PROP_SETTINGS,
+ PROP_GROUP,
g_param_spec_object(
- "settings",
- _("WebView settings"),
- _("The WebKitSettings of the view"),
- WEBKIT_TYPE_SETTINGS,
- static_cast<GParamFlags>(WEBKIT_PARAM_WRITABLE | G_PARAM_CONSTRUCT)));
-
- /**
- * WebKitWebView:user-content-manager:
- *
- * The #WebKitUserContentManager of the view.
- *
- * Since: 2.6
- */
- g_object_class_install_property(
- gObjectClass,
- PROP_USER_CONTENT_MANAGER,
- g_param_spec_object(
- "user-content-manager",
- _("WebView user content manager"),
- _("The WebKitUserContentManager of the view"),
- WEBKIT_TYPE_USER_CONTENT_MANAGER,
+ "group",
+ _("WebView Group"),
+ _("The WebKitWebViewGroup of the view"),
+ WEBKIT_TYPE_WEB_VIEW_GROUP,
static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
/**
@@ -921,15 +742,13 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* The zoom level of the #WebKitWebView content.
* See webkit_web_view_set_zoom_level() for more details.
*/
- g_object_class_install_property(
- gObjectClass,
- PROP_ZOOM_LEVEL,
- g_param_spec_double(
- "zoom-level",
- _("Zoom level"),
- _("The zoom level of the view content"),
- 0, G_MAXDOUBLE, 1,
- WEBKIT_PARAM_READWRITE));
+ g_object_class_install_property(gObjectClass,
+ PROP_ZOOM_LEVEL,
+ g_param_spec_double("zoom-level",
+ "Zoom level",
+ _("The zoom level of the view content"),
+ 0, G_MAXDOUBLE, 1,
+ WEBKIT_PARAM_READWRITE));
/**
* WebKitWebView:is-loading:
@@ -941,53 +760,28 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* When the load operation finishes the property is set to %FALSE before
* #WebKitWebView::load-changed is emitted with %WEBKIT_LOAD_FINISHED.
*/
- g_object_class_install_property(
- gObjectClass,
- PROP_IS_LOADING,
- g_param_spec_boolean(
- "is-loading",
- _("Is Loading"),
- _("Whether the view is loading a page"),
- FALSE,
- WEBKIT_PARAM_READABLE));
-
- /**
- * WebKitWebView:is-playing-audio:
- *
- * Whether the #WebKitWebView is currently playing audio from a page.
- * This property becomes %TRUE as soon as web content starts playing any
- * kind of audio. When a page is no longer playing any kind of sound,
- * the property is set back to %FALSE.
- *
- * Since: 2.8
- */
- g_object_class_install_property(
- gObjectClass,
- PROP_IS_PLAYING_AUDIO,
- g_param_spec_boolean(
- "is-playing-audio",
- "Is Playing Audio",
- _("Whether the view is playing audio"),
- FALSE,
- WEBKIT_PARAM_READABLE));
+ g_object_class_install_property(gObjectClass,
+ PROP_IS_LOADING,
+ g_param_spec_boolean("is-loading",
+ "Is Loading",
+ _("Whether the view is loading a page"),
+ FALSE,
+ WEBKIT_PARAM_READABLE));
/**
- * WebKitWebView:editable:
- *
- * Whether the pages loaded inside #WebKitWebView are editable. For more
- * information see webkit_web_view_set_editable().
+ * WebKitWebView:view-mode:
*
- * Since: 2.8
+ * The #WebKitViewMode that is used to display the contents of a #WebKitWebView.
+ * See also webkit_web_view_set_view_mode().
*/
- g_object_class_install_property(
- gObjectClass,
- PROP_EDITABLE,
- g_param_spec_boolean(
- "editable",
- _("Editable"),
- _("Whether the content can be modified by the user."),
- FALSE,
- WEBKIT_PARAM_READWRITE));
+ g_object_class_install_property(gObjectClass,
+ PROP_VIEW_MODE,
+ g_param_spec_enum("view-mode",
+ "View Mode",
+ _("The view mode to display the web view contents"),
+ WEBKIT_TYPE_VIEW_MODE,
+ WEBKIT_VIEW_MODE_WEB,
+ WEBKIT_PARAM_READWRITE));
/**
* WebKitWebView::load-changed:
@@ -1085,16 +879,16 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
/**
* WebKitWebView::load-failed-with-tls-errors:
* @web_view: the #WebKitWebView on which the signal is emitted
- * @failing_uri: the URI that failed to load
- * @certificate: a #GTlsCertificate
- * @errors: a #GTlsCertificateFlags with the verification status of @certificate
+ * @info: a #WebKitCertificateInfo
+ * @host: the host on which the error occurred
*
- * Emitted when a TLS error occurs during a load operation.
- * To allow an exception for this @certificate
- * and the host of @failing_uri use webkit_web_context_allow_tls_certificate_for_host().
+ * Emitted when a TLS error occurs during a load operation. The @info
+ * object contains information about the error such as the #GTlsCertificate
+ * and the #GTlsCertificateFlags. To allow an exception for this certificate
+ * and this host use webkit_web_context_allow_tls_certificate_for_host().
*
- * To handle this signal asynchronously you should call g_object_ref() on @certificate
- * and return %TRUE.
+ * To handle this signal asynchronously you should copy the #WebKitCertificateInfo
+ * with webkit_certificate_info_copy() and return %TRUE.
*
* If %FALSE is returned, #WebKitWebView::load-failed will be emitted. The load
* will finish regardless of the returned value.
@@ -1102,7 +896,7 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* Returns: %TRUE to stop other handlers from being invoked for the event.
* %FALSE to propagate the event further.
*
- * Since: 2.6
+ * Since: 2.4
*/
signals[LOAD_FAILED_WITH_TLS_ERRORS] =
g_signal_new("load-failed-with-tls-errors",
@@ -1110,27 +904,22 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(WebKitWebViewClass, load_failed_with_tls_errors),
g_signal_accumulator_true_handled, 0 /* accumulator data */,
- g_cclosure_marshal_generic,
- G_TYPE_BOOLEAN, 3,
- G_TYPE_STRING,
- G_TYPE_TLS_CERTIFICATE,
- G_TYPE_TLS_CERTIFICATE_FLAGS);
+ webkit_marshal_BOOLEAN__BOXED_STRING,
+ G_TYPE_BOOLEAN, 2, /* number of parameters */
+ WEBKIT_TYPE_CERTIFICATE_INFO | G_SIGNAL_TYPE_STATIC_SCOPE,
+ G_TYPE_STRING);
/**
* WebKitWebView::create:
* @web_view: the #WebKitWebView on which the signal is emitted
- * @navigation_action: a #WebKitNavigationAction
*
* Emitted when the creation of a new #WebKitWebView is requested.
* If this signal is handled the signal handler should return the
* newly created #WebKitWebView.
*
- * The #WebKitNavigationAction parameter contains information about the
- * navigation action that triggered this signal.
- *
* When using %WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES
* process model, the new #WebKitWebView should be related to
- * @web_view to share the same web process, see webkit_web_view_new_with_related_view()
+ * @web_view to share the same web process, see webkit_web_view_new_with_related_view
* for more details.
*
* The new #WebKitWebView should not be displayed to the user
@@ -1139,15 +928,14 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* Returns: (transfer full): a newly allocated #WebKitWebView widget
* or %NULL to propagate the event further.
*/
- signals[CREATE] = g_signal_new(
- "create",
- G_TYPE_FROM_CLASS(webViewClass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(WebKitWebViewClass, create),
- webkitWebViewAccumulatorObjectHandled, 0,
- g_cclosure_marshal_generic,
- GTK_TYPE_WIDGET, 1,
- WEBKIT_TYPE_NAVIGATION_ACTION | G_SIGNAL_TYPE_STATIC_SCOPE);
+ signals[CREATE] =
+ g_signal_new("create",
+ G_TYPE_FROM_CLASS(webViewClass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(WebKitWebViewClass, create),
+ webkitWebViewAccumulatorObjectHandled, 0,
+ webkit_marshal_OBJECT__VOID,
+ GTK_TYPE_WIDGET, 0);
/**
* WebKitWebView::ready-to-show:
@@ -1352,10 +1140,9 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* request has not been handled, webkit_permission_request_deny()
* will be the default action.
*
- * If the signal is not handled, the @request will be completed automatically
- * by the specific #WebKitPermissionRequest that could allow or deny it. Check the
- * documentation of classes implementing #WebKitPermissionRequest interface to know
- * their default action.
+ * By default, if the signal is not handled,
+ * webkit_permission_request_deny() will be called over the
+ * #WebKitPermissionRequest.
*
* Returns: %TRUE to stop other handlers from being invoked for the event.
* %FALSE to propagate the event further.
@@ -1695,66 +1482,21 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
webkit_marshal_BOOLEAN__OBJECT,
G_TYPE_BOOLEAN, 1, /* number of parameters */
WEBKIT_TYPE_AUTHENTICATION_REQUEST);
+}
- /**
- * WebKitWebView::show-notification:
- * @web_view: the #WebKitWebView
- * @notification: a #WebKitNotification
- *
- * This signal is emitted when a notification should be presented to the
- * user. The @notification is kept alive until either: 1) the web page cancels it
- * or 2) a navigation happens.
- *
- * The default handler will emit a notification using libnotify, if built with
- * support for it.
- *
- * Returns: %TRUE to stop other handlers from being invoked. %FALSE otherwise.
- *
- * Since: 2.8
- */
- signals[SHOW_NOTIFICATION] =
- g_signal_new("show-notification",
- G_TYPE_FROM_CLASS(gObjectClass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(WebKitWebViewClass, show_notification),
- g_signal_accumulator_true_handled, nullptr /* accumulator data */,
- webkit_marshal_BOOLEAN__OBJECT,
- G_TYPE_BOOLEAN, 1,
- WEBKIT_TYPE_NOTIFICATION);
+static void webkitWebViewSetIsLoading(WebKitWebView* webView, bool isLoading)
+{
+ if (webView->priv->isLoading == isLoading)
+ return;
- /**
- * WebKitWebView::run-color-chooser:
- * @web_view: the #WebKitWebView on which the signal is emitted
- * @request: a #WebKitColorChooserRequest
- *
- * This signal is emitted when the user interacts with a &lt;input
- * type='color' /&gt; HTML element, requesting from WebKit to show
- * a dialog to select a color. To let the application know the details of
- * the color chooser, as well as to allow the client application to either
- * cancel the request or perform an actual color selection, the signal will
- * pass an instance of the #WebKitColorChooserRequest in the @request
- * argument.
- *
- * It is possible to handle this request asynchronously by increasing the
- * reference count of the request.
- *
- * The default signal handler will asynchronously run a regular
- * #GtkColorChooser for the user to interact with.
- *
- * Returns: %TRUE to stop other handlers from being invoked for the event.
- * %FALSE to propagate the event further.
- *
- * Since: 2.8
- */
- signals[RUN_COLOR_CHOOSER] =
- g_signal_new("run-color-chooser",
- G_TYPE_FROM_CLASS(webViewClass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(WebKitWebViewClass, run_color_chooser),
- g_signal_accumulator_true_handled, nullptr,
- webkit_marshal_BOOLEAN__OBJECT,
- G_TYPE_BOOLEAN, 1,
- WEBKIT_TYPE_COLOR_CHOOSER_REQUEST);
+ webView->priv->isLoading = isLoading;
+ g_object_freeze_notify(G_OBJECT(webView));
+ g_object_notify(G_OBJECT(webView), "is-loading");
+
+ // Update the URI if a new load has started.
+ if (webView->priv->isLoading)
+ webkitWebViewUpdateURI(webView);
+ g_object_thaw_notify(G_OBJECT(webView));
}
static void webkitWebViewCancelAuthenticationRequest(WebKitWebView* webView)
@@ -1766,30 +1508,19 @@ static void webkitWebViewCancelAuthenticationRequest(WebKitWebView* webView)
webView->priv->authenticationRequest.clear();
}
-static void webkitWebViewEmitLoadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent, bool isDelayedEvent)
+static void webkitWebViewEmitLoadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent)
{
if (loadEvent == WEBKIT_LOAD_STARTED) {
+ webkitWebViewSetIsLoading(webView, true);
webkitWebViewWatchForChangesInFavicon(webView);
webkitWebViewCancelAuthenticationRequest(webView);
} else if (loadEvent == WEBKIT_LOAD_FINISHED) {
- if (isDelayedEvent) {
- // In case of the delayed event, we need to manually set is-loading to false.
- webkitWebViewSetIsLoading(webView, false);
- }
+ webkitWebViewSetIsLoading(webView, false);
webkitWebViewCancelAuthenticationRequest(webView);
webkitWebViewDisconnectMainResourceResponseChangedSignalHandler(webView);
- }
-
+ } else
+ webkitWebViewUpdateURI(webView);
g_signal_emit(webView, signals[LOAD_CHANGED], 0, loadEvent);
-
- if (isDelayedEvent) {
- if (loadEvent == WEBKIT_LOAD_COMMITTED)
- webView->priv->waitingForMainResource = false;
- else if (loadEvent == WEBKIT_LOAD_FINISHED) {
- // Manually set is-loading again in case a new load was started.
- webkitWebViewSetIsLoading(webView, getPage(webView)->pageLoadState().isLoading());
- }
- }
}
static void webkitWebViewEmitDelayedLoadEvents(WebKitWebView* webView)
@@ -1800,8 +1531,9 @@ static void webkitWebViewEmitDelayedLoadEvents(WebKitWebView* webView)
ASSERT(priv->lastDelayedEvent == WEBKIT_LOAD_COMMITTED || priv->lastDelayedEvent == WEBKIT_LOAD_FINISHED);
if (priv->lastDelayedEvent == WEBKIT_LOAD_FINISHED)
- webkitWebViewEmitLoadChanged(webView, WEBKIT_LOAD_COMMITTED, true);
- webkitWebViewEmitLoadChanged(webView, priv->lastDelayedEvent, true);
+ webkitWebViewEmitLoadChanged(webView, WEBKIT_LOAD_COMMITTED);
+ webkitWebViewEmitLoadChanged(webView, priv->lastDelayedEvent);
+ priv->waitingForMainResource = false;
}
void webkitWebViewLoadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent)
@@ -1816,7 +1548,7 @@ void webkitWebViewLoadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent)
priv->mainResource = 0;
priv->waitingForMainResource = false;
} else if (loadEvent == WEBKIT_LOAD_COMMITTED) {
- WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(priv->context.get());
+ WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(priv->context);
GUniquePtr<char> faviconURI(webkit_favicon_database_get_favicon_uri(database, priv->activeURI.data()));
webkitWebViewUpdateFaviconURI(webView, faviconURI.get());
@@ -1832,11 +1564,12 @@ void webkitWebViewLoadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent)
if (priv->waitingForMainResource)
priv->lastDelayedEvent = loadEvent;
else
- webkitWebViewEmitLoadChanged(webView, loadEvent, false);
+ webkitWebViewEmitLoadChanged(webView, loadEvent);
}
void webkitWebViewLoadFailed(WebKitWebView* webView, WebKitLoadEvent loadEvent, const char* failingURI, GError *error)
{
+ webkitWebViewSetIsLoading(webView, false);
webkitWebViewCancelAuthenticationRequest(webView);
gboolean returnValue;
@@ -1846,12 +1579,15 @@ void webkitWebViewLoadFailed(WebKitWebView* webView, WebKitLoadEvent loadEvent,
void webkitWebViewLoadFailedWithTLSErrors(WebKitWebView* webView, const char* failingURI, GError* error, GTlsCertificateFlags tlsErrors, GTlsCertificate* certificate)
{
+ webkitWebViewSetIsLoading(webView, false);
webkitWebViewCancelAuthenticationRequest(webView);
- WebKitTLSErrorsPolicy tlsErrorsPolicy = webkit_web_context_get_tls_errors_policy(webView->priv->context.get());
+ WebKitTLSErrorsPolicy tlsErrorsPolicy = webkit_web_context_get_tls_errors_policy(webView->priv->context);
if (tlsErrorsPolicy == WEBKIT_TLS_ERRORS_POLICY_FAIL) {
+ GUniquePtr<SoupURI> soupURI(soup_uri_new(failingURI));
+ WebKitCertificateInfo info(certificate, tlsErrors);
gboolean returnValue;
- g_signal_emit(webView, signals[LOAD_FAILED_WITH_TLS_ERRORS], 0, failingURI, certificate, tlsErrors, &returnValue);
+ g_signal_emit(webView, signals[LOAD_FAILED_WITH_TLS_ERRORS], 0, &info, soupURI->host, &returnValue);
if (!returnValue)
g_signal_emit(webView, signals[LOAD_FAILED], 0, WEBKIT_LOAD_STARTED, failingURI, error, &returnValue);
}
@@ -1859,10 +1595,39 @@ void webkitWebViewLoadFailedWithTLSErrors(WebKitWebView* webView, const char* fa
g_signal_emit(webView, signals[LOAD_CHANGED], 0, WEBKIT_LOAD_FINISHED);
}
-WebPageProxy* webkitWebViewCreateNewPage(WebKitWebView* webView, const WindowFeatures& windowFeatures, WebKitNavigationAction* navigationAction)
+void webkitWebViewSetTitle(WebKitWebView* webView, const CString& title)
+{
+ WebKitWebViewPrivate* priv = webView->priv;
+ if (priv->title == title)
+ return;
+
+ priv->title = title;
+ g_object_notify(G_OBJECT(webView), "title");
+}
+
+void webkitWebViewSetEstimatedLoadProgress(WebKitWebView* webView, double estimatedLoadProgress)
+{
+ if (webView->priv->estimatedLoadProgress == estimatedLoadProgress)
+ return;
+
+ webView->priv->estimatedLoadProgress = estimatedLoadProgress;
+ g_object_notify(G_OBJECT(webView), "estimated-load-progress");
+}
+
+void webkitWebViewUpdateURI(WebKitWebView* webView)
+{
+ CString activeURI = getPage(webView)->pageLoadState().activeURL().utf8();
+ if (webView->priv->activeURI == activeURI)
+ return;
+
+ webView->priv->activeURI = activeURI;
+ g_object_notify(G_OBJECT(webView), "uri");
+}
+
+WebPageProxy* webkitWebViewCreateNewPage(WebKitWebView* webView, ImmutableDictionary* windowFeatures)
{
WebKitWebView* newWebView;
- g_signal_emit(webView, signals[CREATE], 0, navigationAction, &newWebView);
+ g_signal_emit(webView, signals[CREATE], 0, &newWebView);
if (!newWebView)
return 0;
@@ -1882,14 +1647,9 @@ void webkitWebViewRunAsModal(WebKitWebView* webView)
g_signal_emit(webView, signals[RUN_AS_MODAL], 0, NULL);
webView->priv->modalLoop = adoptGRef(g_main_loop_new(0, FALSE));
-
-// This is to suppress warnings about gdk_threads_leave and gdk_threads_enter.
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
gdk_threads_leave();
g_main_loop_run(webView->priv->modalLoop.get());
gdk_threads_enter();
-#pragma GCC diagnostic pop
}
void webkitWebViewClosePage(WebKitWebView* webView)
@@ -1932,9 +1692,9 @@ void webkitWebViewMakePermissionRequest(WebKitWebView* webView, WebKitPermission
g_signal_emit(webView, signals[PERMISSION_REQUEST], 0, request, &returnValue);
}
-void webkitWebViewMouseTargetChanged(WebKitWebView* webView, const WebHitTestResult::Data& hitTestResult, unsigned modifiers)
+void webkitWebViewMouseTargetChanged(WebKitWebView* webView, WebHitTestResult* hitTestResult, unsigned modifiers)
{
- webkitWebViewBaseSetTooltipArea(WEBKIT_WEB_VIEW_BASE(webView), hitTestResult.elementBoundingBox);
+ webkitWebViewBaseSetTooltipArea(WEBKIT_WEB_VIEW_BASE(webView), hitTestResult->elementBoundingBox());
WebKitWebViewPrivate* priv = webView->priv;
if (priv->mouseTargetHitTestResult
@@ -2076,22 +1836,19 @@ static void contextMenuDismissed(GtkMenuShell*, WebKitWebView* webView)
g_signal_emit(webView, signals[CONTEXT_MENU_DISMISSED], 0, NULL);
}
-void webkitWebViewPopulateContextMenu(WebKitWebView* webView, const Vector<WebContextMenuItemData>& proposedMenu, const WebHitTestResult::Data& hitTestResultData, GVariant* userData)
+void webkitWebViewPopulateContextMenu(WebKitWebView* webView, API::Array* proposedMenu, WebHitTestResult* webHitTestResult)
{
WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(webView);
WebContextMenuProxyGtk* contextMenuProxy = webkitWebViewBaseGetActiveContextMenuProxy(webViewBase);
ASSERT(contextMenuProxy);
GRefPtr<WebKitContextMenu> contextMenu = adoptGRef(webkitContextMenuCreate(proposedMenu));
- if (hitTestResultData.isContentEditable)
+ if (webHitTestResult->isContentEditable())
webkitWebViewCreateAndAppendInputMethodsMenuItem(webView, contextMenu.get());
- GRefPtr<WebKitHitTestResult> hitTestResult = adoptGRef(webkitHitTestResultCreate(hitTestResultData));
+ GRefPtr<WebKitHitTestResult> hitTestResult = adoptGRef(webkitHitTestResultCreate(webHitTestResult));
GUniquePtr<GdkEvent> contextMenuEvent(webkitWebViewBaseTakeContextMenuEvent(webViewBase));
- if (userData)
- webkit_context_menu_set_user_data(WEBKIT_CONTEXT_MENU(contextMenu.get()), userData);
-
gboolean returnValue;
g_signal_emit(webView, signals[CONTEXT_MENU], 0, contextMenu.get(), contextMenuEvent.get(), hitTestResult.get(), &returnValue);
if (returnValue)
@@ -2114,7 +1871,7 @@ void webkitWebViewSubmitFormRequest(WebKitWebView* webView, WebKitFormSubmission
void webkitWebViewHandleAuthenticationChallenge(WebKitWebView* webView, AuthenticationChallengeProxy* authenticationChallenge)
{
- gboolean privateBrowsingEnabled = webkit_settings_get_enable_private_browsing(webView->priv->settings.get());
+ gboolean privateBrowsingEnabled = webkit_settings_get_enable_private_browsing(webkit_web_view_get_settings(webView));
webView->priv->authenticationRequest = adoptGRef(webkitAuthenticationRequestCreate(authenticationChallenge, privateBrowsingEnabled));
gboolean returnValue;
g_signal_emit(webView, signals[AUTHENTICATE], 0, webView->priv->authenticationRequest.get(), &returnValue);
@@ -2125,46 +1882,12 @@ void webkitWebViewInsecureContentDetected(WebKitWebView* webView, WebKitInsecure
g_signal_emit(webView, signals[INSECURE_CONTENT_DETECTED], 0, type);
}
-bool webkitWebViewEmitShowNotification(WebKitWebView* webView, WebKitNotification* webNotification)
-{
- gboolean handled;
- g_signal_emit(webView, signals[SHOW_NOTIFICATION], 0, webNotification, &handled);
- return handled;
-}
-
-bool webkitWebViewEmitRunColorChooser(WebKitWebView* webView, WebKitColorChooserRequest* request)
-{
- gboolean handled;
- g_signal_emit(webView, signals[RUN_COLOR_CHOOSER], 0, request, &handled);
- return handled;
-}
-
-void webkitWebViewSelectionDidChange(WebKitWebView* webView)
-{
- if (!webView->priv->editorState)
- return;
-
- webkitEditorStateChanged(webView->priv->editorState.get(), getPage(webView)->editorState());
-}
-
-void webkitWebViewRequestInstallMissingMediaPlugins(WebKitWebView* webView, InstallMissingMediaPluginsPermissionRequest& request)
-{
-#if ENABLE(VIDEO)
- GRefPtr<WebKitInstallMissingMediaPluginsPermissionRequest> installMediaPluginsPermissionRequest = adoptGRef(webkitInstallMissingMediaPluginsPermissionRequestCreate(request));
- webkitWebViewMakePermissionRequest(webView, WEBKIT_PERMISSION_REQUEST(installMediaPluginsPermissionRequest.get()));
-#else
- ASSERT_NOT_REACHED();
-#endif
-}
-
/**
* webkit_web_view_new:
*
- * Creates a new #WebKitWebView with the default #WebKitWebContext and
- * no #WebKitUserContentManager associated with it.
- * See also webkit_web_view_new_with_context(),
- * webkit_web_view_new_with_user_content_manager(), and
- * webkit_web_view_new_with_settings().
+ * Creates a new #WebKitWebView with the default #WebKitWebContext and the
+ * default #WebKitWebViewGroup.
+ * See also webkit_web_view_new_with_context() and webkit_web_view_new_with_group().
*
* Returns: The newly created #WebKitWebView widget
*/
@@ -2177,10 +1900,9 @@ GtkWidget* webkit_web_view_new()
* webkit_web_view_new_with_context:
* @context: the #WebKitWebContext to be used by the #WebKitWebView
*
- * Creates a new #WebKitWebView with the given #WebKitWebContext and
- * no #WebKitUserContentManager associated with it.
- * See also webkit_web_view_new_with_user_content_manager() and
- * webkit_web_view_new_with_settings().
+ * Creates a new #WebKitWebView with the given #WebKitWebContext and the
+ * default #WebKitWebViewGroup.
+ * See also webkit_web_view_new_with_group().
*
* Returns: The newly created #WebKitWebView widget
*/
@@ -2203,9 +1925,6 @@ GtkWidget* webkit_web_view_new_with_context(WebKitWebContext* context)
* You can also use this method to implement other process models based on %WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES,
* like for example, sharing the same web process for all the views in the same security domain.
*
- * The newly created #WebKitWebView will also have the same #WebKitUserContentManager
- * and #WebKitSettings as @web_view.
- *
* Returns: (transfer full): The newly created #WebKitWebView widget
*
* Since: 2.4
@@ -2214,48 +1933,24 @@ GtkWidget* webkit_web_view_new_with_related_view(WebKitWebView* webView)
{
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), nullptr);
- return GTK_WIDGET(g_object_new(WEBKIT_TYPE_WEB_VIEW,
- "user-content-manager", webView->priv->userContentManager.get(),
- "settings", webView->priv->settings.get(),
- "related-view", webView,
- nullptr));
-}
-
-/**
- * webkit_web_view_new_with_settings:
- * @settings: a #WebKitSettings
- *
- * Creates a new #WebKitWebView with the given #WebKitSettings.
- * See also webkit_web_view_new_with_context(), and
- * webkit_web_view_new_with_user_content_manager().
- *
- * Returns: The newly created #WebKitWebView widget
- *
- * Since: 2.6
- */
-GtkWidget* webkit_web_view_new_with_settings(WebKitSettings* settings)
-{
- g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), nullptr);
- return GTK_WIDGET(g_object_new(WEBKIT_TYPE_WEB_VIEW, "settings", settings, nullptr));
+ return GTK_WIDGET(g_object_new(WEBKIT_TYPE_WEB_VIEW, "related-view", webView, nullptr));
}
/**
- * webkit_web_view_new_with_user_content_manager:
- * @user_content_manager: a #WebKitUserContentManager.
+ * webkit_web_view_new_with_group:
+ * @group: a #WebKitWebViewGroup
*
- * Creates a new #WebKitWebView with the given #WebKitUserContentManager.
- * The content loaded in the view may be affected by the content injected
- * in the view by the user content manager.
+ * Creates a new #WebKitWebView with the given #WebKitWebViewGroup.
+ * The view will be part of @group and it will be affected by the
+ * group properties like the settings.
*
* Returns: The newly created #WebKitWebView widget
- *
- * Since: 2.6
*/
-GtkWidget* webkit_web_view_new_with_user_content_manager(WebKitUserContentManager* userContentManager)
+GtkWidget* webkit_web_view_new_with_group(WebKitWebViewGroup* group)
{
- g_return_val_if_fail(WEBKIT_IS_USER_CONTENT_MANAGER(userContentManager), nullptr);
+ g_return_val_if_fail(WEBKIT_IS_WEB_VIEW_GROUP(group), 0);
- return GTK_WIDGET(g_object_new(WEBKIT_TYPE_WEB_VIEW, "user-content-manager", userContentManager, nullptr));
+ return GTK_WIDGET(g_object_new(WEBKIT_TYPE_WEB_VIEW, "group", group, NULL));
}
/**
@@ -2270,25 +1965,25 @@ WebKitWebContext* webkit_web_view_get_context(WebKitWebView *webView)
{
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
- return webView->priv->context.get();
+ return webView->priv->context;
}
/**
- * webkit_web_view_get_user_content_manager:
+ * webkit_web_view_get_group:
* @web_view: a #WebKitWebView
*
- * Gets the user content manager associated to @web_view, or %NULL if the
- * view does not have an user content manager.
+ * Gets the group @web_view belongs to.
*
- * Returns: (transfer none): the #WebKitUserContentManager associated with the view
- *
- * Since: 2.6
+ * Returns: (transfer none): the #WebKitWebViewGroup to which the view belongs
*/
-WebKitUserContentManager* webkit_web_view_get_user_content_manager(WebKitWebView* webView)
+WebKitWebViewGroup* webkit_web_view_get_group(WebKitWebView* webView)
{
- g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), nullptr);
+ g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
+
+ if (webView->priv->group)
+ return webView->priv->group.get();
- return webView->priv->userContentManager.get();
+ return webkitWebContextGetDefaultWebViewGroup(webView->priv->context);
}
/**
@@ -2372,45 +2067,6 @@ void webkit_web_view_load_plain_text(WebKitWebView* webView, const gchar* plainT
getPage(webView)->loadPlainTextString(String::fromUTF8(plainText));
}
-static void releaseGBytes(unsigned char*, const void* bytes)
-{
- // Balanced by g_bytes_ref in webkit_web_view_load_bytes().
- g_bytes_unref(static_cast<GBytes*>(const_cast<void*>(bytes)));
-}
-
-/**
- * webkit_web_view_load_bytes:
- * @web_view: a #WebKitWebView
- * @bytes: input data to load
- * @mime_type: (allow-none): the MIME type of @bytes, or %NULL
- * @encoding: (allow-none): the character encoding of @bytes, or %NULL
- * @base_uri: (allow-none): the base URI for relative locations or %NULL
- *
- * Load the specified @bytes into @web_view using the given @mime_type and @encoding.
- * When @mime_type is %NULL, it defaults to "text/html".
- * When @encoding is %NULL, it defaults to "UTF-8".
- * When @base_uri is %NULL, it defaults to "about:blank".
- * You can monitor the load operation by connecting to #WebKitWebView::load-changed signal.
- *
- * Since: 2.6
- */
-void webkit_web_view_load_bytes(WebKitWebView* webView, GBytes* bytes, const char* mimeType, const char* encoding, const char* baseURI)
-{
- g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
- g_return_if_fail(bytes);
-
- gsize bytesDataSize;
- gconstpointer bytesData = g_bytes_get_data(bytes, &bytesDataSize);
- g_return_if_fail(bytesDataSize);
-
- // Balanced by g_bytes_unref in releaseGBytes.
- g_bytes_ref(bytes);
-
- Ref<API::Data> data = API::Data::createWithoutCopying(static_cast<const unsigned char*>(bytesData), bytesDataSize, releaseGBytes, bytes);
- getPage(webView)->loadData(data.ptr(), mimeType ? String::fromUTF8(mimeType) : String::fromUTF8("text/html"),
- encoding ? String::fromUTF8(encoding) : String::fromUTF8("UTF-8"), String::fromUTF8(baseURI));
-}
-
/**
* webkit_web_view_load_request:
* @web_view: a #WebKitWebView
@@ -2529,27 +2185,6 @@ gboolean webkit_web_view_is_loading(WebKitWebView* webView)
}
/**
- * webkit_web_view_is_playing_audio:
- * @web_view: a #WebKitWebView
- *
- * Gets the value of the #WebKitWebView:is-playing-audio property.
- * You can monitor when a page in a #WebKitWebView is playing audio by
- * connecting to the notify::is-playing-audio signal of @web_view. This
- * is useful when the application wants to provide visual feedback when a
- * page is producing sound.
- *
- * Returns: %TRUE if a page in @web_view is playing audio or %FALSE otherwise.
- *
- * Since: 2.8
- */
-gboolean webkit_web_view_is_playing_audio(WebKitWebView* webView)
-{
- g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE);
-
- return getPage(webView)->isPlayingAudio();
-}
-
-/**
* webkit_web_view_go_back:
* @web_view: a #WebKitWebView
*
@@ -2747,7 +2382,7 @@ void webkit_web_view_set_custom_charset(WebKitWebView* webView, const gchar* cha
gdouble webkit_web_view_get_estimated_load_progress(WebKitWebView* webView)
{
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
- return getPage(webView)->pageLoadState().estimatedProgress();
+ return webView->priv->estimatedLoadProgress;
}
/**
@@ -2788,30 +2423,16 @@ void webkit_web_view_go_to_back_forward_list_item(WebKitWebView* webView, WebKit
* @web_view: a #WebKitWebView
* @settings: a #WebKitSettings
*
- * Sets the #WebKitSettings to be applied to @web_view. The
- * existing #WebKitSettings of @web_view will be replaced by
- * @settings. New settings are applied immediately on @web_view.
- * The same #WebKitSettings object can be shared
- * by multiple #WebKitWebView<!-- -->s.
+ * Sets the #WebKitSettings to be applied to @web_view.
+ * This is a convenient method to set new settings to the
+ * #WebKitWebViewGroup @web_view belongs to.
+ * New settings are applied immediately on all #WebKitWebView<!-- -->s
+ * in the @web_view group.
+ * See also webkit_web_view_group_set_settings().
*/
void webkit_web_view_set_settings(WebKitWebView* webView, WebKitSettings* settings)
{
- g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
- g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
-
- if (webView->priv->settings == settings)
- return;
-
- // The "settings" property is set on construction, and in that
- // case webkit_web_view_set_settings() will be called *before*
- // any settings have been assigned. In that case there are no
- // signal handlers to disconnect.
- if (webView->priv->settings)
- webkitWebViewDisconnectSettingsSignalHandlers(webView);
-
- webView->priv->settings = settings;
- webkitWebViewUpdateSettings(webView);
- g_object_notify(G_OBJECT(webView), "settings");
+ webkit_web_view_group_set_settings(webkit_web_view_get_group(webView), settings);
}
/**
@@ -2819,25 +2440,19 @@ void webkit_web_view_set_settings(WebKitWebView* webView, WebKitSettings* settin
* @web_view: a #WebKitWebView
*
* Gets the #WebKitSettings currently applied to @web_view.
- * If no other #WebKitSettings have been explicitly applied to
- * @web_view with webkit_web_view_set_settings(), the default
- * #WebKitSettings will be returned. This method always returns
- * a valid #WebKitSettings object.
- * To modify any of the @web_view settings, you can either create
- * a new #WebKitSettings object with webkit_settings_new(), setting
- * the desired preferences, and then replace the existing @web_view
- * settings with webkit_web_view_set_settings() or get the existing
- * @web_view settings and update it directly. #WebKitSettings objects
- * can be shared by multiple #WebKitWebView<!-- -->s, so modifying
+ * This is a convenient method to get the settings of the
+ * #WebKitWebViewGroup @web_view belongs to.
+ * #WebKitSettings objects are shared by all the #WebKitWebView<!-- -->s
+ * in the same #WebKitWebViewGroup, so modifying
* the settings of a #WebKitWebView would affect other
- * #WebKitWebView<!-- -->s using the same #WebKitSettings.
+ * #WebKitWebView<!-- -->s of the same group.
+ * See also webkit_web_view_group_get_settings().
*
* Returns: (transfer none): the #WebKitSettings attached to @web_view
*/
WebKitSettings* webkit_web_view_get_settings(WebKitWebView* webView)
{
- g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), nullptr);
- return webView->priv->settings.get();
+ return webkit_web_view_group_get_settings(webkit_web_view_get_group(webView));
}
/**
@@ -2872,7 +2487,7 @@ void webkit_web_view_set_zoom_level(WebKitWebView* webView, gdouble zoomLevel)
return;
WebPageProxy* page = getPage(webView);
- if (webkit_settings_get_zoom_text_only(webView->priv->settings.get()))
+ if (webkit_settings_get_zoom_text_only(webkit_web_view_get_settings(webView)))
page->setTextZoomFactor(zoomLevel);
else
page->setPageZoomFactor(zoomLevel);
@@ -2893,10 +2508,16 @@ gdouble webkit_web_view_get_zoom_level(WebKitWebView* webView)
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 1);
WebPageProxy* page = getPage(webView);
- gboolean zoomTextOnly = webkit_settings_get_zoom_text_only(webView->priv->settings.get());
+ gboolean zoomTextOnly = webkit_settings_get_zoom_text_only(webkit_web_view_get_settings(webView));
return zoomTextOnly ? page->textZoomFactor() : page->pageZoomFactor();
}
+static void didValidateCommand(WKStringRef command, bool isEnabled, int32_t state, WKErrorRef, void* context)
+{
+ GRefPtr<GTask> task = adoptGRef(G_TASK(context));
+ g_task_return_boolean(task.get(), isEnabled);
+}
+
/**
* webkit_web_view_can_execute_editing_command:
* @web_view: a #WebKitWebView
@@ -2916,9 +2537,7 @@ void webkit_web_view_can_execute_editing_command(WebKitWebView* webView, const c
g_return_if_fail(command);
GTask* task = g_task_new(webView, cancellable, callback, userData);
- getPage(webView)->validateCommand(String::fromUTF8(command), [task](const String&, bool isEnabled, int32_t, WebKit::CallbackBase::Error) {
- g_task_return_boolean(adoptGRef(task).get(), isEnabled);
- });
+ getPage(webView)->validateCommand(String::fromUTF8(command), ValidateCommandCallback::create(task, didValidateCommand));
}
/**
@@ -2957,27 +2576,6 @@ void webkit_web_view_execute_editing_command(WebKitWebView* webView, const char*
}
/**
- * webkit_web_view_execute_editing_command_with_argument:
- * @web_view: a #WebKitWebView
- * @command: the command to execute
- * @argument: the command argument
- *
- * Request to execute the given @command with @argument for @web_view. You can use
- * webkit_web_view_can_execute_editing_command() to check whether
- * it's possible to execute the command.
- *
- * Since: 2.10
- */
-void webkit_web_view_execute_editing_command_with_argument(WebKitWebView* webView, const char* command, const char* argument)
-{
- g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
- g_return_if_fail(command);
- g_return_if_fail(argument);
-
- getPage(webView)->executeEditCommand(String::fromUTF8(command), String::fromUTF8(argument));
-}
-
-/**
* webkit_web_view_get_find_controller:
* @web_view: the #WebKitWebView
*
@@ -3016,20 +2614,20 @@ JSGlobalContextRef webkit_web_view_get_javascript_global_context(WebKitWebView*
return webView->priv->javascriptGlobalContext;
}
-static void webkitWebViewRunJavaScriptCallback(API::SerializedScriptValue* wkSerializedScriptValue, GTask* task)
+static void webkitWebViewRunJavaScriptCallback(WKSerializedScriptValueRef wkSerializedScriptValue, WKErrorRef, void* context)
{
- if (g_task_return_error_if_cancelled(task))
+ GRefPtr<GTask> task = adoptGRef(G_TASK(context));
+ if (g_task_return_error_if_cancelled(task.get()))
return;
if (!wkSerializedScriptValue) {
- g_task_return_new_error(task, WEBKIT_JAVASCRIPT_ERROR, WEBKIT_JAVASCRIPT_ERROR_SCRIPT_FAILED,
+ g_task_return_new_error(task.get(), WEBKIT_JAVASCRIPT_ERROR, WEBKIT_JAVASCRIPT_ERROR_SCRIPT_FAILED,
_("An exception was raised in JavaScript"));
return;
}
- WebKitWebView* webView = WEBKIT_WEB_VIEW(g_task_get_source_object(task));
- g_task_return_pointer(task, webkitJavascriptResultCreate(webView,
- *wkSerializedScriptValue->internalRepresentation()),
+ WebKitWebView* webView = WEBKIT_WEB_VIEW(g_task_get_source_object(task.get()));
+ g_task_return_pointer(task.get(), webkitJavascriptResultCreate(webView, toImpl(wkSerializedScriptValue)),
reinterpret_cast<GDestroyNotify>(webkit_javascript_result_unref));
}
@@ -3053,9 +2651,7 @@ void webkit_web_view_run_javascript(WebKitWebView* webView, const gchar* script,
g_return_if_fail(script);
GTask* task = g_task_new(webView, cancellable, callback, userData);
- getPage(webView)->runJavaScriptInMainFrame(String::fromUTF8(script), [task](API::SerializedScriptValue* serializedScriptValue, bool, WebKit::CallbackBase::Error) {
- webkitWebViewRunJavaScriptCallback(serializedScriptValue, adoptGRef(task).get());
- });
+ getPage(webView)->runJavaScriptInMainFrame(String::fromUTF8(script), ScriptValueCallback::create(task, webkitWebViewRunJavaScriptCallback));
}
/**
@@ -3144,9 +2740,7 @@ static void resourcesStreamReadCallback(GObject* object, GAsyncResult* result, g
WebKitWebView* webView = WEBKIT_WEB_VIEW(g_task_get_source_object(task.get()));
gpointer outputStreamData = g_memory_output_stream_get_data(G_MEMORY_OUTPUT_STREAM(object));
getPage(webView)->runJavaScriptInMainFrame(String::fromUTF8(reinterpret_cast<const gchar*>(outputStreamData)),
- [task](API::SerializedScriptValue* serializedScriptValue, bool, WebKit::CallbackBase::Error) {
- webkitWebViewRunJavaScriptCallback(serializedScriptValue, task.get());
- });
+ ScriptValueCallback::create(task.leakRef(), webkitWebViewRunJavaScriptCallback));
}
/**
@@ -3273,16 +2867,16 @@ static void fileReplaceContentsCallback(GObject* object, GAsyncResult* result, g
g_task_return_boolean(task.get(), TRUE);
}
-static void getContentsAsMHTMLDataCallback(API::Data* wkData, GTask* taskPtr)
+static void getContentsAsMHTMLDataCallback(WKDataRef wkData, WKErrorRef, void* context)
{
- GRefPtr<GTask> task = adoptGRef(taskPtr);
+ GRefPtr<GTask> task = adoptGRef(G_TASK(context));
if (g_task_return_error_if_cancelled(task.get()))
return;
ViewSaveAsyncData* data = static_cast<ViewSaveAsyncData*>(g_task_get_task_data(task.get()));
// We need to retain the data until the asyncronous process
// initiated by the user has finished completely.
- data->webData = wkData;
+ data->webData = toImpl(wkData);
// If we are saving to a file we need to write the data on disk before finishing.
if (g_task_get_source_tag(task.get()) == webkit_web_view_save_to_file) {
@@ -3322,9 +2916,7 @@ void webkit_web_view_save(WebKitWebView* webView, WebKitSaveMode saveMode, GCanc
GTask* task = g_task_new(webView, cancellable, callback, userData);
g_task_set_source_tag(task, reinterpret_cast<gpointer>(webkit_web_view_save));
g_task_set_task_data(task, createViewSaveAsyncData(), reinterpret_cast<GDestroyNotify>(destroyViewSaveAsyncData));
- getPage(webView)->getContentsAsMHTMLData([task](API::Data* data, WebKit::CallbackBase::Error) {
- getContentsAsMHTMLDataCallback(data, task);
- }, false);
+ getPage(webView)->getContentsAsMHTMLData(DataCallback::create(task, getContentsAsMHTMLDataCallback), false);
}
/**
@@ -3387,9 +2979,7 @@ void webkit_web_view_save_to_file(WebKitWebView* webView, GFile* file, WebKitSav
data->file = file;
g_task_set_task_data(task, data, reinterpret_cast<GDestroyNotify>(destroyViewSaveAsyncData));
- getPage(webView)->getContentsAsMHTMLData([task](API::Data* data, WebKit::CallbackBase::Error) {
- getContentsAsMHTMLDataCallback(data, task);
- }, false);
+ getPage(webView)->getContentsAsMHTMLData(DataCallback::create(task, getContentsAsMHTMLDataCallback), false);
}
/**
@@ -3425,13 +3015,50 @@ WebKitDownload* webkit_web_view_download_uri(WebKitWebView* webView, const char*
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
g_return_val_if_fail(uri, 0);
- WebKitDownload* download = webkitWebContextStartDownload(webView->priv->context.get(), uri, getPage(webView));
+ WebKitDownload* download = webkitWebContextStartDownload(webView->priv->context, uri, getPage(webView));
webkitDownloadSetWebView(download, webView);
return download;
}
/**
+ * webkit_web_view_set_view_mode:
+ * @web_view: a #WebKitWebView
+ * @view_mode: a #WebKitViewMode
+ *
+ * Set the view mode of @web_view to @view_mode. This method should be called
+ * before loading new contents on @web_view so that the new #WebKitViewMode will
+ * be applied to the new contents.
+ */
+void webkit_web_view_set_view_mode(WebKitWebView* webView, WebKitViewMode viewMode)
+{
+ g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
+
+ if (webView->priv->viewMode == viewMode)
+ return;
+
+ getPage(webView)->setMainFrameInViewSourceMode(viewMode == WEBKIT_VIEW_MODE_SOURCE);
+
+ webView->priv->viewMode = viewMode;
+ g_object_notify(G_OBJECT(webView), "view-mode");
+}
+
+/**
+ * webkit_web_view_get_view_mode:
+ * @web_view: a #WebKitWebView
+ *
+ * Get the view mode of @web_view.
+ *
+ * Returns: the #WebKitViewMode of @web_view.
+ */
+WebKitViewMode webkit_web_view_get_view_mode(WebKitWebView* webView)
+{
+ g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), WEBKIT_VIEW_MODE_WEB);
+
+ return webView->priv->viewMode;
+}
+
+/**
* webkit_web_view_get_tls_info:
* @web_view: a #WebKitWebView
* @certificate: (out) (transfer none): return location for a #GTlsCertificate
@@ -3446,10 +3073,10 @@ WebKitDownload* webkit_web_view_download_uri(WebKitWebView* webView, const char*
* when it's emitted with %WEBKIT_LOAD_COMMITTED event.
*
* Note that this function provides no information about the security of the web
- * page if the current #WebKitTLSErrorsPolicy is @WEBKIT_TLS_ERRORS_POLICY_IGNORE,
+ * page if the current #WebKitTLSErrorsPolicy is %WEBKIT_TLS_ERRORS_POLICY_IGNORE,
* as subresources of the page may be controlled by an attacker. This function
* may safely be used to determine the security status of the current page only
- * if the current #WebKitTLSErrorsPolicy is @WEBKIT_TLS_ERRORS_POLICY_FAIL, in
+ * if the current #WebKitTLSErrorsPolicy is %WEBKIT_TLS_ERRORS_POLICY_FAIL, in
* which case subresources that fail certificate verification will be blocked.
*
* Returns: %TRUE if the @web_view connection uses HTTPS and a response has been received
@@ -3490,6 +3117,9 @@ void webKitWebViewDidReceiveSnapshot(WebKitWebView* webView, uint64_t callbackID
g_task_return_pointer(task.get(), 0, 0);
}
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_SNAPSHOT_REGION_VISIBLE, SnapshotRegionVisible);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_SNAPSHOT_REGION_FULL_DOCUMENT, SnapshotRegionFullDocument);
+
static inline unsigned webKitSnapshotOptionsToSnapshotOptions(WebKitSnapshotOptions options)
{
SnapshotOptions snapshotOptions = 0;
@@ -3500,19 +3130,6 @@ static inline unsigned webKitSnapshotOptionsToSnapshotOptions(WebKitSnapshotOpti
return snapshotOptions;
}
-static inline SnapshotRegion toSnapshotRegion(WebKitSnapshotRegion region)
-{
- switch (region) {
- case WEBKIT_SNAPSHOT_REGION_VISIBLE:
- return SnapshotRegionVisible;
- case WEBKIT_SNAPSHOT_REGION_FULL_DOCUMENT:
- return SnapshotRegionFullDocument;
- default:
- ASSERT_NOT_REACHED();
- return SnapshotRegionVisible;
- }
-}
-
static inline uint64_t generateSnapshotCallbackID()
{
static uint64_t uniqueCallbackID = 1;
@@ -3539,15 +3156,14 @@ void webkit_web_view_get_snapshot(WebKitWebView* webView, WebKitSnapshotRegion r
{
g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
- API::Dictionary::MapType message;
+ ImmutableDictionary::MapType message;
uint64_t callbackID = generateSnapshotCallbackID();
message.set(String::fromUTF8("SnapshotOptions"), API::UInt64::create(static_cast<uint64_t>(webKitSnapshotOptionsToSnapshotOptions(options))));
- message.set(String::fromUTF8("SnapshotRegion"), API::UInt64::create(static_cast<uint64_t>(toSnapshotRegion(region))));
+ message.set(String::fromUTF8("SnapshotRegion"), API::UInt64::create(static_cast<uint64_t>(region)));
message.set(String::fromUTF8("CallbackID"), API::UInt64::create(callbackID));
- message.set(String::fromUTF8("TransparentBackground"), API::Boolean::create(options & WEBKIT_SNAPSHOT_OPTIONS_TRANSPARENT_BACKGROUND));
webView->priv->snapshotResultsMap.set(callbackID, adoptGRef(g_task_new(webView, cancellable, callback, userData)));
- getPage(webView)->postMessageToInjectedBundle(String::fromUTF8("GetSnapshot"), API::Dictionary::create(WTF::move(message)).ptr());
+ getPage(webView)->postMessageToInjectedBundle(String::fromUTF8("GetSnapshot"), ImmutableDictionary::create(std::move(message)).get());
}
/**
@@ -3574,141 +3190,3 @@ void webkitWebViewWebProcessCrashed(WebKitWebView* webView)
g_signal_emit(webView, signals[WEB_PROCESS_CRASHED], 0, &returnValue);
}
-/**
- * webkit_web_view_set_background_color:
- * @web_view: a #WebKitWebView
- * @rgba: a #GdkRGBA
- *
- * Sets the color that will be used to draw the @web_view background before
- * the actual contents are rendered. Note that if the web page loaded in @web_view
- * specifies a background color, it will take precedence over the @rgba color.
- * By default the @web_view background color is opaque white.
- * If the @rgba color is not fully opaque, the parent window must have a RGBA visual and
- * #GtkWidget:app-paintable property set to %TRUE, for the transparencies to work.
- *
- * <informalexample><programlisting>
- * static void browser_window_set_background_color (BrowserWindow *window,
- * const GdkRGBA *rgba)
- * {
- * WebKitWebView *web_view;
- *
- * if (rgba->alpha < 1) {
- * GdkScreen *screen = gtk_window_get_screen (GTK_WINDOW (window));
- * GdkVisual *rgba_visual = gdk_screen_get_rgba_visual (screen);
- *
- * if (!rgba_visual)
- * return;
- *
- * gtk_widget_set_visual (GTK_WIDGET (window), rgba_visual);
- * gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE);
- * }
- *
- * web_view = browser_window_get_web_view (window);
- * webkit_web_view_set_background_color (web_view, rgba);
- * }
- * </programlisting></informalexample>
- *
- * Since: 2.8
- */
-void webkit_web_view_set_background_color(WebKitWebView* webView, const GdkRGBA* rgba)
-{
- g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
- g_return_if_fail(rgba);
-
- Color color(*rgba);
- WebPageProxy* page = getPage(webView);
- if (page->backgroundColor() == color)
- return;
-
- page->setBackgroundColor(color);
- page->setDrawsBackground(color == Color::white);
-}
-
-/**
- * webkit_web_view_get_background_color:
- * @web_view: a #WebKitWebView
- * @rgba: (out): a #GdkRGBA to fill in with the background color
- *
- * Gets the color that is used to draw the @web_view background before
- * the actual contents are rendered.
- * For more information see also webkit_web_view_set_background_color()
- *
- * Since: 2.8
- */
-void webkit_web_view_get_background_color(WebKitWebView* webView, GdkRGBA* rgba)
-{
- g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
- g_return_if_fail(rgba);
-
- *rgba = getPage(webView)->backgroundColor();
-}
-
-/*
- * webkit_web_view_is_editable:
- * @web_view: a #WebKitWebView
- *
- * Gets whether the user is allowed to edit the HTML document. When @web_view
- * is not editable an element in the HTML document can only be edited if the
- * CONTENTEDITABLE attribute has been set on the element or one of its parent
- * elements. By default a #WebKitWebView is not editable.
- *
- * Returns: %TRUE if the user is allowed to edit the HTML document, or %FALSE otherwise.
- *
- * Since: 2.8
- */
-gboolean webkit_web_view_is_editable(WebKitWebView* webView)
-{
- g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE);
-
- return getPage(webView)->isEditable();
-}
-
-/**
- * webkit_web_view_set_editable:
- * @web_view: a #WebKitWebView
- * @editable: a #gboolean indicating the editable state
- *
- * Sets whether the user is allowed to edit the HTML document.
- *
- * If @editable is %TRUE, @web_view allows the user to edit the HTML document. If
- * @editable is %FALSE, an element in @web_view's document can only be edited if the
- * CONTENTEDITABLE attribute has been set on the element or one of its parent
- * elements. By default a #WebKitWebView is not editable.
- *
- * Normally, a HTML document is not editable unless the elements within the
- * document are editable. This function provides a way to make the contents
- * of a #WebKitWebView editable without altering the document or DOM structure.
- *
- * Since: 2.8
- */
-void webkit_web_view_set_editable(WebKitWebView* webView, gboolean editable)
-{
- g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
-
- if (editable == getPage(webView)->isEditable())
- return;
-
- getPage(webView)->setEditable(editable);
-
- g_object_notify(G_OBJECT(webView), "editable");
-}
-
-/**
- * webkit_web_view_get_editor_state:
- * @web_view: a #WebKitWebView
- *
- * Gets the web editor state of @web_view.
- *
- * Returns: (transfer none): the #WebKitEditorState of the view
- *
- * Since: 2.10
- */
-WebKitEditorState* webkit_web_view_get_editor_state(WebKitWebView *webView)
-{
- g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), nullptr);
-
- if (!webView->priv->editorState)
- webView->priv->editorState = adoptGRef(webkitEditorStateCreate(getPage(webView)->editorState()));
-
- return webView->priv->editorState.get();
-}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h
index 8db968609..493c68d18 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h
@@ -32,26 +32,22 @@
#include <webkit2/WebKitAuthenticationRequest.h>
#include <webkit2/WebKitBackForwardList.h>
#include <webkit2/WebKitDefines.h>
-#include <webkit2/WebKitColorChooserRequest.h>
-#include <webkit2/WebKitEditorState.h>
#include <webkit2/WebKitFileChooserRequest.h>
#include <webkit2/WebKitFindController.h>
#include <webkit2/WebKitFormSubmissionRequest.h>
#include <webkit2/WebKitForwardDeclarations.h>
#include <webkit2/WebKitHitTestResult.h>
#include <webkit2/WebKitJavascriptResult.h>
-#include <webkit2/WebKitNavigationAction.h>
-#include <webkit2/WebKitNotification.h>
#include <webkit2/WebKitPermissionRequest.h>
#include <webkit2/WebKitPolicyDecision.h>
#include <webkit2/WebKitScriptDialog.h>
#include <webkit2/WebKitSettings.h>
#include <webkit2/WebKitURIRequest.h>
-#include <webkit2/WebKitUserContentManager.h>
#include <webkit2/WebKitWebContext.h>
#include <webkit2/WebKitWebInspector.h>
#include <webkit2/WebKitWebResource.h>
#include <webkit2/WebKitWebViewBase.h>
+#include <webkit2/WebKitWebViewGroup.h>
#include <webkit2/WebKitWindowProperties.h>
G_BEGIN_DECLS
@@ -154,12 +150,23 @@ typedef enum {
} WebKitInsecureContentEvent;
/**
+ * WebKitViewMode:
+ * @WEBKIT_VIEW_MODE_WEB: The normal view mode to display web contents.
+ * @WEBKIT_VIEW_MODE_SOURCE: The source mode to display web source code.
+ *
+ * Enum values to specify the different ways in which a #WebKitWebView
+ * can display a web page.
+ */
+typedef enum {
+ WEBKIT_VIEW_MODE_WEB,
+ WEBKIT_VIEW_MODE_SOURCE
+} WebKitViewMode;
+
+/**
* WebKitSnapshotOptions:
* @WEBKIT_SNAPSHOT_OPTIONS_NONE: Do not include any special options.
* @WEBKIT_SNAPSHOT_OPTIONS_INCLUDE_SELECTION_HIGHLIGHTING: Whether to include in the
* snapshot the highlight of the selected content.
- * @WEBKIT_SNAPSHOT_OPTIONS_TRANSPARENT_BACKGROUND: Do not fill the background with white before
- * rendering the snapshot. Since 2.8
*
* Enum values used to specify options when taking a snapshot
* from a #WebKitWebView.
@@ -167,7 +174,6 @@ typedef enum {
typedef enum {
WEBKIT_SNAPSHOT_OPTIONS_NONE = 0,
WEBKIT_SNAPSHOT_OPTIONS_INCLUDE_SELECTION_HIGHLIGHTING = 1 << 0,
- WEBKIT_SNAPSHOT_OPTIONS_TRANSPARENT_BACKGROUND = 1 << 1,
} WebKitSnapshotOptions;
/**
@@ -201,8 +207,7 @@ struct _WebKitWebViewClass {
const gchar *failing_uri,
GError *error);
- GtkWidget *(* create) (WebKitWebView *web_view,
- WebKitNavigationAction *navigation_action);
+ GtkWidget *(* create) (WebKitWebView *web_view);
void (* ready_to_show) (WebKitWebView *web_view);
void (* run_as_modal) (WebKitWebView *web_view);
void (* close) (WebKitWebView *web_view);
@@ -241,18 +246,14 @@ struct _WebKitWebViewClass {
gboolean (* authenticate) (WebKitWebView *web_view,
WebKitAuthenticationRequest *request);
gboolean (* load_failed_with_tls_errors) (WebKitWebView *web_view,
- const gchar *failing_uri,
- GTlsCertificate *certificate,
- GTlsCertificateFlags errors);
- gboolean (* show_notification) (WebKitWebView *web_view,
- WebKitNotification *notification);
- gboolean (* run_color_chooser) (WebKitWebView *web_view,
- WebKitColorChooserRequest *request);
-
+ WebKitCertificateInfo *info,
+ const gchar *host);
void (*_webkit_reserved0) (void);
void (*_webkit_reserved1) (void);
void (*_webkit_reserved2) (void);
void (*_webkit_reserved3) (void);
+ void (*_webkit_reserved4) (void);
+ void (*_webkit_reserved5) (void);
};
WEBKIT_API GType
@@ -265,17 +266,17 @@ WEBKIT_API GtkWidget *
webkit_web_view_new_with_context (WebKitWebContext *context);
WEBKIT_API GtkWidget *
-webkit_web_view_new_with_settings (WebKitSettings *settings);
-
-WEBKIT_API GtkWidget *
webkit_web_view_new_with_related_view (WebKitWebView *web_view);
WEBKIT_API GtkWidget *
-webkit_web_view_new_with_user_content_manager (WebKitUserContentManager *user_content_manager);
+webkit_web_view_new_with_group (WebKitWebViewGroup *group);
WEBKIT_API WebKitWebContext *
webkit_web_view_get_context (WebKitWebView *web_view);
+WEBKIT_API WebKitWebViewGroup *
+webkit_web_view_get_group (WebKitWebView *web_view);
+
WEBKIT_API void
webkit_web_view_load_uri (WebKitWebView *web_view,
const gchar *uri);
@@ -294,13 +295,6 @@ webkit_web_view_load_plain_text (WebKitWebView
const gchar *plain_text);
WEBKIT_API void
-webkit_web_view_load_bytes (WebKitWebView *web_view,
- GBytes *bytes,
- const gchar *mime_type,
- const gchar *encoding,
- const gchar *base_uri);
-
-WEBKIT_API void
webkit_web_view_load_request (WebKitWebView *web_view,
WebKitURIRequest *request);
@@ -310,9 +304,6 @@ webkit_web_view_stop_loading (WebKitWebView
WEBKIT_API gboolean
webkit_web_view_is_loading (WebKitWebView *web_view);
-WEBKIT_API gboolean
-webkit_web_view_is_playing_audio (WebKitWebView *web_view);
-
WEBKIT_API guint64
webkit_web_view_get_page_id (WebKitWebView *web_view);
@@ -391,11 +382,6 @@ WEBKIT_API void
webkit_web_view_execute_editing_command (WebKitWebView *web_view,
const gchar *command);
-WEBKIT_API void
-webkit_web_view_execute_editing_command_with_argument(WebKitWebView *web_view,
- const char *command,
- const char *argument);
-
WEBKIT_API WebKitFindController *
webkit_web_view_get_find_controller (WebKitWebView *web_view);
@@ -464,6 +450,13 @@ WEBKIT_API WebKitDownload *
webkit_web_view_download_uri (WebKitWebView *web_view,
const char *uri);
+WEBKIT_API void
+webkit_web_view_set_view_mode (WebKitWebView *web_view,
+ WebKitViewMode view_mode);
+
+WEBKIT_API WebKitViewMode
+webkit_web_view_get_view_mode (WebKitWebView *web_view);
+
WEBKIT_API gboolean
webkit_web_view_get_tls_info (WebKitWebView *web_view,
GTlsCertificate **certificate,
@@ -480,28 +473,6 @@ WEBKIT_API cairo_surface_t *
webkit_web_view_get_snapshot_finish (WebKitWebView *web_view,
GAsyncResult *result,
GError **error);
-
-WEBKIT_API WebKitUserContentManager *
-webkit_web_view_get_user_content_manager (WebKitWebView *web_view);
-
-WEBKIT_API void
-webkit_web_view_set_background_color (WebKitWebView *web_view,
- const GdkRGBA *rgba);
-
-WEBKIT_API void
-webkit_web_view_get_background_color (WebKitWebView *web_view,
- GdkRGBA *rgba);
-
-WEBKIT_API gboolean
-webkit_web_view_is_editable (WebKitWebView *web_view);
-
-WEBKIT_API void
-webkit_web_view_set_editable (WebKitWebView *web_view,
- gboolean editable);
-
-WEBKIT_API WebKitEditorState *
-webkit_web_view_get_editor_state (WebKitWebView *web_view);
-
G_END_DECLS
#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
index d9c228c0d..b22c71fa1 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
@@ -29,16 +29,12 @@
#include "config.h"
#include "WebKitWebViewBase.h"
-#include "APIPageConfiguration.h"
#include "DrawingAreaProxyImpl.h"
-#include "InputMethodFilter.h"
-#include "KeyBindingTranslator.h"
-#include "NativeWebKeyboardEvent.h"
#include "NativeWebMouseEvent.h"
#include "NativeWebWheelEvent.h"
#include "PageClientImpl.h"
-#include "RedirectedXCompositeWindow.h"
#include "ViewState.h"
+#include "WebContext.h"
#include "WebEventFactory.h"
#include "WebFullScreenClientGtk.h"
#include "WebInspectorProxy.h"
@@ -49,35 +45,37 @@
#include "WebPageGroup.h"
#include "WebPageProxy.h"
#include "WebPreferences.h"
-#include "WebProcessPool.h"
-#include "WebUserContentControllerProxy.h"
+#include "WebViewBaseInputMethodFilter.h"
#include <WebCore/CairoUtilities.h>
+#include <WebCore/ClipboardUtilitiesGtk.h>
+#include <WebCore/DataObjectGtk.h>
+#include <WebCore/DragData.h>
+#include <WebCore/DragIcon.h>
#include <WebCore/GUniquePtrGtk.h>
+#include <WebCore/GtkClickCounter.h>
+#include <WebCore/GtkDragAndDropHelper.h>
+#include <WebCore/GtkTouchContextHelper.h>
#include <WebCore/GtkUtilities.h>
#include <WebCore/GtkVersioning.h>
#include <WebCore/NotImplemented.h>
#include <WebCore/PasteboardHelper.h>
-#include <WebCore/PlatformDisplay.h>
#include <WebCore/RefPtrCairo.h>
#include <WebCore/Region.h>
#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>
-#include <glib/gi18n-lib.h>
-#include <memory>
+#ifdef GDK_WINDOWING_X11
+#include <gdk/gdkx.h>
+#endif
#include <wtf/HashMap.h>
-#include <wtf/glib/GRefPtr.h>
+#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/CString.h>
#if ENABLE(FULLSCREEN_API)
#include "WebFullScreenManagerProxy.h"
#endif
-#if PLATFORM(X11)
-#include <gdk/gdkx.h>
-#endif
-
-#if PLATFORM(WAYLAND)
-#include <gdk/gdkwayland.h>
+#if USE(TEXTURE_MAPPER_GL) && defined(GDK_WINDOWING_X11)
+#include <WebCore/RedirectedXCompositeWindow.h>
#endif
// gtk_widget_get_scale_factor() appeared in GTK 3.10, but we also need
@@ -87,86 +85,42 @@
using namespace WebKit;
using namespace WebCore;
-struct ClickCounter {
-public:
- void reset()
- {
- currentClickCount = 0;
- previousClickPoint = IntPoint();
- previousClickTime = 0;
- previousClickButton = 0;
- }
-
- int currentClickCountForGdkButtonEvent(GdkEventButton* buttonEvent)
- {
- GdkEvent* event = reinterpret_cast<GdkEvent*>(buttonEvent);
- int doubleClickDistance = 250;
- int doubleClickTime = 5;
- g_object_get(gtk_settings_get_for_screen(gdk_event_get_screen(event)),
- "gtk-double-click-distance", &doubleClickDistance, "gtk-double-click-time", &doubleClickTime, nullptr);
-
- // GTK+ only counts up to triple clicks, but WebCore wants to know about
- // quadruple clicks, quintuple clicks, ad infinitum. Here, we replicate the
- // GDK logic for counting clicks.
- guint32 eventTime = gdk_event_get_time(event);
- if (!eventTime) {
- // Real events always have a non-zero time, but events synthesized
- // by the WTR do not and we must calculate a time manually. This time
- // is not calculated in the WTR, because GTK+ does not work well with
- // anything other than GDK_CURRENT_TIME on synthesized events.
- GTimeVal timeValue;
- g_get_current_time(&timeValue);
- eventTime = (timeValue.tv_sec * 1000) + (timeValue.tv_usec / 1000);
- }
-
- if ((event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS)
- || ((std::abs(buttonEvent->x - previousClickPoint.x()) < doubleClickDistance)
- && (std::abs(buttonEvent->y - previousClickPoint.y()) < doubleClickDistance)
- && (eventTime - previousClickTime < static_cast<unsigned>(doubleClickTime))
- && (buttonEvent->button == previousClickButton)))
- currentClickCount++;
- else
- currentClickCount = 1;
-
- double x, y;
- gdk_event_get_coords(event, &x, &y);
- previousClickPoint = IntPoint(x, y);
- previousClickButton = buttonEvent->button;
- previousClickTime = eventTime;
-
- return currentClickCount;
- }
-
-private:
- int currentClickCount;
- IntPoint previousClickPoint;
- unsigned previousClickButton;
- int previousClickTime;
-};
-
typedef HashMap<GtkWidget*, IntRect> WebKitWebViewChildrenMap;
-typedef HashMap<uint32_t, GUniquePtr<GdkEvent>> TouchEventsMap;
+
+#if USE(TEXTURE_MAPPER_GL)
+void redirectedWindowDamagedCallback(void* data);
+#endif
struct _WebKitWebViewBasePrivate {
WebKitWebViewChildrenMap children;
- std::unique_ptr<PageClientImpl> pageClient;
+ OwnPtr<PageClientImpl> pageClient;
RefPtr<WebPageProxy> pageProxy;
bool shouldForwardNextKeyEvent;
- ClickCounter clickCounter;
+ GtkClickCounter clickCounter;
CString tooltipText;
IntRect tooltipArea;
+#if ENABLE(DRAG_SUPPORT)
+ GtkDragAndDropHelper dragAndDropHelper;
+#endif
+ DragIcon dragIcon;
+#if !GTK_CHECK_VERSION(3, 13, 4)
+ IntSize resizerSize;
+#endif
GRefPtr<AtkObject> accessible;
+ bool needsResizeOnMap;
GtkWidget* authenticationDialog;
GtkWidget* inspectorView;
AttachmentSide inspectorAttachmentSide;
unsigned inspectorViewSize;
GUniquePtr<GdkEvent> contextMenuEvent;
WebContextMenuProxyGtk* activeContextMenuProxy;
- InputMethodFilter inputMethodFilter;
- KeyBindingTranslator keyBindingTranslator;
- TouchEventsMap touchEvents;
+ WebViewBaseInputMethodFilter inputMethodFilter;
+ GtkTouchContextHelper touchContext;
GtkWindow* toplevelOnScreenWindow;
+#if !GTK_CHECK_VERSION(3, 13, 4)
+ unsigned long toplevelResizeGripVisibilityID;
+#endif
unsigned long toplevelFocusInEventID;
unsigned long toplevelFocusOutEventID;
unsigned long toplevelVisibilityEventID;
@@ -182,27 +136,48 @@ struct _WebKitWebViewBasePrivate {
#if ENABLE(FULLSCREEN_API)
bool fullScreenModeActive;
WebFullScreenClientGtk fullScreenClient;
- GRefPtr<GDBusProxy> screenSaverProxy;
- GRefPtr<GCancellable> screenSaverInhibitCancellable;
- unsigned screenSaverCookie;
#endif
-#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
- std::unique_ptr<RedirectedXCompositeWindow> redirectedWindow;
-#endif
-
-#if ENABLE(DRAG_SUPPORT)
- std::unique_ptr<DragAndDropHandler> dragAndDropHandler;
-#endif
-
-#if HAVE(GTK_GESTURES)
- std::unique_ptr<GestureController> gestureController;
+#if USE(TEXTURE_MAPPER_GL)
+ OwnPtr<RedirectedXCompositeWindow> redirectedWindow;
#endif
};
WEBKIT_DEFINE_TYPE(WebKitWebViewBase, webkit_web_view_base, GTK_TYPE_CONTAINER)
-static gboolean toplevelWindowFocusInEvent(GtkWidget*, GdkEventFocus*, WebKitWebViewBase* webViewBase)
+#if !GTK_CHECK_VERSION(3, 13, 4)
+static void webkitWebViewBaseNotifyResizerSize(WebKitWebViewBase* webViewBase)
+{
+ WebKitWebViewBasePrivate* priv = webViewBase->priv;
+ if (!priv->toplevelOnScreenWindow)
+ return;
+
+ gboolean resizerVisible;
+ g_object_get(G_OBJECT(priv->toplevelOnScreenWindow), "resize-grip-visible", &resizerVisible, NULL);
+
+ IntSize resizerSize;
+ if (resizerVisible) {
+ GdkRectangle resizerRect;
+ gtk_window_get_resize_grip_area(priv->toplevelOnScreenWindow, &resizerRect);
+ GdkRectangle allocation;
+ gtk_widget_get_allocation(GTK_WIDGET(webViewBase), &allocation);
+ if (gdk_rectangle_intersect(&resizerRect, &allocation, 0))
+ resizerSize = IntSize(resizerRect.width, resizerRect.height);
+ }
+
+ if (resizerSize != priv->resizerSize) {
+ priv->resizerSize = resizerSize;
+ priv->pageProxy->setWindowResizerSize(resizerSize);
+ }
+}
+
+static void toplevelWindowResizeGripVisibilityChanged(GObject*, GParamSpec*, WebKitWebViewBase* webViewBase)
+{
+ webkitWebViewBaseNotifyResizerSize(webViewBase);
+}
+#endif
+
+static gboolean toplevelWindowFocusInEvent(GtkWidget* widget, GdkEventFocus*, WebKitWebViewBase* webViewBase)
{
WebKitWebViewBasePrivate* priv = webViewBase->priv;
if (!priv->isInWindowActive) {
@@ -213,7 +188,7 @@ static gboolean toplevelWindowFocusInEvent(GtkWidget*, GdkEventFocus*, WebKitWeb
return FALSE;
}
-static gboolean toplevelWindowFocusOutEvent(GtkWidget*, GdkEventFocus*, WebKitWebViewBase* webViewBase)
+static gboolean toplevelWindowFocusOutEvent(GtkWidget* widget, GdkEventFocus*, WebKitWebViewBase* webViewBase)
{
WebKitWebViewBasePrivate* priv = webViewBase->priv;
if (priv->isInWindowActive) {
@@ -242,6 +217,12 @@ static void webkitWebViewBaseSetToplevelOnScreenWindow(WebKitWebViewBase* webVie
if (priv->toplevelOnScreenWindow == window)
return;
+#if !GTK_CHECK_VERSION(3, 13, 4)
+ if (priv->toplevelResizeGripVisibilityID) {
+ g_signal_handler_disconnect(priv->toplevelOnScreenWindow, priv->toplevelResizeGripVisibilityID);
+ priv->toplevelResizeGripVisibilityID = 0;
+ }
+#endif
if (priv->toplevelFocusInEventID) {
g_signal_handler_disconnect(priv->toplevelOnScreenWindow, priv->toplevelFocusInEventID);
priv->toplevelFocusInEventID = 0;
@@ -260,6 +241,13 @@ static void webkitWebViewBaseSetToplevelOnScreenWindow(WebKitWebViewBase* webVie
if (!priv->toplevelOnScreenWindow)
return;
+#if !GTK_CHECK_VERSION(3, 13, 4)
+ webkitWebViewBaseNotifyResizerSize(webViewBase);
+
+ priv->toplevelResizeGripVisibilityID =
+ g_signal_connect(priv->toplevelOnScreenWindow, "notify::resize-grip-visible",
+ G_CALLBACK(toplevelWindowResizeGripVisibilityChanged), webViewBase);
+#endif
priv->toplevelFocusInEventID =
g_signal_connect(priv->toplevelOnScreenWindow, "focus-in-event",
G_CALLBACK(toplevelWindowFocusInEvent), webViewBase);
@@ -273,25 +261,6 @@ static void webkitWebViewBaseSetToplevelOnScreenWindow(WebKitWebViewBase* webVie
static void webkitWebViewBaseRealize(GtkWidget* widget)
{
- WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(widget);
- WebKitWebViewBasePrivate* priv = webView->priv;
-
-#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
- if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::X11) {
- priv->redirectedWindow = RedirectedXCompositeWindow::create(
- gtk_widget_get_parent_window(widget),
- [webView] {
- DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(webView->priv->pageProxy->drawingArea());
- if (drawingArea && drawingArea->isInAcceleratedCompositingMode())
- gtk_widget_queue_draw(GTK_WIDGET(webView));
- });
- if (priv->redirectedWindow) {
- DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(priv->pageProxy->drawingArea());
- drawingArea->setNativeSurfaceHandleForCompositing(priv->redirectedWindow->windowID());
- }
- }
-#endif
-
gtk_widget_set_realized(widget, TRUE);
GtkAllocation allocation;
@@ -326,28 +295,14 @@ static void webkitWebViewBaseRealize(GtkWidget* widget)
gtk_widget_set_window(widget, window);
gdk_window_set_user_data(window, widget);
-#if USE(TEXTURE_MAPPER) && PLATFORM(X11) && !USE(REDIRECTED_XCOMPOSITE_WINDOW)
- DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(priv->pageProxy->drawingArea());
- drawingArea->setNativeSurfaceHandleForCompositing(GDK_WINDOW_XID(window));
-#endif
-
gtk_style_context_set_background(gtk_widget_get_style_context(widget), window);
- gtk_im_context_set_client_window(priv->inputMethodFilter.context(), window);
-
+ WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(widget);
GtkWidget* toplevel = gtk_widget_get_toplevel(widget);
if (widgetIsOnscreenToplevelWindow(toplevel))
webkitWebViewBaseSetToplevelOnScreenWindow(webView, GTK_WINDOW(toplevel));
}
-static void webkitWebViewBaseUnrealize(GtkWidget* widget)
-{
- WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(widget);
- gtk_im_context_set_client_window(webView->priv->inputMethodFilter.context(), nullptr);
-
- GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->unrealize(widget);
-}
-
static bool webkitWebViewChildIsInternalWidget(WebKitWebViewBase* webViewBase, GtkWidget* widget)
{
WebKitWebViewBasePrivate* priv = webViewBase->priv;
@@ -451,7 +406,6 @@ void webkitWebViewBaseChildMoveResize(WebKitWebViewBase* webView, GtkWidget* chi
static void webkitWebViewBaseDispose(GObject* gobject)
{
WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(gobject);
- g_cancellable_cancel(webView->priv->screenSaverInhibitCancellable.get());
webkitWebViewBaseSetToplevelOnScreenWindow(webView, nullptr);
webView->priv->pageProxy->close();
G_OBJECT_CLASS(webkit_web_view_base_parent_class)->dispose(gobject);
@@ -463,47 +417,45 @@ static void webkitWebViewBaseConstructed(GObject* object)
GtkWidget* viewWidget = GTK_WIDGET(object);
gtk_widget_set_can_focus(viewWidget, TRUE);
- gtk_drag_dest_set(viewWidget, static_cast<GtkDestDefaults>(0), nullptr, 0,
- static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_PRIVATE));
- gtk_drag_dest_set_target_list(viewWidget, PasteboardHelper::singleton().targetList());
+ gtk_drag_dest_set(viewWidget, static_cast<GtkDestDefaults>(0), 0, 0,
+ static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_PRIVATE));
+ gtk_drag_dest_set_target_list(viewWidget, PasteboardHelper::defaultPasteboardHelper()->targetList());
WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(object)->priv;
- priv->pageClient = std::make_unique<PageClientImpl>(viewWidget);
+ priv->pageClient = PageClientImpl::create(viewWidget);
+#if ENABLE(DRAG_SUPPORT)
+ priv->dragAndDropHelper.setWidget(viewWidget);
+#endif
+
+#if USE(TEXTURE_MAPPER_GL) && defined(GDK_WINDOWING_X11)
+ GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
+ if (GDK_IS_X11_DISPLAY(display)) {
+ priv->redirectedWindow = RedirectedXCompositeWindow::create(IntSize(1, 1), RedirectedXCompositeWindow::DoNotCreateGLContext);
+ if (priv->redirectedWindow)
+ priv->redirectedWindow->setDamageNotifyCallback(redirectedWindowDamagedCallback, object);
+ }
+#endif
+
priv->authenticationDialog = 0;
}
-#if USE(TEXTURE_MAPPER)
+#if USE(TEXTURE_MAPPER_GL)
static bool webkitWebViewRenderAcceleratedCompositingResults(WebKitWebViewBase* webViewBase, DrawingAreaProxyImpl* drawingArea, cairo_t* cr, GdkRectangle* clipRect)
{
- ASSERT(drawingArea);
-
if (!drawingArea->isInAcceleratedCompositingMode())
return false;
-#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
// To avoid flashes when initializing accelerated compositing for the first
// time, we wait until we know there's a frame ready before rendering.
WebKitWebViewBasePrivate* priv = webViewBase->priv;
if (!priv->redirectedWindow)
return false;
- priv->redirectedWindow->setDeviceScaleFactor(webViewBase->priv->pageProxy->deviceScaleFactor());
- priv->redirectedWindow->resize(drawingArea->size());
-
- if (cairo_surface_t* surface = priv->redirectedWindow->surface()) {
- cairo_rectangle(cr, clipRect->x, clipRect->y, clipRect->width, clipRect->height);
- cairo_set_source_surface(cr, surface, 0, 0);
- cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
- cairo_fill(cr);
- }
-
+ cairo_rectangle(cr, clipRect->x, clipRect->y, clipRect->width, clipRect->height);
+ cairo_surface_t* surface = priv->redirectedWindow->cairoSurfaceForWidget(GTK_WIDGET(webViewBase));
+ cairo_set_source_surface(cr, surface, 0, 0);
+ cairo_fill(cr);
return true;
-#else
- UNUSED_PARAM(webViewBase);
- UNUSED_PARAM(cr);
- UNUSED_PARAM(clipRect);
- return false;
-#endif
}
#endif
@@ -518,7 +470,7 @@ static gboolean webkitWebViewBaseDraw(GtkWidget* widget, cairo_t* cr)
if (!gdk_cairo_get_clip_rectangle(cr, &clipRect))
return FALSE;
-#if USE(TEXTURE_MAPPER)
+#if USE(TEXTURE_MAPPER_GL)
if (webkitWebViewRenderAcceleratedCompositingResults(webViewBase, drawingArea, cr, &clipRect))
return GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->draw(widget, cr);
#endif
@@ -553,11 +505,8 @@ static void webkitWebViewBaseChildAllocate(GtkWidget* child, gpointer userData)
priv->children.set(child, IntRect());
}
-static void webkitWebViewBaseSizeAllocate(GtkWidget* widget, GtkAllocation* allocation)
+static void resizeWebKitWebViewBaseFromAllocation(WebKitWebViewBase* webViewBase, GtkAllocation* allocation, bool sizeChanged)
{
- GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->size_allocate(widget, allocation);
-
- WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
gtk_container_foreach(GTK_CONTAINER(webViewBase), webkitWebViewBaseChildAllocate, webViewBase);
IntRect viewRect(allocation->x, allocation->y, allocation->width, allocation->height);
@@ -565,7 +514,7 @@ static void webkitWebViewBaseSizeAllocate(GtkWidget* widget, GtkAllocation* allo
if (priv->inspectorView) {
GtkAllocation childAllocation = viewRect;
- if (priv->inspectorAttachmentSide == AttachmentSide::Bottom) {
+ if (priv->inspectorAttachmentSide == AttachmentSideBottom) {
int inspectorViewHeight = std::min(static_cast<int>(priv->inspectorViewSize), allocation->height);
childAllocation.x = 0;
childAllocation.y = allocation->height - inspectorViewHeight;
@@ -598,17 +547,33 @@ static void webkitWebViewBaseSizeAllocate(GtkWidget* widget, GtkAllocation* allo
gtk_widget_size_allocate(priv->authenticationDialog, &childAllocation);
}
- DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(priv->pageProxy->drawingArea());
- if (!drawingArea)
- return;
+#if USE(TEXTURE_MAPPER_GL)
+ if (sizeChanged && webViewBase->priv->redirectedWindow)
+ webViewBase->priv->redirectedWindow->resize(viewRect.size());
+#endif
+ if (priv->pageProxy->drawingArea())
+ priv->pageProxy->drawingArea()->setSize(viewRect.size(), IntSize(), IntSize());
-#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
- if (priv->redirectedWindow && drawingArea->isInAcceleratedCompositingMode())
- priv->redirectedWindow->resize(viewRect.size());
+#if !GTK_CHECK_VERSION(3, 13, 4)
+ webkitWebViewBaseNotifyResizerSize(webViewBase);
#endif
+}
+
+static void webkitWebViewBaseSizeAllocate(GtkWidget* widget, GtkAllocation* allocation)
+{
+ bool sizeChanged = gtk_widget_get_allocated_width(widget) != allocation->width
+ || gtk_widget_get_allocated_height(widget) != allocation->height;
+
+ GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->size_allocate(widget, allocation);
- drawingArea->setSize(viewRect.size(), IntSize(), IntSize());
+ WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
+ if (sizeChanged && !gtk_widget_get_mapped(widget)) {
+ webViewBase->priv->needsResizeOnMap = true;
+ return;
+ }
+
+ resizeWebKitWebViewBaseFromAllocation(webViewBase, allocation, sizeChanged);
}
static void webkitWebViewBaseMap(GtkWidget* widget)
@@ -621,6 +586,14 @@ static void webkitWebViewBaseMap(GtkWidget* widget)
priv->isVisible = true;
priv->pageProxy->viewStateDidChange(ViewState::IsVisible);
}
+
+ if (!priv->needsResizeOnMap)
+ return;
+
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(widget, &allocation);
+ resizeWebKitWebViewBaseFromAllocation(webViewBase, &allocation, true /* sizeChanged */);
+ priv->needsResizeOnMap = false;
}
static void webkitWebViewBaseUnmap(GtkWidget* widget)
@@ -682,12 +655,7 @@ static gboolean webkitWebViewBaseKeyPressEvent(GtkWidget* widget, GdkEventKey* e
priv->shouldForwardNextKeyEvent = FALSE;
return GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->key_press_event(widget, event);
}
-
- priv->inputMethodFilter.filterKeyEvent(event, [priv, event](const WebCore::CompositionResults& compositionResults, InputMethodFilter::EventFakedForComposition faked) {
- priv->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(reinterpret_cast<GdkEvent*>(event), compositionResults, faked,
- !compositionResults.compositionUpdated() ? priv->keyBindingTranslator.commandsForKeyEvent(event) : Vector<String>()));
- });
-
+ priv->inputMethodFilter.filterKeyEvent(event);
return TRUE;
}
@@ -700,11 +668,7 @@ static gboolean webkitWebViewBaseKeyReleaseEvent(GtkWidget* widget, GdkEventKey*
priv->shouldForwardNextKeyEvent = FALSE;
return GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->key_release_event(widget, event);
}
-
- priv->inputMethodFilter.filterKeyEvent(event, [priv, event](const WebCore::CompositionResults& compositionResults, InputMethodFilter::EventFakedForComposition faked) {
- priv->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(reinterpret_cast<GdkEvent*>(event), compositionResults, faked, { }));
- });
-
+ priv->inputMethodFilter.filterKeyEvent(event);
return TRUE;
}
@@ -720,21 +684,14 @@ static gboolean webkitWebViewBaseButtonPressEvent(GtkWidget* widget, GdkEventBut
priv->inputMethodFilter.notifyMouseButtonPress();
- // For double and triple clicks GDK sends both a normal button press event
- // and a specific type (like GDK_2BUTTON_PRESS). If we detect a special press
- // coming up, ignore this event as it certainly generated the double or triple
- // click. The consequence of not eating this event is two DOM button press events
- // are generated.
- GUniquePtr<GdkEvent> nextEvent(gdk_event_peek());
- if (nextEvent && (nextEvent->any.type == GDK_2BUTTON_PRESS || nextEvent->any.type == GDK_3BUTTON_PRESS))
+ if (!priv->clickCounter.shouldProcessButtonEvent(buttonEvent))
return TRUE;
// If it's a right click event save it as a possible context menu event.
if (buttonEvent->button == 3)
priv->contextMenuEvent.reset(gdk_event_copy(reinterpret_cast<GdkEvent*>(buttonEvent)));
-
priv->pageProxy->handleMouseEvent(NativeWebMouseEvent(reinterpret_cast<GdkEvent*>(buttonEvent),
- priv->clickCounter.currentClickCountForGdkButtonEvent(buttonEvent)));
+ priv->clickCounter.clickCountForGdkButtonEvent(widget, buttonEvent)));
return TRUE;
}
@@ -778,110 +735,20 @@ static gboolean webkitWebViewBaseMotionNotifyEvent(GtkWidget* widget, GdkEventMo
return TRUE;
}
-#if ENABLE(TOUCH_EVENTS)
-static void appendTouchEvent(Vector<WebPlatformTouchPoint>& touchPoints, const GdkEvent* event, WebPlatformTouchPoint::TouchPointState state)
-{
- gdouble x, y;
- gdk_event_get_coords(event, &x, &y);
-
- gdouble xRoot, yRoot;
- gdk_event_get_root_coords(event, &xRoot, &yRoot);
-
- uint32_t identifier = GPOINTER_TO_UINT(gdk_event_get_event_sequence(event));
- touchPoints.uncheckedAppend(WebPlatformTouchPoint(identifier, state, IntPoint(xRoot, yRoot), IntPoint(x, y)));
-}
-
-static inline WebPlatformTouchPoint::TouchPointState touchPointStateForEvents(const GdkEvent* current, const GdkEvent* event)
-{
- if (gdk_event_get_event_sequence(current) != gdk_event_get_event_sequence(event))
- return WebPlatformTouchPoint::TouchStationary;
-
- switch (current->type) {
- case GDK_TOUCH_UPDATE:
- return WebPlatformTouchPoint::TouchMoved;
- case GDK_TOUCH_BEGIN:
- return WebPlatformTouchPoint::TouchPressed;
- case GDK_TOUCH_END:
- return WebPlatformTouchPoint::TouchReleased;
- default:
- return WebPlatformTouchPoint::TouchStationary;
- }
-}
-
-static void webkitWebViewBaseGetTouchPointsForEvent(WebKitWebViewBase* webViewBase, GdkEvent* event, Vector<WebPlatformTouchPoint>& touchPoints)
-{
- WebKitWebViewBasePrivate* priv = webViewBase->priv;
- touchPoints.reserveInitialCapacity(event->type == GDK_TOUCH_END ? priv->touchEvents.size() + 1 : priv->touchEvents.size());
-
- for (const auto& it : priv->touchEvents)
- appendTouchEvent(touchPoints, it.value.get(), touchPointStateForEvents(it.value.get(), event));
-
- // Touch was already removed from the TouchEventsMap, add it here.
- if (event->type == GDK_TOUCH_END)
- appendTouchEvent(touchPoints, event, WebPlatformTouchPoint::TouchReleased);
-}
-
static gboolean webkitWebViewBaseTouchEvent(GtkWidget* widget, GdkEventTouch* event)
{
- WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
- WebKitWebViewBasePrivate* priv = webViewBase->priv;
+ WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)->priv;
if (priv->authenticationDialog)
return TRUE;
- GdkEvent* touchEvent = reinterpret_cast<GdkEvent*>(event);
-
-#if HAVE(GTK_GESTURES)
- GestureController& gestureController = webkitWebViewBaseGestureController(webViewBase);
- if (gestureController.isProcessingGestures()) {
- // If we are already processing gestures is because the WebProcess didn't handle the
- // BEGIN touch event, so pass subsequent events to the GestureController.
- gestureController.handleEvent(touchEvent);
- return TRUE;
- }
-#endif
-
- uint32_t sequence = GPOINTER_TO_UINT(gdk_event_get_event_sequence(touchEvent));
- switch (touchEvent->type) {
- case GDK_TOUCH_BEGIN: {
- ASSERT(!priv->touchEvents.contains(sequence));
- GUniquePtr<GdkEvent> event(gdk_event_copy(touchEvent));
- priv->touchEvents.add(sequence, WTF::move(event));
- break;
- }
- case GDK_TOUCH_UPDATE: {
- auto it = priv->touchEvents.find(sequence);
- ASSERT(it != priv->touchEvents.end());
- it->value.reset(gdk_event_copy(touchEvent));
- break;
- }
- case GDK_TOUCH_END:
- ASSERT(priv->touchEvents.contains(sequence));
- priv->touchEvents.remove(sequence);
- break;
- default:
- break;
- }
-
- Vector<WebPlatformTouchPoint> touchPoints;
- webkitWebViewBaseGetTouchPointsForEvent(webViewBase, touchEvent, touchPoints);
- priv->pageProxy->handleTouchEvent(NativeWebTouchEvent(reinterpret_cast<GdkEvent*>(event), WTF::move(touchPoints)));
+ priv->touchContext.handleEvent(reinterpret_cast<GdkEvent*>(event));
+ priv->pageProxy->handleTouchEvent(NativeWebTouchEvent(reinterpret_cast<GdkEvent*>(event), priv->touchContext));
return TRUE;
}
-#endif // ENABLE(TOUCH_EVENTS)
-#if HAVE(GTK_GESTURES)
-GestureController& webkitWebViewBaseGestureController(WebKitWebViewBase* webViewBase)
-{
- WebKitWebViewBasePrivate* priv = webViewBase->priv;
- if (!priv->gestureController)
- priv->gestureController = std::make_unique<GestureController>(*priv->pageProxy);
- return *priv->gestureController;
-}
-#endif
-
-static gboolean webkitWebViewBaseQueryTooltip(GtkWidget* widget, gint /* x */, gint /* y */, gboolean keyboardMode, GtkTooltip* tooltip)
+static gboolean webkitWebViewBaseQueryTooltip(GtkWidget* widget, gint x, gint y, gboolean keyboardMode, GtkTooltip* tooltip)
{
WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)->priv;
@@ -905,23 +772,39 @@ static gboolean webkitWebViewBaseQueryTooltip(GtkWidget* widget, gint /* x */, g
}
#if ENABLE(DRAG_SUPPORT)
-static void webkitWebViewBaseDragDataGet(GtkWidget* widget, GdkDragContext* context, GtkSelectionData* selectionData, guint info, guint /* time */)
+static void webkitWebViewBaseDragDataGet(GtkWidget* widget, GdkDragContext* context, GtkSelectionData* selectionData, guint info, guint time)
{
- WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)->priv;
- ASSERT(priv->dragAndDropHandler);
- priv->dragAndDropHandler->fillDragData(context, selectionData, info);
+ WEBKIT_WEB_VIEW_BASE(widget)->priv->dragAndDropHelper.handleGetDragData(context, selectionData, info);
}
static void webkitWebViewBaseDragEnd(GtkWidget* widget, GdkDragContext* context)
{
- WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)->priv;
- ASSERT(priv->dragAndDropHandler);
- priv->dragAndDropHandler->finishDrag(context);
+ WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
+ if (!webViewBase->priv->dragAndDropHelper.handleDragEnd(context))
+ return;
+
+ GdkDevice* device = gdk_drag_context_get_device(context);
+ int x = 0, y = 0;
+ gdk_device_get_window_at_position(device, &x, &y);
+ int xRoot = 0, yRoot = 0;
+ gdk_device_get_position(device, 0, &xRoot, &yRoot);
+ webViewBase->priv->pageProxy->dragEnded(IntPoint(x, y), IntPoint(xRoot, yRoot),
+ gdkDragActionToDragOperation(gdk_drag_context_get_selected_action(context)));
}
-static void webkitWebViewBaseDragDataReceived(GtkWidget* widget, GdkDragContext* context, gint /* x */, gint /* y */, GtkSelectionData* selectionData, guint info, guint time)
+static void webkitWebViewBaseDragDataReceived(GtkWidget* widget, GdkDragContext* context, gint x, gint y, GtkSelectionData* selectionData, guint info, guint time)
{
- webkitWebViewBaseDragAndDropHandler(WEBKIT_WEB_VIEW_BASE(widget)).dragEntered(context, selectionData, info, time);
+ WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
+ IntPoint position;
+ DataObjectGtk* dataObject = webViewBase->priv->dragAndDropHelper.handleDragDataReceived(context, selectionData, info, position);
+ if (!dataObject)
+ return;
+
+ DragData dragData(dataObject, position, convertWidgetPointToScreenPoint(widget, position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)));
+ webViewBase->priv->pageProxy->resetDragOperation();
+ webViewBase->priv->pageProxy->dragEntered(dragData);
+ DragOperation operation = webViewBase->priv->pageProxy->dragSession().operation;
+ gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
}
#endif // ENABLE(DRAG_SUPPORT)
@@ -956,26 +839,54 @@ static AtkObject* webkitWebViewBaseGetAccessible(GtkWidget* widget)
#if ENABLE(DRAG_SUPPORT)
static gboolean webkitWebViewBaseDragMotion(GtkWidget* widget, GdkDragContext* context, gint x, gint y, guint time)
{
- webkitWebViewBaseDragAndDropHandler(WEBKIT_WEB_VIEW_BASE(widget)).dragMotion(context, IntPoint(x, y), time);
+ WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
+ IntPoint position(x, y);
+ DataObjectGtk* dataObject = webViewBase->priv->dragAndDropHelper.handleDragMotion(context, position, time);
+ if (!dataObject)
+ return TRUE;
+
+ DragData dragData(dataObject, position, convertWidgetPointToScreenPoint(widget, position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)));
+ webViewBase->priv->pageProxy->dragUpdated(dragData);
+ DragOperation operation = webViewBase->priv->pageProxy->dragSession().operation;
+ gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
return TRUE;
}
-static void webkitWebViewBaseDragLeave(GtkWidget* widget, GdkDragContext* context, guint /* time */)
+static void dragExitedCallback(GtkWidget* widget, DragData& dragData, bool dropHappened)
{
- WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)->priv;
- ASSERT(priv->dragAndDropHandler);
- priv->dragAndDropHandler->dragLeave(context);
+ // Don't call dragExited if we have just received a drag-drop signal. This
+ // happens in the case of a successful drop onto the view.
+ if (dropHappened)
+ return;
+
+ WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
+ webViewBase->priv->pageProxy->dragExited(dragData);
+ webViewBase->priv->pageProxy->resetDragOperation();
+}
+
+static void webkitWebViewBaseDragLeave(GtkWidget* widget, GdkDragContext* context, guint time)
+{
+ WEBKIT_WEB_VIEW_BASE(widget)->priv->dragAndDropHelper.handleDragLeave(context, dragExitedCallback);
}
static gboolean webkitWebViewBaseDragDrop(GtkWidget* widget, GdkDragContext* context, gint x, gint y, guint time)
{
- WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)->priv;
- ASSERT(priv->dragAndDropHandler);
- return priv->dragAndDropHandler->drop(context, IntPoint(x, y), time);
+ WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
+ DataObjectGtk* dataObject = webViewBase->priv->dragAndDropHelper.handleDragDrop(context);
+ if (!dataObject)
+ return FALSE;
+
+ IntPoint position(x, y);
+ DragData dragData(dataObject, position, convertWidgetPointToScreenPoint(widget, position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)));
+ SandboxExtension::Handle handle;
+ SandboxExtension::HandleArray sandboxExtensionForUpload;
+ webViewBase->priv->pageProxy->performDrag(dragData, String(), handle, sandboxExtensionForUpload);
+ gtk_drag_finish(context, TRUE, FALSE, time);
+ return TRUE;
}
#endif // ENABLE(DRAG_SUPPORT)
-static void webkitWebViewBaseParentSet(GtkWidget* widget, GtkWidget* /* oldParent */)
+static void webkitWebViewBaseParentSet(GtkWidget* widget, GtkWidget* oldParent)
{
if (!gtk_widget_get_parent(widget))
webkitWebViewBaseSetToplevelOnScreenWindow(WEBKIT_WEB_VIEW_BASE(widget), 0);
@@ -1008,7 +919,6 @@ static void webkit_web_view_base_class_init(WebKitWebViewBaseClass* webkitWebVie
{
GtkWidgetClass* widgetClass = GTK_WIDGET_CLASS(webkitWebViewBaseClass);
widgetClass->realize = webkitWebViewBaseRealize;
- widgetClass->unrealize = webkitWebViewBaseUnrealize;
widgetClass->draw = webkitWebViewBaseDraw;
widgetClass->size_allocate = webkitWebViewBaseSizeAllocate;
widgetClass->map = webkitWebViewBaseMap;
@@ -1022,9 +932,7 @@ static void webkit_web_view_base_class_init(WebKitWebViewBaseClass* webkitWebVie
widgetClass->button_release_event = webkitWebViewBaseButtonReleaseEvent;
widgetClass->scroll_event = webkitWebViewBaseScrollEvent;
widgetClass->motion_notify_event = webkitWebViewBaseMotionNotifyEvent;
-#if ENABLE(TOUCH_EVENTS)
widgetClass->touch_event = webkitWebViewBaseTouchEvent;
-#endif
widgetClass->query_tooltip = webkitWebViewBaseQueryTooltip;
#if ENABLE(DRAG_SUPPORT)
widgetClass->drag_end = webkitWebViewBaseDragEnd;
@@ -1048,16 +956,10 @@ static void webkit_web_view_base_class_init(WebKitWebViewBaseClass* webkitWebVie
containerClass->forall = webkitWebViewBaseContainerForall;
}
-WebKitWebViewBase* webkitWebViewBaseCreate(WebProcessPool* context, WebPreferences* preferences, WebPageGroup* pageGroup, WebUserContentControllerProxy* userContentController, WebPageProxy* relatedPage)
+WebKitWebViewBase* webkitWebViewBaseCreate(WebContext* context, WebPageGroup* pageGroup, WebPageProxy* relatedPage)
{
- WebKitWebViewBase* webkitWebViewBase = WEBKIT_WEB_VIEW_BASE(g_object_new(WEBKIT_TYPE_WEB_VIEW_BASE, nullptr));
-
- auto pageConfiguration = API::PageConfiguration::create();
- pageConfiguration->setPreferences(preferences);
- pageConfiguration->setPageGroup(pageGroup);
- pageConfiguration->setRelatedPage(relatedPage);
- pageConfiguration->setUserContentController(userContentController);
- webkitWebViewBaseCreateWebPage(webkitWebViewBase, context, WTF::move(pageConfiguration));
+ WebKitWebViewBase* webkitWebViewBase = WEBKIT_WEB_VIEW_BASE(g_object_new(WEBKIT_TYPE_WEB_VIEW_BASE, NULL));
+ webkitWebViewBaseCreateWebPage(webkitWebViewBase, context, pageGroup, relatedPage);
return webkitWebViewBase;
}
@@ -1071,30 +973,51 @@ WebPageProxy* webkitWebViewBaseGetPage(WebKitWebViewBase* webkitWebViewBase)
return webkitWebViewBase->priv->pageProxy.get();
}
+void webkitWebViewBaseUpdatePreferences(WebKitWebViewBase* webkitWebViewBase)
+{
+ WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv;
+
+#if USE(TEXTURE_MAPPER_GL)
+ if (priv->redirectedWindow)
+ return;
+#endif
+
+ priv->pageProxy->pageGroup().preferences()->setAcceleratedCompositingEnabled(false);
+}
+
#if HAVE(GTK_SCALE_FACTOR)
static void deviceScaleFactorChanged(WebKitWebViewBase* webkitWebViewBase)
{
-#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
- if (webkitWebViewBase->priv->redirectedWindow)
- webkitWebViewBase->priv->redirectedWindow->setDeviceScaleFactor(webkitWebViewBase->priv->pageProxy->deviceScaleFactor());
-#endif
webkitWebViewBase->priv->pageProxy->setIntrinsicDeviceScaleFactor(gtk_widget_get_scale_factor(GTK_WIDGET(webkitWebViewBase)));
}
#endif // HAVE(GTK_SCALE_FACTOR)
-void webkitWebViewBaseCreateWebPage(WebKitWebViewBase* webkitWebViewBase, WebProcessPool* context, Ref<API::PageConfiguration>&& configuration)
+void webkitWebViewBaseCreateWebPage(WebKitWebViewBase* webkitWebViewBase, WebContext* context, WebPageGroup* pageGroup, WebPageProxy* relatedPage)
{
WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv;
- priv->pageProxy = context->createWebPage(*priv->pageClient, WTF::move(configuration));
+
+ WebPageConfiguration webPageConfiguration;
+ webPageConfiguration.pageGroup = pageGroup;
+ webPageConfiguration.relatedPage = relatedPage;
+ priv->pageProxy = context->createWebPage(*priv->pageClient, std::move(webPageConfiguration));
priv->pageProxy->initializeWebPage();
- priv->inputMethodFilter.setPage(priv->pageProxy.get());
+#if USE(TEXTURE_MAPPER_GL)
+ if (priv->redirectedWindow)
+ priv->pageProxy->setAcceleratedCompositingWindowId(priv->redirectedWindow->windowId());
+#endif
#if HAVE(GTK_SCALE_FACTOR)
// We attach this here, because changes in scale factor are passed directly to the page proxy.
priv->pageProxy->setIntrinsicDeviceScaleFactor(gtk_widget_get_scale_factor(GTK_WIDGET(webkitWebViewBase)));
g_signal_connect(webkitWebViewBase, "notify::scale-factor", G_CALLBACK(deviceScaleFactorChanged), nullptr);
#endif
+
+ webkitWebViewBaseUpdatePreferences(webkitWebViewBase);
+
+ // This must happen here instead of the instance initializer, because the input method
+ // filter must have access to the page.
+ priv->inputMethodFilter.setWebView(webkitWebViewBase);
}
void webkitWebViewBaseSetTooltipText(WebKitWebViewBase* webViewBase, const char* tooltip)
@@ -1117,12 +1040,31 @@ void webkitWebViewBaseSetTooltipArea(WebKitWebViewBase* webViewBase, const IntRe
}
#if ENABLE(DRAG_SUPPORT)
-DragAndDropHandler& webkitWebViewBaseDragAndDropHandler(WebKitWebViewBase* webViewBase)
+void webkitWebViewBaseStartDrag(WebKitWebViewBase* webViewBase, const DragData& dragData, PassRefPtr<ShareableBitmap> dragImage)
{
WebKitWebViewBasePrivate* priv = webViewBase->priv;
- if (!priv->dragAndDropHandler)
- priv->dragAndDropHandler = std::make_unique<DragAndDropHandler>(*priv->pageProxy);
- return *priv->dragAndDropHandler;
+
+ RefPtr<DataObjectGtk> dataObject = adoptRef(dragData.platformData());
+ GRefPtr<GtkTargetList> targetList = adoptGRef(PasteboardHelper::defaultPasteboardHelper()->targetListForDataObject(dataObject.get()));
+ GUniquePtr<GdkEvent> currentEvent(gtk_get_current_event());
+ GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(webViewBase),
+ targetList.get(),
+ dragOperationToGdkDragActions(dragData.draggingSourceOperationMask()),
+ 1, /* button */
+ currentEvent.get());
+ priv->dragAndDropHelper.startedDrag(context, dataObject.get());
+
+
+ // A drag starting should prevent a double-click from happening. This might
+ // happen if a drag is followed very quickly by another click (like in the DRT).
+ priv->clickCounter.reset();
+
+ if (dragImage) {
+ RefPtr<cairo_surface_t> image(dragImage->createCairoSurface());
+ priv->dragIcon.setImage(image.get());
+ priv->dragIcon.useForDrag(context);
+ } else
+ gtk_drag_set_icon_default(context);
}
#endif // ENABLE(DRAG_SUPPORT)
@@ -1131,71 +1073,6 @@ void webkitWebViewBaseForwardNextKeyEvent(WebKitWebViewBase* webkitWebViewBase)
webkitWebViewBase->priv->shouldForwardNextKeyEvent = TRUE;
}
-#if ENABLE(FULLSCREEN_API)
-static void screenSaverInhibitedCallback(GDBusProxy* screenSaverProxy, GAsyncResult* result, WebKitWebViewBase* webViewBase)
-{
- GRefPtr<GVariant> returnValue = adoptGRef(g_dbus_proxy_call_finish(screenSaverProxy, result, nullptr));
- if (returnValue)
- g_variant_get(returnValue.get(), "(u)", &webViewBase->priv->screenSaverCookie);
- webViewBase->priv->screenSaverInhibitCancellable = nullptr;
-}
-
-static void webkitWebViewBaseSendInhibitMessageToScreenSaver(WebKitWebViewBase* webViewBase)
-{
- WebKitWebViewBasePrivate* priv = webViewBase->priv;
- ASSERT(priv->screenSaverProxy);
- priv->screenSaverCookie = 0;
- if (!priv->screenSaverInhibitCancellable)
- priv->screenSaverInhibitCancellable = adoptGRef(g_cancellable_new());
- g_dbus_proxy_call(priv->screenSaverProxy.get(), "Inhibit", g_variant_new("(ss)", g_get_prgname(), _("Website running in fullscreen mode")),
- G_DBUS_CALL_FLAGS_NONE, -1, priv->screenSaverInhibitCancellable.get(), reinterpret_cast<GAsyncReadyCallback>(screenSaverInhibitedCallback), webViewBase);
-}
-
-static void screenSaverProxyCreatedCallback(GObject*, GAsyncResult* result, WebKitWebViewBase* webViewBase)
-{
- WebKitWebViewBasePrivate* priv = webViewBase->priv;
- priv->screenSaverProxy = adoptGRef(g_dbus_proxy_new_for_bus_finish(result, nullptr));
- if (!priv->screenSaverProxy)
- return;
-
- webkitWebViewBaseSendInhibitMessageToScreenSaver(webViewBase);
-}
-
-static void webkitWebViewBaseInhibitScreenSaver(WebKitWebViewBase* webViewBase)
-{
- WebKitWebViewBasePrivate* priv = webViewBase->priv;
- if (priv->screenSaverCookie) {
- // Already inhibited.
- return;
- }
-
- if (priv->screenSaverProxy) {
- webkitWebViewBaseSendInhibitMessageToScreenSaver(webViewBase);
- return;
- }
-
- priv->screenSaverInhibitCancellable = adoptGRef(g_cancellable_new());
- g_dbus_proxy_new_for_bus(G_BUS_TYPE_SESSION, static_cast<GDBusProxyFlags>(G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS),
- nullptr, "org.freedesktop.ScreenSaver", "/ScreenSaver", "org.freedesktop.ScreenSaver", priv->screenSaverInhibitCancellable.get(),
- reinterpret_cast<GAsyncReadyCallback>(screenSaverProxyCreatedCallback), webViewBase);
-}
-
-static void webkitWebViewBaseUninhibitScreenSaver(WebKitWebViewBase* webViewBase)
-{
- WebKitWebViewBasePrivate* priv = webViewBase->priv;
- if (!priv->screenSaverCookie) {
- // Not inhibited or it's being inhibited.
- g_cancellable_cancel(priv->screenSaverInhibitCancellable.get());
- return;
- }
-
- // If we have a cookie we should have a proxy.
- ASSERT(priv->screenSaverProxy);
- g_dbus_proxy_call(priv->screenSaverProxy.get(), "UnInhibit", g_variant_new("(u)", priv->screenSaverCookie), G_DBUS_CALL_FLAGS_NONE, -1, nullptr, nullptr, nullptr);
- priv->screenSaverCookie = 0;
-}
-#endif
-
void webkitWebViewBaseEnterFullScreen(WebKitWebViewBase* webkitWebViewBase)
{
#if ENABLE(FULLSCREEN_API)
@@ -1214,7 +1091,6 @@ void webkitWebViewBaseEnterFullScreen(WebKitWebViewBase* webkitWebViewBase)
gtk_window_fullscreen(GTK_WINDOW(topLevelWindow));
fullScreenManagerProxy->didEnterFullScreen();
priv->fullScreenModeActive = true;
- webkitWebViewBaseInhibitScreenSaver(webkitWebViewBase);
#endif
}
@@ -1236,7 +1112,6 @@ void webkitWebViewBaseExitFullScreen(WebKitWebViewBase* webkitWebViewBase)
gtk_window_unfullscreen(GTK_WINDOW(topLevelWindow));
fullScreenManagerProxy->didExitFullScreen();
priv->fullScreenModeActive = false;
- webkitWebViewBaseUninhibitScreenSaver(webkitWebViewBase);
#endif
}
@@ -1269,6 +1144,13 @@ GdkEvent* webkitWebViewBaseTakeContextMenuEvent(WebKitWebViewBase* webkitWebView
return webkitWebViewBase->priv->contextMenuEvent.release();
}
+#if USE(TEXTURE_MAPPER_GL)
+void redirectedWindowDamagedCallback(void* data)
+{
+ gtk_widget_queue_draw(GTK_WIDGET(data));
+}
+#endif
+
void webkitWebViewBaseSetFocus(WebKitWebViewBase* webViewBase, bool focused)
{
WebKitWebViewBasePrivate* priv = webViewBase->priv;
@@ -1333,69 +1215,10 @@ void webkitWebViewBaseSetInputMethodState(WebKitWebViewBase* webkitWebViewBase,
void webkitWebViewBaseUpdateTextInputState(WebKitWebViewBase* webkitWebViewBase)
{
- const auto& editorState = webkitWebViewBase->priv->pageProxy->editorState();
- if (!editorState.isMissingPostLayoutData)
- webkitWebViewBase->priv->inputMethodFilter.setCursorRect(editorState.postLayoutData().caretRectAtStart);
+ webkitWebViewBase->priv->inputMethodFilter.setCursorRect(webkitWebViewBase->priv->pageProxy->editorState().cursorRect);
}
void webkitWebViewBaseResetClickCounter(WebKitWebViewBase* webkitWebViewBase)
{
webkitWebViewBase->priv->clickCounter.reset();
}
-
-void webkitWebViewBaseEnterAcceleratedCompositingMode(WebKitWebViewBase* webkitWebViewBase)
-{
-#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
- WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv;
- if (!priv->redirectedWindow)
- return;
- DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(priv->pageProxy->drawingArea());
- if (!drawingArea)
- return;
-
- priv->redirectedWindow->setDeviceScaleFactor(webkitWebViewBase->priv->pageProxy->deviceScaleFactor());
- priv->redirectedWindow->resize(drawingArea->size());
- // Force a resize to ensure the new redirected window size is used by the WebProcess.
- drawingArea->forceResize();
-#else
- UNUSED_PARAM(webkitWebViewBase);
-#endif
-}
-
-void webkitWebViewBaseExitAcceleratedCompositingMode(WebKitWebViewBase* webkitWebViewBase)
-{
-#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
- WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv;
- if (priv->redirectedWindow)
- priv->redirectedWindow->resize(IntSize());
-#else
- UNUSED_PARAM(webkitWebViewBase);
-#endif
-}
-
-void webkitWebViewBaseDidRelaunchWebProcess(WebKitWebViewBase* webkitWebViewBase)
-{
- // Queue a resize to ensure the new DrawingAreaProxy is resized.
- gtk_widget_queue_resize_no_redraw(GTK_WIDGET(webkitWebViewBase));
-
-#if PLATFORM(X11) && USE(TEXTURE_MAPPER)
- if (PlatformDisplay::sharedDisplay().type() != PlatformDisplay::Type::X11)
- return;
-
- WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv;
- DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(priv->pageProxy->drawingArea());
- ASSERT(drawingArea);
-#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
- if (!priv->redirectedWindow)
- return;
- uint64_t windowID = priv->redirectedWindow->windowID();
-#else
- if (!gtk_widget_get_realized(GTK_WIDGET(webkitWebViewBase)))
- return;
- uint64_t windowID = GDK_WINDOW_XID(gtk_widget_get_window(GTK_WIDGET(webkitWebViewBase)));
-#endif
- drawingArea->setNativeSurfaceHandleForCompositing(windowID);
-#else
- UNUSED_PARAM(webkitWebViewBase);
-#endif
-}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp
index fc2d053a7..7b069dd94 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp
@@ -29,7 +29,7 @@ struct _WebKitWebViewBaseAccessiblePrivate {
WEBKIT_DEFINE_TYPE(WebKitWebViewBaseAccessible, webkit_web_view_base_accessible, ATK_TYPE_SOCKET)
-static void webkitWebViewBaseAccessibleWidgetDestroyed(GtkWidget*, WebKitWebViewBaseAccessible* accessible)
+static void webkitWebViewBaseAccessibleWidgetDestroyed(GtkWidget* widget, WebKitWebViewBaseAccessible* accessible)
{
accessible->priv->widget = 0;
atk_object_notify_state_change(ATK_OBJECT(accessible), ATK_STATE_DEFUNCT, TRUE);
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h
index ca0b25e7d..b9c38c265 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h
@@ -28,21 +28,20 @@
#ifndef WebKitWebViewBasePrivate_h
#define WebKitWebViewBasePrivate_h
-#include "DragAndDropHandler.h"
-#include "GestureController.h"
#include "WebContextMenuProxyGtk.h"
#include "WebInspectorProxy.h"
#include "WebKitPrivate.h"
#include "WebKitWebViewBase.h"
#include "WebPageProxy.h"
-WebKitWebViewBase* webkitWebViewBaseCreate(WebKit::WebProcessPool*, WebKit::WebPreferences*, WebKit::WebPageGroup*, WebKit::WebUserContentControllerProxy*, WebKit::WebPageProxy*);
+WebKitWebViewBase* webkitWebViewBaseCreate(WebKit::WebContext*, WebKit::WebPageGroup*, WebKit::WebPageProxy*);
GtkIMContext* webkitWebViewBaseGetIMContext(WebKitWebViewBase*);
WebKit::WebPageProxy* webkitWebViewBaseGetPage(WebKitWebViewBase*);
-void webkitWebViewBaseCreateWebPage(WebKitWebViewBase*, WebKit::WebProcessPool*, Ref<API::PageConfiguration>&&);
+void webkitWebViewBaseCreateWebPage(WebKitWebViewBase*, WebKit::WebContext*, WebKit::WebPageGroup*, WebKit::WebPageProxy*);
void webkitWebViewBaseSetTooltipText(WebKitWebViewBase*, const char*);
void webkitWebViewBaseSetTooltipArea(WebKitWebViewBase*, const WebCore::IntRect&);
void webkitWebViewBaseForwardNextKeyEvent(WebKitWebViewBase*);
+void webkitWebViewBaseStartDrag(WebKitWebViewBase*, const WebCore::DragData&, PassRefPtr<WebKit::ShareableBitmap> dragImage);
void webkitWebViewBaseChildMoveResize(WebKitWebViewBase*, GtkWidget*, const WebCore::IntRect&);
void webkitWebViewBaseEnterFullScreen(WebKitWebViewBase*);
void webkitWebViewBaseExitFullScreen(WebKitWebViewBase*);
@@ -53,6 +52,11 @@ WebKit::WebContextMenuProxyGtk* webkitWebViewBaseGetActiveContextMenuProxy(WebKi
GdkEvent* webkitWebViewBaseTakeContextMenuEvent(WebKitWebViewBase*);
void webkitWebViewBaseSetInputMethodState(WebKitWebViewBase*, bool enabled);
void webkitWebViewBaseUpdateTextInputState(WebKitWebViewBase*);
+void webkitWebViewBaseUpdatePreferences(WebKitWebViewBase*);
+
+#if USE(TEXTURE_MAPPER_GL)
+void webkitWebViewBaseQueueDrawOfAcceleratedCompositingResults(WebKitWebViewBase*);
+#endif
void webkitWebViewBaseSetFocus(WebKitWebViewBase*, bool focused);
bool webkitWebViewBaseIsInWindowActive(WebKitWebViewBase*);
@@ -69,16 +73,5 @@ void webkitWebViewBaseAddAuthenticationDialog(WebKitWebViewBase*, GtkWidget* aut
void webkitWebViewBaseCancelAuthenticationDialog(WebKitWebViewBase*);
void webkitWebViewBaseAddWebInspector(WebKitWebViewBase*, GtkWidget* inspector, WebKit::AttachmentSide);
void webkitWebViewBaseResetClickCounter(WebKitWebViewBase*);
-void webkitWebViewBaseEnterAcceleratedCompositingMode(WebKitWebViewBase*);
-void webkitWebViewBaseExitAcceleratedCompositingMode(WebKitWebViewBase*);
-void webkitWebViewBaseDidRelaunchWebProcess(WebKitWebViewBase*);
-
-#if ENABLE(DRAG_SUPPORT)
-WebKit::DragAndDropHandler& webkitWebViewBaseDragAndDropHandler(WebKitWebViewBase*);
-#endif
-
-#if HAVE(GTK_GESTURES)
-WebKit::GestureController& webkitWebViewBaseGestureController(WebKitWebViewBase*);
-#endif
#endif // WebKitWebViewBasePrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewGroup.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewGroup.cpp
new file mode 100644
index 000000000..289ecdf03
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewGroup.cpp
@@ -0,0 +1,288 @@
+/*
+ * Copyright (C) 2013 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebKitWebViewGroup.h"
+
+#include "APIArray.h"
+#include "APIString.h"
+#include "WebKitPrivate.h"
+#include "WebKitSettingsPrivate.h"
+#include "WebKitWebViewGroupPrivate.h"
+#include <glib/gi18n-lib.h>
+#include <wtf/gobject/GRefPtr.h>
+#include <wtf/text/CString.h>
+
+using namespace WebKit;
+
+/**
+ * SECTION: WebKitWebViewGroup
+ * @Short_description: Group of web views
+ * @Title: WebKitWebViewGroup
+ * @See_also: #WebKitWebView, #WebKitSettings
+ *
+ * A WebKitWebViewGroup represents a group of #WebKitWebView<!-- -->s that
+ * share things like settings. There's a default WebKitWebViewGroup where
+ * all #WebKitWebView<!-- -->s of the same #WebKitWebContext are added by default.
+ * To create a #WebKitWebView in a different WebKitWebViewGroup you can use
+ * webkit_web_view_new_with_group().
+ *
+ * WebKitWebViewGroups are identified by a unique name given when the group is
+ * created with webkit_web_view_group_new().
+ * WebKitWebViewGroups have a #WebKitSettings to control the settings of all
+ * #WebKitWebView<!-- -->s of the group. You can get the settings with
+ * webkit_web_view_group_get_settings() to handle the settings, or you can set
+ * your own #WebKitSettings with webkit_web_view_group_set_settings(). When
+ * the #WebKitSettings of a WebKitWebViewGroup changes, the signal notify::settings
+ * is emitted on the group.
+ */
+
+enum {
+ PROP_0,
+
+ PROP_SETTINGS
+};
+
+struct _WebKitWebViewGroupPrivate {
+ RefPtr<WebPageGroup> pageGroup;
+ CString name;
+ GRefPtr<WebKitSettings> settings;
+};
+
+WEBKIT_DEFINE_TYPE(WebKitWebViewGroup, webkit_web_view_group, G_TYPE_OBJECT)
+
+static void webkitWebViewGroupSetProperty(GObject* object, guint propId, const GValue* value, GParamSpec* paramSpec)
+{
+ WebKitWebViewGroup* group = WEBKIT_WEB_VIEW_GROUP(object);
+
+ switch (propId) {
+ case PROP_SETTINGS:
+ webkit_web_view_group_set_settings(group, WEBKIT_SETTINGS(g_value_get_object(value)));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
+ }
+}
+
+static void webkitWebViewGroupGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec)
+{
+ WebKitWebViewGroup* group = WEBKIT_WEB_VIEW_GROUP(object);
+
+ switch (propId) {
+ case PROP_SETTINGS:
+ g_value_set_object(value, webkit_web_view_group_get_settings(group));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
+ }
+}
+
+static void webkitWebViewGroupConstructed(GObject* object)
+{
+ G_OBJECT_CLASS(webkit_web_view_group_parent_class)->constructed(object);
+
+ WebKitWebViewGroupPrivate* priv = WEBKIT_WEB_VIEW_GROUP(object)->priv;
+ priv->settings = adoptGRef(webkit_settings_new());
+}
+
+static void webkit_web_view_group_class_init(WebKitWebViewGroupClass* hitTestResultClass)
+{
+ GObjectClass* objectClass = G_OBJECT_CLASS(hitTestResultClass);
+ objectClass->set_property = webkitWebViewGroupSetProperty;
+ objectClass->get_property = webkitWebViewGroupGetProperty;
+ objectClass->constructed = webkitWebViewGroupConstructed;
+
+ /**
+ * WebKitWebViewGroup:settings:
+ *
+ * The #WebKitSettings of the web view group.
+ */
+ g_object_class_install_property(
+ objectClass,
+ PROP_SETTINGS,
+ g_param_spec_object(
+ "settings",
+ _("Settings"),
+ _("The settings of the web view group"),
+ WEBKIT_TYPE_SETTINGS,
+ WEBKIT_PARAM_READWRITE));
+}
+
+static void webkitWebViewGroupAttachSettingsToPageGroup(WebKitWebViewGroup* group)
+{
+ group->priv->pageGroup->setPreferences(webkitSettingsGetPreferences(group->priv->settings.get()));
+}
+
+WebKitWebViewGroup* webkitWebViewGroupCreate(WebPageGroup* pageGroup)
+{
+ WebKitWebViewGroup* group = WEBKIT_WEB_VIEW_GROUP(g_object_new(WEBKIT_TYPE_WEB_VIEW_GROUP, NULL));
+ group->priv->pageGroup = pageGroup;
+ webkitWebViewGroupAttachSettingsToPageGroup(group);
+ return group;
+}
+
+WebPageGroup* webkitWebViewGroupGetPageGroup(WebKitWebViewGroup* group)
+{
+ return group->priv->pageGroup.get();
+}
+
+/**
+ * webkit_web_view_group_new:
+ * @name: (allow-none): the name of the group
+ *
+ * Creates a new #WebKitWebViewGroup with the given @name.
+ * If @name is %NULL a unique identifier name will be created
+ * automatically.
+ * The newly created #WebKitWebViewGroup doesn't contain any
+ * #WebKitWebView, web views are added to the new group when created
+ * with webkit_web_view_new_with_group() passing the group.
+ *
+ * Returns: (transfer full): a new #WebKitWebViewGroup
+ */
+WebKitWebViewGroup* webkit_web_view_group_new(const char* name)
+{
+ WebKitWebViewGroup* group = WEBKIT_WEB_VIEW_GROUP(g_object_new(WEBKIT_TYPE_WEB_VIEW_GROUP, NULL));
+ group->priv->pageGroup = WebPageGroup::create(name ? String::fromUTF8(name) : String());
+ webkitWebViewGroupAttachSettingsToPageGroup(group);
+ return group;
+}
+
+/**
+ * webkit_web_view_group_get_name:
+ * @group: a #WebKitWebViewGroup
+ *
+ * Gets the name that uniquely identifies the #WebKitWebViewGroup.
+ *
+ * Returns: the name of @group
+ */
+const char* webkit_web_view_group_get_name(WebKitWebViewGroup* group)
+{
+ g_return_val_if_fail(WEBKIT_IS_WEB_VIEW_GROUP(group), 0);
+
+ WebKitWebViewGroupPrivate* priv = group->priv;
+ if (priv->name.isNull())
+ priv->name = priv->pageGroup->identifier().utf8();
+
+ return priv->name.data();
+}
+
+/**
+ * webkit_web_view_group_get_settings:
+ * @group: a #WebKitWebViewGroup
+ *
+ * Gets the #WebKitSettings of the #WebKitWebViewGroup.
+ *
+ * Returns: (transfer none): the settings of @group
+ */
+WebKitSettings* webkit_web_view_group_get_settings(WebKitWebViewGroup* group)
+{
+ g_return_val_if_fail(WEBKIT_IS_WEB_VIEW_GROUP(group), 0);
+
+ return group->priv->settings.get();
+}
+
+/**
+ * webkit_web_view_group_set_settings:
+ * @group: a #WebKitWebViewGroup
+ * @settings: a #WebKitSettings
+ *
+ * Sets a new #WebKitSettings for the #WebKitWebViewGroup. The settings will
+ * affect to all the #WebKitWebView<!-- -->s of the group.
+ * #WebKitWebViewGroup<!-- -->s always have a #WebKitSettings so if you just want to
+ * modify a setting you can use webkit_web_view_group_get_settings() and modify the
+ * returned #WebKitSettings instead.
+ * Setting the same #WebKitSettings multiple times doesn't have any effect.
+ * You can monitor the settings of a #WebKitWebViewGroup by connecting to the
+ * notify::settings signal of @group.
+ */
+void webkit_web_view_group_set_settings(WebKitWebViewGroup* group, WebKitSettings* settings)
+{
+ g_return_if_fail(WEBKIT_IS_WEB_VIEW_GROUP(group));
+ g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
+
+ if (group->priv->settings == settings)
+ return;
+
+ group->priv->settings = settings;
+ webkitWebViewGroupAttachSettingsToPageGroup(group);
+ g_object_notify(G_OBJECT(group), "settings");
+}
+
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_INJECTED_CONTENT_FRAMES_ALL, WebCore::InjectInAllFrames);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_INJECTED_CONTENT_FRAMES_TOP_ONLY, WebCore::InjectInTopFrameOnly);
+
+static PassRefPtr<API::Array> toAPIArray(const char* const* list)
+{
+ if (!list)
+ return 0;
+
+ Vector<RefPtr<API::Object> > entries;
+ while (*list) {
+ entries.append(API::String::createFromUTF8String(*list));
+ list++;
+ }
+ return API::Array::create(std::move(entries));
+}
+
+/**
+ * webkit_web_view_group_add_user_style_sheet:
+ * @group: a #WebKitWebViewGroup
+ * @source: the source of the style_sheet to inject
+ * @base_uri: (allow-none): the base URI to use when processing the style_sheet contents or %NULL for about:blank
+ * @whitelist: (array zero-terminated=1) (allow-none): a whitelist of URI patterns or %NULL
+ * @blacklist: (array zero-terminated=1) (allow-none): a blacklist of URI patterns or %NULL
+ * @injected_frames: a #WebKitInjectedContentFrames describing to which frames the style_sheet should apply
+ *
+ * Inject an external style sheet into pages. It is possible to only apply the style sheet
+ * to some URIs by passing non-null values for @whitelist or @blacklist. Passing a %NULL
+ * whitelist implies that all URIs are on the whitelist. The style sheet is applied if a URI matches
+ * the whitelist and not the blacklist. URI patterns must be of the form [protocol]://[host]/[path]
+ * where the host and path components can contain the wildcard character ('*') to represent zero
+ * or more other characters.
+ */
+void webkit_web_view_group_add_user_style_sheet(WebKitWebViewGroup* group, const char* source, const char* baseURI, const char* const* whitelist, const char* const* blacklist, WebKitInjectedContentFrames injectedFrames)
+{
+ g_return_if_fail(WEBKIT_IS_WEB_VIEW_GROUP(group));
+ g_return_if_fail(source);
+
+ RefPtr<API::Array> webWhitelist = toAPIArray(whitelist);
+ RefPtr<API::Array> webBlacklist = toAPIArray(blacklist);
+
+ // We always use UserStyleUserLevel to match the behavior of WKPageGroupAddUserStyleSheet.
+ group->priv->pageGroup->addUserStyleSheet(
+ String::fromUTF8(source),
+ String::fromUTF8(baseURI),
+ webWhitelist.get(),
+ webBlacklist.get(),
+ static_cast<WebCore::UserContentInjectedFrames>(injectedFrames),
+ WebCore::UserStyleUserLevel);
+}
+
+/**
+ * webkit_web_view_group_remove_all_user_style_sheets:
+ * @group: a #WebKitWebViewGroup
+ *
+ * Remove all style sheets previously injected into this #WebKitWebViewGroup
+ * via webkit_web_view_group_add_user_style_sheet().
+ */
+void webkit_web_view_group_remove_all_user_style_sheets(WebKitWebViewGroup* group)
+{
+ g_return_if_fail(WEBKIT_IS_WEB_VIEW_GROUP(group));
+ group->priv->pageGroup->removeAllUserStyleSheets();
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewGroup.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewGroup.h
new file mode 100644
index 000000000..685f19904
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewGroup.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2013 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
+#error "Only <webkit2/webkit2.h> can be included directly."
+#endif
+
+#ifndef WebKitWebViewGroup_h
+#define WebKitWebViewGroup_h
+
+#include <glib-object.h>
+#include <webkit2/WebKitDefines.h>
+#include <webkit2/WebKitSettings.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_WEB_VIEW_GROUP (webkit_web_view_group_get_type())
+#define WEBKIT_WEB_VIEW_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_WEB_VIEW_GROUP, WebKitWebViewGroup))
+#define WEBKIT_IS_WEB_VIEW_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_WEB_VIEW_GROUP))
+#define WEBKIT_WEB_VIEW_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_WEB_VIEW_GROUP, WebKitWebViewGroupClass))
+#define WEBKIT_IS_WEB_VIEW_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_WEB_VIEW_GROUP))
+#define WEBKIT_WEB_VIEW_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_WEB_VIEW_GROUP, WebKitWebViewGroupClass))
+
+typedef struct _WebKitWebViewGroup WebKitWebViewGroup;
+typedef struct _WebKitWebViewGroupClass WebKitWebViewGroupClass;
+typedef struct _WebKitWebViewGroupPrivate WebKitWebViewGroupPrivate;
+
+struct _WebKitWebViewGroup {
+ GObject parent;
+
+ WebKitWebViewGroupPrivate *priv;
+};
+
+struct _WebKitWebViewGroupClass {
+ GObjectClass parent_class;
+
+ void (*_webkit_reserved0) (void);
+ void (*_webkit_reserved1) (void);
+ void (*_webkit_reserved2) (void);
+ void (*_webkit_reserved3) (void);
+};
+
+/**
+ * WebKitInjectedContentFrames:
+ * @WEBKIT_INJECTED_CONTENT_FRAMES_ALL: Content will be injected into all frames.
+ * @WEBKIT_INJECTED_CONTENT_FRAMES_TOP_ONLY: Content will only be injected into the main frame.
+ *
+ * Enum values used for determining into which frames content is injected.
+ */
+typedef enum {
+ WEBKIT_INJECTED_CONTENT_FRAMES_ALL,
+ WEBKIT_INJECTED_CONTENT_FRAMES_TOP_ONLY,
+} WebKitInjectedContentFrames;
+
+WEBKIT_API GType
+webkit_web_view_group_get_type (void);
+
+WEBKIT_API WebKitWebViewGroup *
+webkit_web_view_group_new (const gchar *name);
+
+WEBKIT_API const gchar *
+webkit_web_view_group_get_name (WebKitWebViewGroup *group);
+
+WEBKIT_API WebKitSettings *
+webkit_web_view_group_get_settings (WebKitWebViewGroup *group);
+
+WEBKIT_API void
+webkit_web_view_group_set_settings (WebKitWebViewGroup *group,
+ WebKitSettings *settings);
+
+WEBKIT_API void
+webkit_web_view_group_add_user_style_sheet (WebKitWebViewGroup *group,
+ const gchar *source,
+ const gchar *base_uri,
+ const gchar * const *whitelist,
+ const gchar * const *blacklist,
+ WebKitInjectedContentFrames injected_frames);
+
+WEBKIT_API void
+webkit_web_view_group_remove_all_user_style_sheets (WebKitWebViewGroup *group);
+
+G_END_DECLS
+
+#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequestPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewGroupPrivate.h
index c23707e76..5fd865610 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequestPrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewGroupPrivate.h
@@ -17,12 +17,13 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef WebKitNotificationPermissionRequestPrivate_h
-#define WebKitNotificationPermissionRequestPrivate_h
+#ifndef WebKitWebViewGroupPrivate_h
+#define WebKitWebViewGroupPrivate_h
-#include "WebKitNotificationPermissionRequest.h"
-#include "WebKitPrivate.h"
+#include "WebKitWebViewGroup.h"
+#include "WebPageGroup.h"
-WebKitNotificationPermissionRequest* webkitNotificationPermissionRequestCreate(WebKit::NotificationPermissionRequest*);
+WebKitWebViewGroup* webkitWebViewGroupCreate(WebKit::WebPageGroup*);
+WebKit::WebPageGroup* webkitWebViewGroupGetPageGroup(WebKitWebViewGroup*);
-#endif // WebKitNotificationPermissionRequestPrivate_h
+#endif // WebKitWebViewGroupPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h
index ece4bede0..11591ff18 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h
@@ -27,9 +27,6 @@
#ifndef WebKitWebViewPrivate_h
#define WebKitWebViewPrivate_h
-#include "InstallMissingMediaPluginsPermissionRequest.h"
-#include "WebContextMenuItemData.h"
-#include "WebHitTestResult.h"
#include "WebImage.h"
#include "WebKitWebView.h"
#include <wtf/text/CString.h>
@@ -37,7 +34,10 @@
void webkitWebViewLoadChanged(WebKitWebView*, WebKitLoadEvent);
void webkitWebViewLoadFailed(WebKitWebView*, WebKitLoadEvent, const char* failingURI, GError*);
void webkitWebViewLoadFailedWithTLSErrors(WebKitWebView*, const char* failingURI, GError*, GTlsCertificateFlags, GTlsCertificate*);
-WebKit::WebPageProxy* webkitWebViewCreateNewPage(WebKitWebView*, const WebCore::WindowFeatures&, WebKitNavigationAction*);
+void webkitWebViewSetEstimatedLoadProgress(WebKitWebView*, double estimatedLoadProgress);
+void webkitWebViewSetTitle(WebKitWebView*, const CString&);
+void webkitWebViewUpdateURI(WebKitWebView*);
+WebKit::WebPageProxy* webkitWebViewCreateNewPage(WebKitWebView*, WebKit::ImmutableDictionary* windowFeatures);
void webkitWebViewReadyToShowPage(WebKitWebView*);
void webkitWebViewRunAsModal(WebKitWebView*);
void webkitWebViewClosePage(WebKitWebView*);
@@ -46,7 +46,7 @@ bool webkitWebViewRunJavaScriptConfirm(WebKitWebView*, const CString& message);
CString webkitWebViewRunJavaScriptPrompt(WebKitWebView*, const CString& message, const CString& defaultText);
void webkitWebViewMakePermissionRequest(WebKitWebView*, WebKitPermissionRequest*);
void webkitWebViewMakePolicyDecision(WebKitWebView*, WebKitPolicyDecisionType, WebKitPolicyDecision*);
-void webkitWebViewMouseTargetChanged(WebKitWebView*, const WebKit::WebHitTestResult::Data&, unsigned modifiers);
+void webkitWebViewMouseTargetChanged(WebKitWebView*, WebKit::WebHitTestResult*, unsigned modifiers);
void webkitWebViewPrintFrame(WebKitWebView*, WebKit::WebFrameProxy*);
void webkitWebViewResourceLoadStarted(WebKitWebView*, WebKit::WebFrameProxy*, uint64_t resourceIdentifier, WebKitURIRequest*);
void webkitWebViewRunFileChooserRequest(WebKitWebView*, WebKitFileChooserRequest*);
@@ -55,15 +55,10 @@ void webKitWebViewDidReceiveSnapshot(WebKitWebView*, uint64_t callbackID, WebKit
void webkitWebViewRemoveLoadingWebResource(WebKitWebView*, uint64_t resourceIdentifier);
bool webkitWebViewEnterFullScreen(WebKitWebView*);
bool webkitWebViewLeaveFullScreen(WebKitWebView*);
-void webkitWebViewPopulateContextMenu(WebKitWebView*, const Vector<WebKit::WebContextMenuItemData>& proposedMenu, const WebKit::WebHitTestResult::Data&, GVariant*);
+void webkitWebViewPopulateContextMenu(WebKitWebView*, API::Array* proposedMenu, WebKit::WebHitTestResult*);
void webkitWebViewSubmitFormRequest(WebKitWebView*, WebKitFormSubmissionRequest*);
void webkitWebViewHandleAuthenticationChallenge(WebKitWebView*, WebKit::AuthenticationChallengeProxy*);
void webkitWebViewInsecureContentDetected(WebKitWebView*, WebKitInsecureContentEvent);
-bool webkitWebViewEmitShowNotification(WebKitWebView*, WebKitNotification*);
-bool webkitWebViewEmitRunColorChooser(WebKitWebView*, WebKitColorChooserRequest*);
void webkitWebViewWebProcessCrashed(WebKitWebView*);
-void webkitWebViewIsPlayingAudioChanged(WebKitWebView*);
-void webkitWebViewSelectionDidChange(WebKitWebView*);
-void webkitWebViewRequestInstallMissingMediaPlugins(WebKitWebView*, WebKit::InstallMissingMediaPluginsPermissionRequest&);
#endif // WebKitWebViewPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebsiteDataManager.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebsiteDataManager.cpp
deleted file mode 100644
index 9d6183707..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebsiteDataManager.cpp
+++ /dev/null
@@ -1,485 +0,0 @@
-/*
- * Copyright (C) 2015 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2,1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "WebKitWebsiteDataManager.h"
-
-#include "APIWebsiteDataStore.h"
-#include "WebKitWebsiteDataManagerPrivate.h"
-#include <WebCore/FileSystem.h>
-#include <glib/gi18n-lib.h>
-#include <wtf/glib/GUniquePtr.h>
-
-using namespace WebKit;
-
-/**
- * SECTION: WebKitWebsiteDataManager
- * @Short_description: Website data manager
- * @Title: WebKitWebsiteDataManager
- * @See_also: #WebKitWebContext
- *
- * WebKitWebsiteDataManager allows you to manage the data that websites
- * can store in the client file system like databases or caches.
- * You can use WebKitWebsiteDataManager to configure the local directories
- * where the Website data will be stored, by creating a new manager with
- * webkit_website_data_manager_new() passing the values you want to set.
- * You can set all the possible configuration values or only some of them,
- * a default value will be used automatically for the configuration options
- * not provided. #WebKitWebsiteDataManager:base-data-directory and
- * #WebKitWebsiteDataManager:base-cache-directory are two special properties
- * that can be used to set a common base directory for all Website data and
- * caches. It's possible to provide both, a base directory and a specific value,
- * but in that case, the specific value takes precedence over the base directory.
- * The newly created WebKitWebsiteDataManager must be passed as a construct property
- * to a #WebKitWebContext, you can use webkit_web_context_new_with_website_data_manager()
- * to create a new #WebKitWebContext with a WebKitWebsiteDataManager.
- * In case you don't want to set any specific configuration, you don't need to create
- * a WebKitWebsiteDataManager, the #WebKitWebContext will create a WebKitWebsiteDataManager
- * with the default configuration. To get the WebKitWebsiteDataManager of a #WebKitWebContext
- * you can use webkit_web_context_get_website_data_manager().
- *
- * Since: 2.10
- */
-
-enum {
- PROP_0,
-
- PROP_BASE_DATA_DIRECTORY,
- PROP_BASE_CACHE_DIRECTORY,
- PROP_LOCAL_STORAGE_DIRECTORY,
- PROP_DISK_CACHE_DIRECTORY,
- PROP_APPLICATION_CACHE_DIRECTORY,
- PROP_INDEXEDDB_DIRECTORY,
- PROP_WEBSQL_DIRECTORY
-};
-
-struct _WebKitWebsiteDataManagerPrivate {
- RefPtr<API::WebsiteDataStore> websiteDataStore;
- GUniquePtr<char> baseDataDirectory;
- GUniquePtr<char> baseCacheDirectory;
- GUniquePtr<char> localStorageDirectory;
- GUniquePtr<char> diskCacheDirectory;
- GUniquePtr<char> applicationCacheDirectory;
- GUniquePtr<char> indexedDBDirectory;
- GUniquePtr<char> webSQLDirectory;
-};
-
-WEBKIT_DEFINE_TYPE(WebKitWebsiteDataManager, webkit_website_data_manager, G_TYPE_OBJECT)
-
-static void webkitWebsiteDataManagerGetProperty(GObject* object, guint propID, GValue* value, GParamSpec* paramSpec)
-{
- WebKitWebsiteDataManager* manager = WEBKIT_WEBSITE_DATA_MANAGER(object);
-
- switch (propID) {
- case PROP_BASE_DATA_DIRECTORY:
- g_value_set_string(value, webkit_website_data_manager_get_base_data_directory(manager));
- break;
- case PROP_BASE_CACHE_DIRECTORY:
- g_value_set_string(value, webkit_website_data_manager_get_base_cache_directory(manager));
- break;
- case PROP_LOCAL_STORAGE_DIRECTORY:
- g_value_set_string(value, webkit_website_data_manager_get_local_storage_directory(manager));
- break;
- case PROP_DISK_CACHE_DIRECTORY:
- g_value_set_string(value, webkit_website_data_manager_get_disk_cache_directory(manager));
- break;
- case PROP_APPLICATION_CACHE_DIRECTORY:
- g_value_set_string(value, webkit_website_data_manager_get_offline_application_cache_directory(manager));
- break;
- case PROP_INDEXEDDB_DIRECTORY:
- g_value_set_string(value, webkit_website_data_manager_get_indexeddb_directory(manager));
- break;
- case PROP_WEBSQL_DIRECTORY:
- g_value_set_string(value, webkit_website_data_manager_get_websql_directory(manager));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, paramSpec);
- }
-}
-
-static void webkitWebsiteDataManagerSetProperty(GObject* object, guint propID, const GValue* value, GParamSpec* paramSpec)
-{
- WebKitWebsiteDataManager* manager = WEBKIT_WEBSITE_DATA_MANAGER(object);
-
- switch (propID) {
- case PROP_BASE_DATA_DIRECTORY:
- manager->priv->baseDataDirectory.reset(g_value_dup_string(value));
- break;
- case PROP_BASE_CACHE_DIRECTORY:
- manager->priv->baseCacheDirectory.reset(g_value_dup_string(value));
- break;
- case PROP_LOCAL_STORAGE_DIRECTORY:
- manager->priv->localStorageDirectory.reset(g_value_dup_string(value));
- break;
- case PROP_DISK_CACHE_DIRECTORY:
- manager->priv->diskCacheDirectory.reset(g_value_dup_string(value));
- break;
- case PROP_APPLICATION_CACHE_DIRECTORY:
- manager->priv->applicationCacheDirectory.reset(g_value_dup_string(value));
- break;
- case PROP_INDEXEDDB_DIRECTORY:
- manager->priv->indexedDBDirectory.reset(g_value_dup_string(value));
- break;
- case PROP_WEBSQL_DIRECTORY:
- manager->priv->webSQLDirectory.reset(g_value_dup_string(value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, paramSpec);
- }
-}
-
-static void webkitWebsiteDataManagerConstructed(GObject* object)
-{
- G_OBJECT_CLASS(webkit_website_data_manager_parent_class)->constructed(object);
-
- WebKitWebsiteDataManagerPrivate* priv = WEBKIT_WEBSITE_DATA_MANAGER(object)->priv;
- if (priv->baseDataDirectory) {
- if (!priv->localStorageDirectory)
- priv->localStorageDirectory.reset(g_build_filename(priv->baseDataDirectory.get(), "localstorage", nullptr));
- if (!priv->indexedDBDirectory)
- priv->indexedDBDirectory.reset(g_build_filename(priv->baseDataDirectory.get(), "databases", "indexeddb", nullptr));
- if (!priv->webSQLDirectory)
- priv->webSQLDirectory.reset(g_build_filename(priv->baseDataDirectory.get(), "databases", nullptr));
- }
-
- if (priv->baseCacheDirectory) {
- if (!priv->diskCacheDirectory)
- priv->diskCacheDirectory.reset(g_strdup(priv->baseCacheDirectory.get()));
- if (!priv->applicationCacheDirectory)
- priv->applicationCacheDirectory.reset(g_build_filename(priv->baseCacheDirectory.get(), "applications", nullptr));
- }
-}
-
-static void webkit_website_data_manager_class_init(WebKitWebsiteDataManagerClass* findClass)
-{
- GObjectClass* gObjectClass = G_OBJECT_CLASS(findClass);
-
- gObjectClass->get_property = webkitWebsiteDataManagerGetProperty;
- gObjectClass->set_property = webkitWebsiteDataManagerSetProperty;
- gObjectClass->constructed = webkitWebsiteDataManagerConstructed;
-
- /**
- * WebKitWebsiteDataManager:base-data-directory:
- *
- * The base directory for Website data. This is used as a base directory
- * for any Website data when no specific data directory has been provided.
- *
- * Since: 2.10
- */
- g_object_class_install_property(
- gObjectClass,
- PROP_BASE_DATA_DIRECTORY,
- g_param_spec_string(
- "base-data-directory",
- _("Base Data Directory"),
- _("The base directory for Website data"),
- nullptr,
- static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
-
- /**
- * WebKitWebsiteDataManager:base-cache-directory:
- *
- * The base directory for Website cache. This is used as a base directory
- * for any Website cache when no specific cache directory has been provided.
- *
- * Since: 2.10
- */
- g_object_class_install_property(
- gObjectClass,
- PROP_BASE_CACHE_DIRECTORY,
- g_param_spec_string(
- "base-cache-directory",
- _("Base Cache Directory"),
- _("The base directory for Website cache"),
- nullptr,
- static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
-
- /**
- * WebKitWebsiteDataManager:local-storage-directory:
- *
- * The directory where local storage data will be stored.
- *
- * Since: 2.10
- */
- g_object_class_install_property(
- gObjectClass,
- PROP_LOCAL_STORAGE_DIRECTORY,
- g_param_spec_string(
- "local-storage-directory",
- _("Local Storage Directory"),
- _("The directory where local storage data will be stored"),
- nullptr,
- static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
-
- /**
- * WebKitWebsiteDataManager:disk-cache-directory:
- *
- * The directory where HTTP disk cache will be stored.
- *
- * Since: 2.10
- */
- g_object_class_install_property(
- gObjectClass,
- PROP_DISK_CACHE_DIRECTORY,
- g_param_spec_string(
- "disk-cache-directory",
- _("Disk Cache Directory"),
- _("The directory where HTTP disk cache will be stored"),
- nullptr,
- static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
-
- /**
- * WebKitWebsiteDataManager:offline-application-cache-directory:
- *
- * The directory where offline web application cache will be stored.
- *
- * Since: 2.10
- */
- g_object_class_install_property(
- gObjectClass,
- PROP_APPLICATION_CACHE_DIRECTORY,
- g_param_spec_string(
- "offline-application-cache-directory",
- _("Offline Web Application Cache Directory"),
- _("The directory where offline web application cache will be stored"),
- nullptr,
- static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
-
- /**
- * WebKitWebsiteDataManager:indexeddb-directory:
- *
- * The directory where IndexedDB databases will be stored.
- *
- * Since: 2.10
- */
- g_object_class_install_property(
- gObjectClass,
- PROP_INDEXEDDB_DIRECTORY,
- g_param_spec_string(
- "indexeddb-directory",
- _("IndexedDB Directory"),
- _("The directory where IndexedDB databases will be stored"),
- nullptr,
- static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
-
- /**
- * WebKitWebsiteDataManager:websql-directory:
- *
- * The directory where WebSQL databases will be stored.
- *
- * Since: 2.10
- */
- g_object_class_install_property(
- gObjectClass,
- PROP_WEBSQL_DIRECTORY,
- g_param_spec_string(
- "websql-directory",
- _("WebSQL Directory"),
- _("The directory where WebSQL databases will be stored"),
- nullptr,
- static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
-}
-
-WebKitWebsiteDataManager* webkitWebsiteDataManagerCreate(WebsiteDataStore::Configuration&& configuration)
-{
- WebKitWebsiteDataManager* manager = WEBKIT_WEBSITE_DATA_MANAGER(g_object_new(WEBKIT_TYPE_WEBSITE_DATA_MANAGER, nullptr));
- manager->priv->websiteDataStore = API::WebsiteDataStore::create(WTF::move(configuration));
-
- return manager;
-}
-
-API::WebsiteDataStore& webkitWebsiteDataManagerGetDataStore(WebKitWebsiteDataManager* manager)
-{
- WebKitWebsiteDataManagerPrivate* priv = manager->priv;
- if (!priv->websiteDataStore) {
- WebsiteDataStore::Configuration configuration;
- configuration.localStorageDirectory = !priv->localStorageDirectory ?
- API::WebsiteDataStore::defaultLocalStorageDirectory() : WebCore::filenameToString(priv->localStorageDirectory.get());
- configuration.networkCacheDirectory = !priv->diskCacheDirectory ?
- API::WebsiteDataStore::defaultNetworkCacheDirectory() : WebCore::pathByAppendingComponent(WebCore::filenameToString(priv->diskCacheDirectory.get()), networkCacheSubdirectory);
- configuration.applicationCacheDirectory = !priv->applicationCacheDirectory ?
- API::WebsiteDataStore::defaultApplicationCacheDirectory() : WebCore::filenameToString(priv->applicationCacheDirectory.get());
- configuration.webSQLDatabaseDirectory = !priv->webSQLDirectory ?
- API::WebsiteDataStore::defaultWebSQLDatabaseDirectory() : WebCore::filenameToString(priv->webSQLDirectory.get());
- configuration.mediaKeysStorageDirectory = API::WebsiteDataStore::defaultMediaKeysStorageDirectory();
- priv->websiteDataStore = API::WebsiteDataStore::create(WTF::move(configuration));
- }
-
- return *priv->websiteDataStore;
-}
-
-/**
- * webkit_website_data_manager_new:
- * @first_option_name: name of the first option to set
- * @...: value of first option, followed by more options, %NULL-terminated
- *
- * Creates a new #WebKitWebsiteDataManager with the given options. It must
- * be passed as construction parameter of a #WebKitWebContext.
- *
- * Returns: (transfer full): the newly created #WebKitWebsiteDataManager
- *
- * Since: 2.10
- */
-WebKitWebsiteDataManager* webkit_website_data_manager_new(const gchar* firstOptionName, ...)
-{
- va_list args;
- va_start(args, firstOptionName);
- WebKitWebsiteDataManager* manager = WEBKIT_WEBSITE_DATA_MANAGER(g_object_new_valist(WEBKIT_TYPE_WEBSITE_DATA_MANAGER, firstOptionName, args));
- va_end(args);
-
- return manager;
-}
-
-/**
- * webkit_website_data_manager_get_base_data_directory:
- * @manager: a #WebKitWebsiteDataManager
- *
- * Get the #WebKitWebsiteDataManager:base-data-directory property.
- *
- * Returns: the base directory for Website data, or %NULL if
- * #WebKitWebsiteDataManager:base-data-directory was not provided.
- *
- * Since: 2.10
- */
-const gchar* webkit_website_data_manager_get_base_data_directory(WebKitWebsiteDataManager* manager)
-{
- g_return_val_if_fail(WEBKIT_IS_WEBSITE_DATA_MANAGER(manager), nullptr);
-
- return manager->priv->baseDataDirectory.get();
-}
-
-/**
- * webkit_website_data_manager_get_base_cache_directory:
- * @manager: a #WebKitWebsiteDataManager
- *
- * Get the #WebKitWebsiteDataManager:base-cache-directory property.
- *
- * Returns: the base directory for Website cache, or %NULL if
- * #WebKitWebsiteDataManager:base-cache-directory was not provided.
- *
- * Since: 2.10
- */
-const gchar* webkit_website_data_manager_get_base_cache_directory(WebKitWebsiteDataManager* manager)
-{
- g_return_val_if_fail(WEBKIT_IS_WEBSITE_DATA_MANAGER(manager), nullptr);
-
- return manager->priv->baseCacheDirectory.get();
-}
-
-/**
- * webkit_website_data_manager_get_local_storage_directory:
- * @manager: a #WebKitWebsiteDataManager
- *
- * Get the #WebKitWebsiteDataManager:local-storage-directory property.
- *
- * Returns: the directory where local storage data is stored.
- *
- * Since: 2.10
- */
-const gchar* webkit_website_data_manager_get_local_storage_directory(WebKitWebsiteDataManager* manager)
-{
- g_return_val_if_fail(WEBKIT_IS_WEBSITE_DATA_MANAGER(manager), nullptr);
-
- WebKitWebsiteDataManagerPrivate* priv = manager->priv;
- if (!priv->localStorageDirectory)
- priv->localStorageDirectory.reset(g_strdup(API::WebsiteDataStore::defaultLocalStorageDirectory().utf8().data()));
- return priv->localStorageDirectory.get();
-}
-
-/**
- * webkit_website_data_manager_get_disk_cache_directory:
- * @manager: a #WebKitWebsiteDataManager
- *
- * Get the #WebKitWebsiteDataManager:disk-cache-directory property.
- *
- * Returns: the directory where HTTP disk cache is stored.
- *
- * Since: 2.10
- */
-const gchar* webkit_website_data_manager_get_disk_cache_directory(WebKitWebsiteDataManager* manager)
-{
- g_return_val_if_fail(WEBKIT_IS_WEBSITE_DATA_MANAGER(manager), nullptr);
-
- WebKitWebsiteDataManagerPrivate* priv = manager->priv;
- if (!priv->diskCacheDirectory) {
- // The default directory already has the subdirectory.
- priv->diskCacheDirectory.reset(g_strdup(WebCore::directoryName(API::WebsiteDataStore::defaultNetworkCacheDirectory()).utf8().data()));
- }
- return priv->diskCacheDirectory.get();
-}
-
-/**
- * webkit_website_data_manager_get_offline_application_cache_directory:
- * @manager: a #WebKitWebsiteDataManager
- *
- * Get the #WebKitWebsiteDataManager:offline-application-cache-directory property.
- *
- * Returns: the directory where offline web application cache is stored.
- *
- * Since: 2.10
- */
-const gchar* webkit_website_data_manager_get_offline_application_cache_directory(WebKitWebsiteDataManager* manager)
-{
- g_return_val_if_fail(WEBKIT_IS_WEBSITE_DATA_MANAGER(manager), nullptr);
-
- WebKitWebsiteDataManagerPrivate* priv = manager->priv;
- if (!priv->applicationCacheDirectory)
- priv->applicationCacheDirectory.reset(g_strdup(API::WebsiteDataStore::defaultApplicationCacheDirectory().utf8().data()));
- return priv->applicationCacheDirectory.get();
-}
-
-/**
- * webkit_website_data_manager_get_indexeddb_directory:
- * @manager: a #WebKitWebsiteDataManager
- *
- * Get the #WebKitWebsiteDataManager:indexeddb-directory property.
- *
- * Returns: the directory where IndexedDB databases are stored.
- *
- * Since: 2.10
- */
-const gchar* webkit_website_data_manager_get_indexeddb_directory(WebKitWebsiteDataManager* manager)
-{
- g_return_val_if_fail(WEBKIT_IS_WEBSITE_DATA_MANAGER(manager), nullptr);
-
- WebKitWebsiteDataManagerPrivate* priv = manager->priv;
- if (!priv->indexedDBDirectory)
- priv->indexedDBDirectory.reset(g_strdup(API::WebsiteDataStore::defaultIndexedDBDatabaseDirectory().utf8().data()));
- return priv->indexedDBDirectory.get();
-}
-
-/**
- * webkit_website_data_manager_get_websql_directory:
- * @manager: a #WebKitWebsiteDataManager
- *
- * Get the #WebKitWebsiteDataManager:websql-directory property.
- *
- * Returns: the directory where WebSQL databases are stored.
- *
- * Since: 2.10
- */
-const gchar* webkit_website_data_manager_get_websql_directory(WebKitWebsiteDataManager* manager)
-{
- g_return_val_if_fail(WEBKIT_IS_WEBSITE_DATA_MANAGER(manager), nullptr);
-
- WebKitWebsiteDataManagerPrivate* priv = manager->priv;
- if (!priv->webSQLDirectory)
- priv->webSQLDirectory.reset(g_strdup(API::WebsiteDataStore::defaultWebSQLDatabaseDirectory().utf8().data()));
- return priv->webSQLDirectory.get();
-}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebsiteDataManager.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebsiteDataManager.h
deleted file mode 100644
index e9d85918c..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebsiteDataManager.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2015 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2,1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
-#error "Only <webkit2/webkit2.h> can be included directly."
-#endif
-
-#ifndef WebKitWebsiteDataManager_h
-#define WebKitWebsiteDataManager_h
-
-#include <glib-object.h>
-#include <webkit2/WebKitDefines.h>
-
-G_BEGIN_DECLS
-
-#define WEBKIT_TYPE_WEBSITE_DATA_MANAGER (webkit_website_data_manager_get_type())
-#define WEBKIT_WEBSITE_DATA_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_WEBSITE_DATA_MANAGER, WebKitWebsiteDataManager))
-#define WEBKIT_IS_WEBSITE_DATA_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_WEBSITE_DATA_MANAGER))
-#define WEBKIT_WEBSITE_DATA_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_WEBSITE_DATA_MANAGER, WebKitWebsiteDataManagerClass))
-#define WEBKIT_IS_WEBSITE_DATA_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_WEBSITE_DATA_MANAGER))
-#define WEBKIT_WEBSITE_DATA_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_WEBSITE_DATA_MANAGER, WebKitWebsiteDataManagerClass))
-
-typedef struct _WebKitWebsiteDataManager WebKitWebsiteDataManager;
-typedef struct _WebKitWebsiteDataManagerClass WebKitWebsiteDataManagerClass;
-typedef struct _WebKitWebsiteDataManagerPrivate WebKitWebsiteDataManagerPrivate;
-
-struct _WebKitWebsiteDataManager {
- GObject parent;
-
- WebKitWebsiteDataManagerPrivate *priv;
-};
-
-struct _WebKitWebsiteDataManagerClass {
- GObjectClass parent_class;
-
- void (*_webkit_reserved0) (void);
- void (*_webkit_reserved1) (void);
- void (*_webkit_reserved2) (void);
- void (*_webkit_reserved3) (void);
-};
-
-WEBKIT_API GType
-webkit_website_data_manager_get_type (void);
-
-WEBKIT_API WebKitWebsiteDataManager *
-webkit_website_data_manager_new (const gchar *first_option_name,
- ...);
-WEBKIT_API const gchar *
-webkit_website_data_manager_get_base_data_directory (WebKitWebsiteDataManager *manager);
-
-WEBKIT_API const gchar *
-webkit_website_data_manager_get_base_cache_directory (WebKitWebsiteDataManager *manager);
-
-WEBKIT_API const gchar *
-webkit_website_data_manager_get_local_storage_directory (WebKitWebsiteDataManager *manager);
-
-WEBKIT_API const gchar *
-webkit_website_data_manager_get_disk_cache_directory (WebKitWebsiteDataManager *manager);
-
-WEBKIT_API const gchar *
-webkit_website_data_manager_get_offline_application_cache_directory (WebKitWebsiteDataManager *manager);
-
-WEBKIT_API const gchar *
-webkit_website_data_manager_get_indexeddb_directory (WebKitWebsiteDataManager *manager);
-
-WEBKIT_API const gchar *
-webkit_website_data_manager_get_websql_directory (WebKitWebsiteDataManager *manager);
-
-G_END_DECLS
-
-#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebsiteDataManagerPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebsiteDataManagerPrivate.h
deleted file mode 100644
index a00b06075..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebsiteDataManagerPrivate.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2015 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef WebKitWebsiteDataManagerPrivate_h
-#define WebKitWebsiteDataManagerPrivate_h
-
-#include "APIWebsiteDataStore.h"
-#include "WebKitPrivate.h"
-#include "WebsiteDataStore.h"
-
-WebKitWebsiteDataManager* webkitWebsiteDataManagerCreate(WebKit::WebsiteDataStore::Configuration&&);
-API::WebsiteDataStore& webkitWebsiteDataManagerGetDataStore(WebKitWebsiteDataManager*);
-
-#endif // WebKitWebsiteDataManagerPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp
index 5e225db78..a40e6db4d 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp
@@ -20,13 +20,12 @@
#include "config.h"
#include "WebKitWindowProperties.h"
-#include "APIDictionary.h"
#include "APINumber.h"
#include "APIURLRequest.h"
+#include "ImmutableDictionary.h"
#include "WebKitPrivate.h"
#include "WebKitWindowPropertiesPrivate.h"
#include <WebCore/IntRect.h>
-#include <WebCore/WindowFeatures.h>
#include <glib/gi18n-lib.h>
using namespace WebKit;
@@ -375,26 +374,54 @@ void webkitWindowPropertiesSetFullscreen(WebKitWindowProperties* windowPropertie
g_object_notify(G_OBJECT(windowProperties), "fullscreen");
}
-void webkitWindowPropertiesUpdateFromWebWindowFeatures(WebKitWindowProperties* windowProperties, const WindowFeatures& windowFeatures)
+void webkitWindowPropertiesUpdateFromWebWindowFeatures(WebKitWindowProperties* windowProperties, ImmutableDictionary* features)
{
GdkRectangle geometry = windowProperties->priv->geometry;
- if (windowFeatures.x)
- geometry.x = *windowFeatures.x;
- if (windowFeatures.y)
- geometry.y = *windowFeatures.y;
- if (windowFeatures.width)
- geometry.width = *windowFeatures.width;
- if (windowFeatures.height)
- geometry.height = *windowFeatures.height;
+
+ API::Double* doubleValue = static_cast<API::Double*>(features->get("x"));
+ if (doubleValue)
+ geometry.x = doubleValue->value();
+
+ doubleValue = static_cast<API::Double*>(features->get("y"));
+ if (doubleValue)
+ geometry.y = doubleValue->value();
+
+ doubleValue = static_cast<API::Double*>(features->get("width"));
+ if (doubleValue)
+ geometry.width = doubleValue->value();
+
+ doubleValue = static_cast<API::Double*>(features->get("height"));
+ if (doubleValue)
+ geometry.height = doubleValue->value();
webkitWindowPropertiesSetGeometry(windowProperties, &geometry);
- webkitWindowPropertiesSetMenubarVisible(windowProperties, windowFeatures.menuBarVisible);
- webkitWindowPropertiesSetStatusbarVisible(windowProperties, windowFeatures.statusBarVisible);
- webkitWindowPropertiesSetToolbarVisible(windowProperties, windowFeatures.toolBarVisible);
- webkitWindowPropertiesSetLocationbarVisible(windowProperties, windowFeatures.locationBarVisible);
- webkitWindowPropertiesSetScrollbarsVisible(windowProperties, windowFeatures.scrollbarsVisible);
- webkitWindowPropertiesSetResizable(windowProperties, windowFeatures.resizable);
- webkitWindowPropertiesSetFullscreen(windowProperties, windowFeatures.fullscreen);
+ API::Boolean* booleanValue = static_cast<API::Boolean*>(features->get("menuBarVisible"));
+ if (booleanValue)
+ webkitWindowPropertiesSetMenubarVisible(windowProperties, booleanValue->value());
+
+ booleanValue = static_cast<API::Boolean*>(features->get("statusBarVisible"));
+ if (booleanValue)
+ webkitWindowPropertiesSetStatusbarVisible(windowProperties, booleanValue->value());
+
+ booleanValue = static_cast<API::Boolean*>(features->get("toolBarVisible"));
+ if (booleanValue)
+ webkitWindowPropertiesSetToolbarVisible(windowProperties, booleanValue->value());
+
+ booleanValue = static_cast<API::Boolean*>(features->get("locationBarVisible"));
+ if (booleanValue)
+ webkitWindowPropertiesSetLocationbarVisible(windowProperties, booleanValue->value());
+
+ booleanValue = static_cast<API::Boolean*>(features->get("scrollbarsVisible"));
+ if (booleanValue)
+ webkitWindowPropertiesSetScrollbarsVisible(windowProperties, booleanValue->value());
+
+ booleanValue = static_cast<API::Boolean*>(features->get("resizable"));
+ if (booleanValue)
+ webkitWindowPropertiesSetResizable(windowProperties, booleanValue->value());
+
+ booleanValue = static_cast<API::Boolean*>(features->get("fullscreen"));
+ if (booleanValue)
+ webkitWindowPropertiesSetFullscreen(windowProperties, booleanValue->value());
}
/**
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWindowPropertiesPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWindowPropertiesPrivate.h
index 05e4b9be0..8ec17b4ea 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWindowPropertiesPrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWindowPropertiesPrivate.h
@@ -31,7 +31,7 @@
#include "WebKitWindowProperties.h"
WebKitWindowProperties* webkitWindowPropertiesCreate();
-void webkitWindowPropertiesUpdateFromWebWindowFeatures(WebKitWindowProperties*, const WebCore::WindowFeatures&);
+void webkitWindowPropertiesUpdateFromWebWindowFeatures(WebKitWindowProperties*, WebKit::ImmutableDictionary* features);
void webkitWindowPropertiesSetGeometry(WebKitWindowProperties*, GdkRectangle*);
void webkitWindowPropertiesSetToolbarVisible(WebKitWindowProperties*, bool toolbarsVisible);
void webkitWindowPropertiesSetMenubarVisible(WebKitWindowProperties*, bool menuBarVisible);
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebViewBaseInputMethodFilter.cpp b/Source/WebKit2/UIProcess/API/gtk/WebViewBaseInputMethodFilter.cpp
new file mode 100644
index 000000000..8b87c1522
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebViewBaseInputMethodFilter.cpp
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebViewBaseInputMethodFilter.h"
+
+#include "NativeWebKeyboardEvent.h"
+#include "WebKitWebViewBasePrivate.h"
+#include "WebPageProxy.h"
+#include <WebCore/Color.h>
+#include <WebCore/CompositionResults.h>
+#include <WebCore/Editor.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void WebViewBaseInputMethodFilter::setWebView(WebKitWebViewBase* webView)
+{
+ GtkInputMethodFilter::setWidget(GTK_WIDGET(webView));
+
+ m_webPageProxy = webkitWebViewBaseGetPage(webView);
+ ASSERT(m_webPageProxy);
+}
+
+bool WebViewBaseInputMethodFilter::canEdit()
+{
+ return true;
+}
+
+bool WebViewBaseInputMethodFilter::sendSimpleKeyEvent(GdkEventKey* event, WTF::String simpleString, EventFakedForComposition faked)
+{
+ ASSERT(m_webPageProxy);
+ m_webPageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(reinterpret_cast<GdkEvent*>(event),
+ CompositionResults(simpleString), faked));
+ return true;
+}
+
+bool WebViewBaseInputMethodFilter::sendKeyEventWithCompositionResults(GdkEventKey* event, ResultsToSend resultsToSend, EventFakedForComposition faked)
+{
+ ASSERT(m_webPageProxy);
+ m_webPageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(reinterpret_cast<GdkEvent*>(event),
+ CompositionResults(CompositionResults::WillSendCompositionResultsSoon),
+ faked));
+
+ if (resultsToSend & Composition && !m_confirmedComposition.isNull())
+ confirmCompositionText(m_confirmedComposition);
+ if (resultsToSend & Preedit && !m_preedit.isNull())
+ setPreedit(m_preedit, m_cursorOffset);
+ return true;
+}
+
+void WebViewBaseInputMethodFilter::confirmCompositionText(String text)
+{
+ ASSERT(m_webPageProxy);
+ m_webPageProxy->confirmComposition(text, -1, 0);
+}
+
+void WebViewBaseInputMethodFilter::confirmCurrentComposition()
+{
+ ASSERT(m_webPageProxy);
+ m_webPageProxy->confirmComposition(String(), -1, 0);
+}
+
+void WebViewBaseInputMethodFilter::cancelCurrentComposition()
+{
+ ASSERT(m_webPageProxy);
+ m_webPageProxy->cancelComposition();
+}
+
+void WebViewBaseInputMethodFilter::setPreedit(String newPreedit, int cursorOffset)
+{
+ // TODO: We should parse the PangoAttrList that we get from the IM context here.
+ Vector<CompositionUnderline> underlines;
+ underlines.append(CompositionUnderline(0, newPreedit.length(), Color(1, 1, 1), false));
+
+ ASSERT(m_webPageProxy);
+ m_webPageProxy->setComposition(newPreedit, underlines,
+ m_cursorOffset, m_cursorOffset,
+ 0 /* replacement start */,
+ 0 /* replacement end */);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebViewBaseInputMethodFilter.h b/Source/WebKit2/UIProcess/API/gtk/WebViewBaseInputMethodFilter.h
new file mode 100644
index 000000000..9cde8b12d
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebViewBaseInputMethodFilter.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebViewBaseInputMethodFilter_h
+#define WebViewBaseInputMethodFilter_h
+
+#include "GtkInputMethodFilter.h"
+#include "WebPageProxy.h"
+
+typedef struct _WebKitWebViewBase WebKitWebViewBase;
+
+namespace WebKit {
+
+class WebViewBaseInputMethodFilter : public WebCore::GtkInputMethodFilter {
+public:
+ void setWebView(WebKitWebViewBase*);
+
+protected:
+ virtual bool sendSimpleKeyEvent(GdkEventKey*, WTF::String eventString, EventFakedForComposition);
+ virtual bool sendKeyEventWithCompositionResults(GdkEventKey*, ResultsToSend, EventFakedForComposition);
+ virtual bool canEdit();
+ virtual void confirmCompositionText(String);
+ virtual void confirmCurrentComposition();
+ virtual void cancelCurrentComposition();
+ virtual void setPreedit(String, int cursorOffset);
+
+private:
+ WebPageProxy* m_webPageProxy;
+};
+
+} // namespace WebKit
+
+#endif // WebViewBaseInputMethodFilter_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml
index 756aa0e32..e3cf9a68c 100644
--- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml
+++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml
@@ -23,19 +23,14 @@
<xi:include href="xml/WebKitDownload.xml"/>
<xi:include href="xml/WebKitPermissionRequest.xml"/>
<xi:include href="xml/WebKitGeolocationPermissionRequest.xml"/>
- <xi:include href="xml/WebKitInstallMissingMediaPluginsPermissionRequest.xml"/>
- <xi:include href="xml/WebKitNavigationAction.xml"/>
- <xi:include href="xml/WebKitUserMediaPermissionRequest.xml"/>
<xi:include href="xml/WebKitPolicyDecision.xml"/>
<xi:include href="xml/WebKitNavigationPolicyDecision.xml"/>
<xi:include href="xml/WebKitResponsePolicyDecision.xml"/>
<xi:include href="xml/WebKitHitTestResult.xml"/>
- <xi:include href="xml/WebKitEditorState.xml"/>
<xi:include href="xml/WebKitPrintOperation.xml"/>
<xi:include href="xml/WebKitWebResource.xml"/>
<xi:include href="xml/WebKitError.xml"/>
<xi:include href="xml/WebKitFaviconDatabase.xml"/>
- <xi:include href="xml/WebKitColorChooserRequest.xml"/>
<xi:include href="xml/WebKitFileChooserRequest.xml"/>
<xi:include href="xml/WebKitFindController.xml"/>
<xi:include href="xml/WebKitCookieManager.xml"/>
@@ -47,11 +42,8 @@
<xi:include href="xml/WebKitContextMenuItem.xml"/>
<xi:include href="xml/WebKitFormSubmissionRequest.xml"/>
<xi:include href="xml/WebKitSecurityManager.xml"/>
- <xi:include href="xml/WebKitUserContentManager.xml"/>
- <xi:include href="xml/WebKitUserContent.xml"/>
- <xi:include href="xml/WebKitNotification.xml"/>
- <xi:include href="xml/WebKitNotificationPermissionRequest.xml"/>
- <xi:include href="xml/WebKitWebsiteDataManager.xml"/>
+ <xi:include href="xml/WebKitWebViewGroup.xml"/>
+ <xi:include href="xml/WebKitCertificateInfo.xml"/>
</chapter>
<chapter>
@@ -60,43 +52,21 @@
<xi:include href="xml/WebKitWebPage.xml"/>
<xi:include href="xml/WebKitFrame.xml"/>
<xi:include href="xml/WebKitScriptWorld.xml"/>
- <xi:include href="xml/WebKitWebHitTestResult.xml"/>
- <xi:include href="xml/WebKitWebEditor.xml"/>
</chapter>
<index id="index-all">
<title>Index</title>
</index>
-
- <index id="api-index-deprecated" role="deprecated">
- <title>Index of deprecated symbols</title>
- <xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
- </index>
-
+
<index id="api-index-2-2" role="2.2">
<title>Index of new symbols in 2.2</title>
<xi:include href="xml/api-index-2.2.xml"><xi:fallback /></xi:include>
- </index>
+ </index>
<index id="api-index-2-4" role="2.4">
<title>Index of new symbols in 2.4</title>
<xi:include href="xml/api-index-2.4.xml"><xi:fallback /></xi:include>
</index>
- <index id="api-index-2-6" role="2.6">
- <title>Index of new symbols in 2.6</title>
- <xi:include href="xml/api-index-2.6.xml"><xi:fallback /></xi:include>
- </index>
-
- <index id="api-index-2-8" role="2.8">
- <title>Index of new symbols in 2.8</title>
- <xi:include href="xml/api-index-2.8.xml"><xi:fallback /></xi:include>
- </index>
-
- <index id="api-index-2-10" role="2.10">
- <title>Index of new symbols in 2.10</title>
- <xi:include href="xml/api-index-2.10.xml"><xi:fallback /></xi:include>
- </index>
-
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
</book>
diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
index 327499503..a098a00d8 100644
--- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt
+++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
@@ -16,8 +16,7 @@ WEBKIT_WEB_VIEW_BASE_GET_CLASS
webkit_web_view_base_get_type
WebKitWebViewBasePrivate
WEBKIT_API
-WEBKIT_DEPRECATED
-WEBKIT_DEPRECATED_FOR
+WEBKIT_OBSOLETE_API
</SECTION>
<SECTION>
@@ -28,13 +27,8 @@ WebKitCacheModel
WebKitProcessModel
WebKitTLSErrorsPolicy
webkit_web_context_get_default
-webkit_web_context_new
-webkit_web_context_new_with_website_data_manager
-webkit_web_context_get_website_data_manager
webkit_web_context_get_cache_model
webkit_web_context_set_cache_model
-webkit_web_context_get_web_process_count_limit
-webkit_web_context_set_web_process_count_limit
webkit_web_context_clear_cache
webkit_web_context_download_uri
webkit_web_context_get_cookie_manager
@@ -79,62 +73,13 @@ webkit_web_context_get_type
</SECTION>
<SECTION>
-<FILE>WebKitUserContent</FILE>
-<TITLE>WebKitUserContent</TITLE>
-WebKitUserStyleSheet
-WebKitUserScript
-WebKitUserContentInjectedFrames
-WebKitUserStyleLevel
-WebKitUserScriptInjectionTime
-webkit_user_style_sheet_ref
-webkit_user_style_sheet_unref
-webkit_user_style_sheet_new
-webkit_user_script_ref
-webkit_user_script_unref
-webkit_user_script_new
-
-<SUBSECTION Standard>
-WEBKIT_TYPE_USER_STYLE_SHEET
-WEBKIT_TYPE_USER_SCRIPT
-
-<SUBSECTION Private>
-webkit_user_style_sheet_get_type
-webkit_user_script_get_type
-</SECTION>
-
-<SECTION>
-<FILE>WebKitUserContentManager</FILE>
-<TITLE>WebKitUserContentManager</TITLE>
-WebKitUserContentManager
-webkit_user_content_manager_new
-webkit_user_content_manager_add_style_sheet
-webkit_user_content_manager_remove_all_style_sheets
-webkit_user_content_manager_add_script
-webkit_user_content_manager_remove_all_scripts
-webkit_user_content_manager_register_script_message_handler
-webkit_user_content_manager_unregister_script_message_handler
-
-<SUBSECTION Standard>
-WEBKIT_IS_USER_CONTENT_MANAGER
-WEBKIT_IS_USER_CONTENT_MANAGER_CLASS
-WEBKIT_TYPE_USER_CONTENT_MANAGER
-WEBKIT_USER_CONTENT_MANAGER
-WEBKIT_USER_CONTENT_MANAGER_CLASS
-WEBKIT_USER_CONTENT_MANAGER_GET_CLASS
-WebKitUserContentManagerClass
-
-<SUBSECTION Private>
-WebKitUserContentManagerPrivate
-webkit_user_content_manager_get_type
-</SECTION>
-
-<SECTION>
<FILE>WebKitWebView</FILE>
<TITLE>WebKitWebView</TITLE>
WebKitWebView
WebKitLoadEvent
WebKitPolicyDecisionType
WebKitSaveMode
+WebKitViewMode
WebKitInsecureContentEvent
WebKitSnapshotOptions
WebKitSnapshotRegion
@@ -146,22 +91,18 @@ WEBKIT_EDITING_COMMAND_PASTE
WEBKIT_EDITING_COMMAND_SELECT_ALL
WEBKIT_EDITING_COMMAND_UNDO
WEBKIT_EDITING_COMMAND_REDO
-WEBKIT_EDITING_COMMAND_INSERT_IMAGE
-WEBKIT_EDITING_COMMAND_CREATE_LINK
<SUBSECTION>
webkit_web_view_new
webkit_web_view_new_with_context
webkit_web_view_new_with_related_view
-webkit_web_view_new_with_settings
-webkit_web_view_new_with_user_content_manager
+webkit_web_view_new_with_group
webkit_web_view_get_context
-webkit_web_view_get_user_content_manager
+webkit_web_view_get_group
webkit_web_view_load_uri
webkit_web_view_load_html
webkit_web_view_load_alternate_html
webkit_web_view_load_plain_text
-webkit_web_view_load_bytes
webkit_web_view_load_request
webkit_web_view_can_go_back
webkit_web_view_go_back
@@ -173,7 +114,6 @@ webkit_web_view_reload
webkit_web_view_reload_bypass_cache
webkit_web_view_stop_loading
webkit_web_view_is_loading
-webkit_web_view_is_playing_audio
webkit_web_view_get_estimated_load_progress
webkit_web_view_get_custom_charset
webkit_web_view_set_custom_charset
@@ -189,7 +129,6 @@ webkit_web_view_get_zoom_level
webkit_web_view_can_execute_editing_command
webkit_web_view_can_execute_editing_command_finish
webkit_web_view_execute_editing_command
-webkit_web_view_execute_editing_command_with_argument
webkit_web_view_get_find_controller
webkit_web_view_get_inspector
webkit_web_view_get_javascript_global_context
@@ -203,14 +142,11 @@ webkit_web_view_save_finish
webkit_web_view_save_to_file
webkit_web_view_save_to_file_finish
webkit_web_view_download_uri
+webkit_web_view_set_view_mode
+webkit_web_view_get_view_mode
webkit_web_view_get_tls_info
webkit_web_view_get_snapshot
webkit_web_view_get_snapshot_finish
-webkit_web_view_set_background_color
-webkit_web_view_get_background_color
-webkit_web_view_set_editable
-webkit_web_view_is_editable
-webkit_web_view_get_editor_state
<SUBSECTION WebKitJavascriptResult>
WebKitJavascriptResult
@@ -439,8 +375,6 @@ webkit_settings_get_enable_spatial_navigation
webkit_settings_set_enable_spatial_navigation
webkit_settings_get_enable_mediasource
webkit_settings_set_enable_mediasource
-webkit_settings_get_allow_file_access_from_file_urls
-webkit_settings_set_allow_file_access_from_file_urls
<SUBSECTION Standard>
WebKitSettingsClass
@@ -486,7 +420,6 @@ webkit_uri_response_get_status_code
webkit_uri_response_get_content_length
webkit_uri_response_get_mime_type
webkit_uri_response_get_suggested_filename
-webkit_uri_response_get_http_headers
<SUBSECTION Standard>
WebKitURIResponseClass
@@ -540,8 +473,6 @@ webkit_download_get_estimated_progress
webkit_download_get_elapsed_time
webkit_download_get_received_data_length
webkit_download_get_web_view
-webkit_download_get_allow_overwrite
-webkit_download_set_allow_overwrite
<SUBSECTION Standard>
WebKitDownloadClass
@@ -593,103 +524,6 @@ webkit_geolocation_permission_request_get_type
</SECTION>
<SECTION>
-<FILE>WebKitInstallMissingMediaPluginsPermissionRequest</FILE>
-WebKitInstallMissingMediaPluginsPermissionRequest
-webkit_install_missing_media_plugins_permission_request_get_description
-
-<SUBSECTION Standard>
-WebKitInstallMissingMediaPluginsPermissionRequestClass
-WEBKIT_TYPE_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST
-WEBKIT_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST
-WEBKIT_IS_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST
-WEBKIT_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST_CLASS
-WEBKIT_IS_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST_CLASS
-WEBKIT_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST_GET_CLASS
-
-<SUBSECTION Private>
-WebKitInstallMissingMediaPluginsPermissionRequestPrivate
-webkit_install_missing_media_plugins_permission_request_get_type
-</SECTION>
-
-<SECTION>
-<FILE>WebKitNavigationAction</FILE>
-WebKitNavigationAction
-webkit_navigation_action_copy
-webkit_navigation_action_free
-webkit_navigation_action_get_navigation_type
-webkit_navigation_action_get_mouse_button
-webkit_navigation_action_get_modifiers
-webkit_navigation_action_get_request
-webkit_navigation_action_is_user_gesture
-
-<SUBSECTION Standard>
-WEBKIT_TYPE_NAVIGATION_ACTION
-
-<SUBSECTION Private>
-webkit_navigation_action_get_type
-</SECTION>
-
-<SECTION>
-<FILE>WebKitUserMediaPermissionRequest</FILE>
-WebKitUserMediaPermissionRequest
-webkit_user_media_permission_is_for_audio_device
-webkit_user_media_permission_is_for_video_device
-
-<SUBSECTION Standard>
-WebKitUserMediaPermissionRequestClass
-WEBKIT_TYPE_USER_MEDIA_PERMISSION_REQUEST
-WEBKIT_USER_MEDIA_PERMISSION_REQUEST
-WEBKIT_IS_USER_MEDIA_PERMISSION_REQUEST
-WEBKIT_USER_MEDIA_PERMISSION_REQUEST_CLASS
-WEBKIT_IS_USER_MEDIA_PERMISSION_REQUEST_CLASS
-WEBKIT_USER_MEDIA_PERMISSION_REQUEST_GET_CLASS
-
-<SUBSECTION Private>
-WebKitUserMediaPermissionRequestPrivate
-webkit_user_media_permission_request_get_type
-</SECTION>
-
-<SECTION>
-<FILE>WebKitNotification</FILE>
-WebKitNotification
-webkit_notification_get_id
-webkit_notification_get_title
-webkit_notification_get_body
-webkit_notification_close
-
-<SUBSECTION Standard>
-WebKitNotificationClass
-WEBKIT_TYPE_NOTIFICATION
-WEBKIT_IS_NOTIFICATION
-WEBKIT_NOTIFICATION
-WEBKIT_NOTIFICATION_CLASS
-WEBKIT_IS_NOTIFICATION_CLASS
-WEBKIT_NOTIFICATION_GET_CLASS
-
-<SUBSECTION Private>
-WebKitNotificationPrivate
-webkit_notification_get_type
-</SECTION>
-
-<SECTION>
-<FILE>WebKitNotificationPermissionRequest</FILE>
-WebKitNotificationPermissionRequest
-
-<SUBSECTION Standard>
-WebKitNotificationPermissionRequestClass
-WEBKIT_TYPE_NOTIFICATION_PERMISSION_REQUEST
-WEBKIT_NOTIFICATION_PERMISSION_REQUEST
-WEBKIT_IS_NOTIFICATION_PERMISSION_REQUEST
-WEBKIT_NOTIFICATION_PERMISSION_REQUEST_CLASS
-WEBKIT_IS_NOTIFICATION_PERMISSION_REQUEST_CLASS
-WEBKIT_NOTIFICATION_PERMISSION_REQUEST_GET_CLASS
-
-<SUBSECTION Private>
-WebKitNotificationPermissionRequestPrivate
-webkit_notification_permission_request_get_type
-</SECTION>
-
-<SECTION>
<FILE>WebKitPolicyDecision</FILE>
WebKitPolicyDecision
webkit_policy_decision_download
@@ -714,7 +548,6 @@ webkit_policy_decision_get_type
<FILE>WebKitNavigationPolicyDecision</FILE>
WebKitNavigationPolicyDecision
WebKitNavigationType
-webkit_navigation_policy_decision_get_navigation_action
webkit_navigation_policy_decision_get_frame_name
webkit_navigation_policy_decision_get_modifiers
webkit_navigation_policy_decision_get_mouse_button
@@ -765,7 +598,6 @@ webkit_hit_test_result_context_is_link
webkit_hit_test_result_context_is_image
webkit_hit_test_result_context_is_media
webkit_hit_test_result_context_is_editable
-webkit_hit_test_result_context_is_selection
webkit_hit_test_result_get_link_uri
webkit_hit_test_result_get_link_title
webkit_hit_test_result_get_link_label
@@ -788,26 +620,6 @@ webkit_hit_test_result_get_type
</SECTION>
<SECTION>
-<FILE>WebKitEditorState</FILE>
-WebKitEditorState
-WebKitEditorTypingAttributes
-webkit_editor_state_get_typing_attributes
-
-<SUBSECTION Standard>
-WebKitEditorStateClass
-WEBKIT_TYPE_EDITOR_STATE
-WEBKIT_EDITOR_STATE
-WEBKIT_IS_EDITOR_STATE
-WEBKIT_EDITOR_STATE_CLASS
-WEBKIT_IS_EDITOR_STATE_CLASS
-WEBKIT_EDITOR_STATE_GET_CLASS
-
-<SUBSECTION Private>
-WebKitEditorStatePrivate
-webkit_editor_state_get_type
-</SECTION>
-
-<SECTION>
<FILE>WebKitPrintOperation</FILE>
WebKitPrintOperation
WebKitPrintOperationResponse
@@ -1022,7 +834,6 @@ WebKitPluginPrivate
WebKitWebInspector
webkit_web_inspector_get_web_view
webkit_web_inspector_get_inspected_uri
-webkit_web_inspector_get_can_attach
webkit_web_inspector_is_attached
webkit_web_inspector_attach
webkit_web_inspector_detach
@@ -1097,8 +908,6 @@ webkit_context_menu_last
webkit_context_menu_get_item_at_position
webkit_context_menu_remove
webkit_context_menu_remove_all
-webkit_context_menu_set_user_data
-webkit_context_menu_get_user_data
<SUBSECTION Standard>
WebKitContextMenuClass
@@ -1194,29 +1003,28 @@ webkit_security_manager_get_type
</SECTION>
<SECTION>
-<FILE>WebKitWebsiteDataManager</FILE>
-WebKitWebsiteDataManager
-webkit_website_data_manager_new
-webkit_website_data_manager_get_base_data_directory
-webkit_website_data_manager_get_base_cache_directory
-webkit_website_data_manager_get_local_storage_directory
-webkit_website_data_manager_get_disk_cache_directory
-webkit_website_data_manager_get_offline_application_cache_directory
-webkit_website_data_manager_get_indexeddb_directory
-webkit_website_data_manager_get_websql_directory
+<FILE>WebKitWebViewGroup</FILE>
+WebKitWebViewGroup
+WebKitInjectedContentFrames
+webkit_web_view_group_new
+webkit_web_view_group_get_name
+webkit_web_view_group_get_settings
+webkit_web_view_group_set_settings
+webkit_web_view_group_add_user_style_sheet
+webkit_web_view_group_remove_all_user_style_sheets
<SUBSECTION Standard>
-WebKitWebsiteDataManagerClass
-WEBKIT_TYPE_WEBSITE_DATA_MANAGER
-WEBKIT_WEBSITE_DATA_MANAGER
-WEBKIT_IS_WEBSITE_DATA_MANAGER
-WEBKIT_WEBSITE_DATA_MANAGER_CLASS
-WEBKIT_IS_WEBSITE_DATA_MANAGER_CLASS
-WEBKIT_WEBSITE_DATA_MANAGER_GET_CLASS
+WebKitWebViewGroupClass
+WEBKIT_TYPE_WEB_VIEW_GROUP
+WEBKIT_WEB_VIEW_GROUP
+WEBKIT_IS_WEB_VIEW_GROUP
+WEBKIT_WEB_VIEW_GROUP_CLASS
+WEBKIT_IS_WEB_VIEW_GROUP_CLASS
+WEBKIT_WEB_VIEW_GROUP_GET_CLASS
<SUBSECTION Private>
-WebKitWebsiteDataManagerPrivate
-webkit_website_data_manager_get_type
+WebKitWebViewGroupPrivate
+webkit_web_view_group_get_type
</SECTION>
<SECTION>
@@ -1247,7 +1055,6 @@ webkit_web_page_get_dom_document
webkit_web_page_get_id
webkit_web_page_get_uri
webkit_web_page_get_main_frame
-webkit_web_page_get_editor
<SUBSECTION Standard>
WebKitWebPageClass
@@ -1264,25 +1071,6 @@ webkit_web_page_get_type
</SECTION>
<SECTION>
-<FILE>WebKitWebEditor</FILE>
-WebKitWebEditor
-webkit_web_editor_get_page
-
-<SUBSECTION Standard>
-WebKitWebEditorClass
-WEBKIT_TYPE_WEB_EDITOR
-WEBKIT_WEB_EDITOR
-WEBKIT_IS_WEB_EDITOR
-WEBKIT_WEB_EDITOR_CLASS
-WEBKIT_IS_WEB_EDITOR_CLASS
-WEBKIT_WEB_EDITOR_GET_CLASS
-
-<SUBSECTION Private>
-WebKitWebEditorPrivate
-webkit_web_editor_get_type
-</SECTION>
-
-<SECTION>
<FILE>WebKitFrame</FILE>
WebKitFrame
webkit_frame_is_main_frame
@@ -1325,43 +1113,16 @@ webkit_script_world_get_type
</SECTION>
<SECTION>
-<FILE>WebKitWebHitTestResult</FILE>
-WebKitWebHitTestResult
-webkit_web_hit_test_result_get_node
-
-<SUBSECTION Standard>
-WebKitWebHitTestResultClass
-WEBKIT_TYPE_WEB_HIT_TEST_RESULT
-WEBKIT_WEB_HIT_TEST_RESULT
-WEBKIT_IS_WEB_HIT_TEST_RESULT
-WEBKIT_WEB_HIT_TEST_RESULT_CLASS
-WEBKIT_IS_WEB_HIT_TEST_RESULT_CLASS
-WEBKIT_WEB_HIT_TEST_RESULT_GET_CLASS
-
-<SUBSECTION Private>
-WebKitWebHitTestResultPrivate
-webkit_web_hit_test_result_get_type
-</SECTION>
-
-<SECTION>
-<FILE>WebKitColorChooserRequest</FILE>
-WebKitColorChooserRequest
-webkit_color_chooser_request_get_rgba
-webkit_color_chooser_request_set_rgba
-webkit_color_chooser_request_get_element_rectangle
-webkit_color_chooser_request_finish
-webkit_color_chooser_request_cancel
+<FILE>WebKitCertificateInfo</FILE>
+WebKitCertificateInfo
+webkit_certificate_info_copy
+webkit_certificate_info_free
+webkit_certificate_info_get_tls_certificate
+webkit_certificate_info_get_tls_errors
<SUBSECTION Standard>
-WebKitColorChooserRequestClass
-WEBKIT_TYPE_COLOR_CHOOSER_REQUEST
-WEBKIT_COLOR_CHOOSER_REQUEST
-WEBKIT_IS_COLOR_CHOOSER_REQUEST
-WEBKIT_COLOR_CHOOSER_REQUEST_CLASS
-WEBKIT_IS_COLOR_CHOOSER_REQUEST_CLASS
-WEBKIT_COLOR_CHOOSER_REQUEST_GET_CLASS
+WEBKIT_TYPE_CERTIFICATE_INFO
<SUBSECTION Private>
-WebKitColorChooserRequestPrivate
-webkit_color_chooser_request_get_type
+webkit_certificate_info_get_type
</SECTION>
diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0.types b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk.types
index f22748e78..4b583bad9 100644
--- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0.types
+++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk.types
@@ -21,14 +21,10 @@ webkit_web_inspector_get_type
webkit_uri_scheme_request_get_type
webkit_context_menu_get_type
webkit_context_menu_item_get_type
+webkit_web_view_group_get_type
webkit_web_extension_get_type
webkit_web_page_get_type
webkit_authentication_request_get_type
webkit_credential_get_type
webkit_frame_get_type
webkit_certificate_info_get_type
-webkit_user_content_manager_get_type
-webkit_web_hit_test_result_get_type
-webkit_website_data_manager_get_type
-webkit_editor_state_get_type
-webkit_install_missing_media_plugins_permission_request_get_type
diff --git a/Source/WebKit2/UIProcess/API/gtk/webkit2.h b/Source/WebKit2/UIProcess/API/gtk/webkit2.h
index 7e08a6506..c18538a63 100644
--- a/Source/WebKit2/UIProcess/API/gtk/webkit2.h
+++ b/Source/WebKit2/UIProcess/API/gtk/webkit2.h
@@ -30,6 +30,7 @@
#include <webkit2/WebKitAuthenticationRequest.h>
#include <webkit2/WebKitBackForwardList.h>
#include <webkit2/WebKitBackForwardListItem.h>
+#include <webkit2/WebKitCertificateInfo.h>
#include <webkit2/WebKitContextMenu.h>
#include <webkit2/WebKitContextMenuActions.h>
#include <webkit2/WebKitContextMenuItem.h>
@@ -38,23 +39,17 @@
#include <webkit2/WebKitDefines.h>
#include <webkit2/WebKitDownload.h>
#include <webkit2/WebKitEditingCommands.h>
-#include <webkit2/WebKitEditorState.h>
#include <webkit2/WebKitEnumTypes.h>
#include <webkit2/WebKitError.h>
#include <webkit2/WebKitFaviconDatabase.h>
-#include <webkit2/WebKitColorChooserRequest.h>
#include <webkit2/WebKitFileChooserRequest.h>
#include <webkit2/WebKitFindController.h>
#include <webkit2/WebKitFormSubmissionRequest.h>
#include <webkit2/WebKitGeolocationPermissionRequest.h>
#include <webkit2/WebKitHitTestResult.h>
-#include <webkit2/WebKitInstallMissingMediaPluginsPermissionRequest.h>
#include <webkit2/WebKitJavascriptResult.h>
#include <webkit2/WebKitMimeInfo.h>
-#include <webkit2/WebKitNavigationAction.h>
#include <webkit2/WebKitNavigationPolicyDecision.h>
-#include <webkit2/WebKitNotification.h>
-#include <webkit2/WebKitNotificationPermissionRequest.h>
#include <webkit2/WebKitPermissionRequest.h>
#include <webkit2/WebKitPlugin.h>
#include <webkit2/WebKitPrintOperation.h>
@@ -65,16 +60,13 @@
#include <webkit2/WebKitURIRequest.h>
#include <webkit2/WebKitURIResponse.h>
#include <webkit2/WebKitURISchemeRequest.h>
-#include <webkit2/WebKitUserContent.h>
-#include <webkit2/WebKitUserContentManager.h>
-#include <webkit2/WebKitUserMediaPermissionRequest.h>
#include <webkit2/WebKitVersion.h>
#include <webkit2/WebKitWebContext.h>
#include <webkit2/WebKitWebInspector.h>
#include <webkit2/WebKitWebResource.h>
#include <webkit2/WebKitWebView.h>
#include <webkit2/WebKitWebViewBase.h>
-#include <webkit2/WebKitWebsiteDataManager.h>
+#include <webkit2/WebKitWebViewGroup.h>
#include <webkit2/WebKitWindowProperties.h>
#undef __WEBKIT2_H_INSIDE__