Diff
Modified: trunk/Source/WebKit2/ChangeLog (218088 => 218089)
--- trunk/Source/WebKit2/ChangeLog 2017-06-12 05:19:00 UTC (rev 218088)
+++ trunk/Source/WebKit2/ChangeLog 2017-06-12 06:05:05 UTC (rev 218089)
@@ -1,3 +1,35 @@
+2017-06-11 Carlos Garcia Campos <[email protected]>
+
+ [GTK] Remove WKInspectorClientGtk
+ https://bugs.webkit.org/show_bug.cgi?id=173142
+
+ Reviewed by Michael Catanzaro.
+
+ It's only used internally in GTk+ API, we can simplify it by using a C++ client instead.
+
+ * PlatformGTK.cmake:
+ * UIProcess/API/C/gtk/WKInspectorClientGtk.cpp: Removed.
+ * UIProcess/API/C/gtk/WKInspectorClientGtk.h: Removed.
+ * UIProcess/API/gtk/WebKitPrivate.h:
+ * UIProcess/API/gtk/WebKitWebInspector.cpp:
+ (_WebKitWebInspectorPrivate::~_WebKitWebInspectorPrivate):
+ (webkitWebInspectorCreate):
+ * UIProcess/WebInspectorProxy.cpp:
+ * UIProcess/WebInspectorProxy.h:
+ * UIProcess/gtk/WebInspectorClientGtk.cpp: Removed.
+ * UIProcess/gtk/WebInspectorProxyClient.h: Renamed from Source/WebKit2/UIProcess/gtk/WebInspectorClientGtk.h.
+ * UIProcess/gtk/WebInspectorProxyGtk.cpp:
+ (WebKit::WebInspectorProxy::setClient):
+ (WebKit::WebInspectorProxy::createInspectorWindow):
+ (WebKit::WebInspectorProxy::platformDidClose):
+ (WebKit::WebInspectorProxy::platformBringToFront):
+ (WebKit::WebInspectorProxy::platformInspectedURLChanged):
+ (WebKit::WebInspectorProxy::platformAttach):
+ (WebKit::WebInspectorProxy::platformDetach):
+ (WebKit::WebInspectorProxy::platformSetAttachedWindowHeight):
+ (WebKit::WebInspectorProxy::platformSetAttachedWindowWidth):
+ (WebKit::WebInspectorProxy::platformAttachAvailabilityChanged):
+
2017-06-11 Tim Horton <[email protected]>
REGRESSION (r217870): Null deref under PageOverlayController::uninstallPageOverlay using find in page
Modified: trunk/Source/WebKit2/PlatformGTK.cmake (218088 => 218089)
--- trunk/Source/WebKit2/PlatformGTK.cmake 2017-06-12 05:19:00 UTC (rev 218088)
+++ trunk/Source/WebKit2/PlatformGTK.cmake 2017-06-12 06:05:05 UTC (rev 218089)
@@ -109,7 +109,6 @@
UIProcess/API/C/cairo/WKIconDatabaseCairo.cpp
- UIProcess/API/C/gtk/WKInspectorClientGtk.cpp
UIProcess/API/C/gtk/WKTextCheckerGtk.cpp
UIProcess/API/C/gtk/WKView.cpp
@@ -336,7 +335,6 @@
UIProcess/gtk/WaylandCompositor.cpp
UIProcess/gtk/WebColorPickerGtk.cpp
UIProcess/gtk/WebContextMenuProxyGtk.cpp
- UIProcess/gtk/WebInspectorClientGtk.cpp
UIProcess/gtk/WebInspectorProxyGtk.cpp
UIProcess/gtk/WebKitInspectorWindow.cpp
UIProcess/gtk/WebPageProxyGtk.cpp
Deleted: trunk/Source/WebKit2/UIProcess/API/C/gtk/WKInspectorClientGtk.cpp (218088 => 218089)
--- trunk/Source/WebKit2/UIProcess/API/C/gtk/WKInspectorClientGtk.cpp 2017-06-12 05:19:00 UTC (rev 218088)
+++ trunk/Source/WebKit2/UIProcess/API/C/gtk/WKInspectorClientGtk.cpp 2017-06-12 06:05:05 UTC (rev 218089)
@@ -1,37 +0,0 @@
-/*
- * 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 "WKInspectorClientGtk.h"
-
-#include "WKAPICast.h"
-#include "WebInspectorProxy.h"
-
-using namespace WebKit;
-
-void WKInspectorSetInspectorClientGtk(WKInspectorRef inspectorRef, const WKInspectorClientGtkBase* wkClient)
-{
- toImpl(inspectorRef)->initializeInspectorClientGtk(wkClient);
-}
Deleted: trunk/Source/WebKit2/UIProcess/API/C/gtk/WKInspectorClientGtk.h (218088 => 218089)
--- trunk/Source/WebKit2/UIProcess/API/C/gtk/WKInspectorClientGtk.h 2017-06-12 05:19:00 UTC (rev 218088)
+++ trunk/Source/WebKit2/UIProcess/API/C/gtk/WKInspectorClientGtk.h 2017-06-12 06:05:05 UTC (rev 218089)
@@ -1,67 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef WKInspectorClientGtk_h
-#define WKInspectorClientGtk_h
-
-#include <WebKit/WKBase.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef bool (*WKInspectorClientGtkInspectorCallback)(WKInspectorRef inspector, const void* clientInfo);
-typedef void (*WKInspectorClientGtkInspectorDidCloseCallback)(WKInspectorRef inspector, const void* clientInfo);
-typedef void (*WKInspectorClientGtkInspectedURLChangedCallback)(WKInspectorRef inspector, WKStringRef url, const void* clientInfo);
-typedef void (*WKInspectorClientGtkDidChangeAttachedHeightCallback)(WKInspectorRef inspector, unsigned height, const void* clientInfo);
-typedef void (*WKInspectorClientGtkDidChangeAttachedWidthCallback)(WKInspectorRef inspector, unsigned width, const void* clientInfo);
-typedef void (*WKInspectorClientGtkDidChangeAttachAvailabilityCallback)(WKInspectorRef inspector, bool available, const void* clientInfo);
-
-typedef struct WKInspectorClientGtkBase {
- int version;
- const void* clientInfo;
-} WKInspectorClientGtkBase;
-
-typedef struct WKInspectorClientGtkV0 {
- WKInspectorClientGtkBase base;
-
- WKInspectorClientGtkInspectorCallback openWindow;
- WKInspectorClientGtkInspectorDidCloseCallback didClose;
- WKInspectorClientGtkInspectorCallback bringToFront;
- WKInspectorClientGtkInspectedURLChangedCallback inspectedURLChanged;
- WKInspectorClientGtkInspectorCallback attach;
- WKInspectorClientGtkInspectorCallback detach;
- WKInspectorClientGtkDidChangeAttachedHeightCallback didChangeAttachedHeight;
- WKInspectorClientGtkDidChangeAttachedWidthCallback didChangeAttachedWidth;
- WKInspectorClientGtkDidChangeAttachAvailabilityCallback didChangeAttachAvailability;
-} WKInspectorClientGtkV0;
-
-WK_EXPORT void WKInspectorSetInspectorClientGtk(WKInspectorRef inspectorRef, const WKInspectorClientGtkBase* client);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* WKInspectorClientGtk_h */
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h (218088 => 218089)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h 2017-06-12 05:19:00 UTC (rev 218088)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h 2017-06-12 06:05:05 UTC (rev 218089)
@@ -35,7 +35,6 @@
#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/WKString.h>
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp (218088 => 218089)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp 2017-06-12 05:19:00 UTC (rev 218088)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp 2017-06-12 06:05:05 UTC (rev 218089)
@@ -21,6 +21,7 @@
#include "WebKitWebInspector.h"
#include "WebInspectorProxy.h"
+#include "WebInspectorProxyClient.h"
#include "WebKitWebInspectorPrivate.h"
#include <glib/gi18n-lib.h>
#include <wtf/glib/GRefPtr.h>
@@ -78,7 +79,7 @@
struct _WebKitWebInspectorPrivate {
~_WebKitWebInspectorPrivate()
{
- WKInspectorSetInspectorClientGtk(toAPI(webInspector.get()), 0);
+ webInspector->setClient(nullptr);
}
RefPtr<WebInspectorProxy> webInspector;
@@ -281,89 +282,84 @@
G_TYPE_BOOLEAN, 0);
}
-static bool openWindow(WKInspectorRef, const void* clientInfo)
-{
- gboolean returnValue;
- g_signal_emit(WEBKIT_WEB_INSPECTOR(clientInfo), signals[OPEN_WINDOW], 0, &returnValue);
- return returnValue;
-}
+class WebKitInspectorClient final : public WebInspectorProxyClient {
+public:
+ explicit WebKitInspectorClient(WebKitWebInspector* inspector)
+ : m_inspector(inspector)
+ {
+ }
-static void didClose(WKInspectorRef, const void* clientInfo)
-{
- g_signal_emit(WEBKIT_WEB_INSPECTOR(clientInfo), signals[CLOSED], 0);
-}
+private:
+ bool openWindow(WebInspectorProxy&) override
+ {
+ gboolean returnValue;
+ g_signal_emit(m_inspector, signals[OPEN_WINDOW], 0, &returnValue);
+ return returnValue;
+ }
-static bool bringToFront(WKInspectorRef, const void* clientInfo)
-{
- gboolean returnValue;
- g_signal_emit(WEBKIT_WEB_INSPECTOR(clientInfo), signals[BRING_TO_FRONT], 0, &returnValue);
- return returnValue;
-}
+ void didClose(WebInspectorProxy&) override
+ {
+ g_signal_emit(m_inspector, signals[CLOSED], 0);
+ }
-static void inspectedURLChanged(WKInspectorRef, WKStringRef url, const void* clientInfo)
-{
- WebKitWebInspector* inspector = WEBKIT_WEB_INSPECTOR(clientInfo);
- CString uri = toImpl(url)->string().utf8();
- if (uri == inspector->priv->inspectedURI)
- return;
- inspector->priv->inspectedURI = uri;
- g_object_notify(G_OBJECT(inspector), "inspected-uri");
-}
+ bool bringToFront(WebInspectorProxy&) override
+ {
+ gboolean returnValue;
+ g_signal_emit(m_inspector, signals[BRING_TO_FRONT], 0, &returnValue);
+ return returnValue;
+ }
-static bool attach(WKInspectorRef, const void* clientInfo)
-{
- gboolean returnValue;
- g_signal_emit(WEBKIT_WEB_INSPECTOR(clientInfo), signals[ATTACH], 0, &returnValue);
- return returnValue;
-}
+ void inspectedURLChanged(WebInspectorProxy&, const String& url) override
+ {
+ CString uri = url.utf8();
+ if (uri == m_inspector->priv->inspectedURI)
+ return;
+ m_inspector->priv->inspectedURI = uri;
+ g_object_notify(G_OBJECT(m_inspector), "inspected-uri");
+ }
-static bool detach(WKInspectorRef, const void* clientInfo)
-{
- gboolean returnValue;
- g_signal_emit(WEBKIT_WEB_INSPECTOR(clientInfo), signals[DETACH], 0, &returnValue);
- return returnValue;
-}
+ bool attach(WebInspectorProxy&) override
+ {
+ gboolean returnValue;
+ g_signal_emit(m_inspector, signals[ATTACH], 0, &returnValue);
+ return returnValue;
+ }
-static void didChangeAttachedHeight(WKInspectorRef, unsigned height, const void* clientInfo)
-{
- WebKitWebInspector* inspector = WEBKIT_WEB_INSPECTOR(clientInfo);
- if (inspector->priv->attachedHeight == height)
- return;
- inspector->priv->attachedHeight = height;
- g_object_notify(G_OBJECT(inspector), "attached-height");
-}
+ bool detach(WebInspectorProxy&) override
+ {
+ gboolean returnValue;
+ g_signal_emit(m_inspector, signals[DETACH], 0, &returnValue);
+ return returnValue;
+ }
-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");
-}
+ void didChangeAttachedHeight(WebInspectorProxy&, unsigned height) override
+ {
+ if (m_inspector->priv->attachedHeight == height)
+ return;
+ m_inspector->priv->attachedHeight = height;
+ g_object_notify(G_OBJECT(m_inspector), "attached-height");
+ }
+ void didChangeAttachedWidth(WebInspectorProxy&, unsigned width) override
+ {
+ }
+
+ void didChangeAttachAvailability(WebInspectorProxy&, bool available) override
+ {
+ if (m_inspector->priv->canAttach == available)
+ return;
+ m_inspector->priv->canAttach = available;
+ g_object_notify(G_OBJECT(m_inspector), "can-attach");
+ }
+
+ WebKitWebInspector* m_inspector;
+};
+
WebKitWebInspector* webkitWebInspectorCreate(WebInspectorProxy* webInspector)
{
WebKitWebInspector* inspector = WEBKIT_WEB_INSPECTOR(g_object_new(WEBKIT_TYPE_WEB_INSPECTOR, NULL));
inspector->priv->webInspector = webInspector;
-
- WKInspectorClientGtkV0 wkInspectorClientGtk = {
- {
- 0, // version
- inspector, // clientInfo
- },
- openWindow,
- didClose,
- bringToFront,
- inspectedURLChanged,
- attach,
- detach,
- didChangeAttachedHeight,
- nullptr, // didChangeAttachedWidth
- didChangeAttachAvailability
- };
- WKInspectorSetInspectorClientGtk(toAPI(webInspector), &wkInspectorClientGtk.base);
-
+ webInspector->setClient(std::make_unique<WebKitInspectorClient>(inspector));
return inspector;
}
Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp (218088 => 218089)
--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp 2017-06-12 05:19:00 UTC (rev 218088)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp 2017-06-12 06:05:05 UTC (rev 218089)
@@ -47,6 +47,10 @@
#include <WebCore/NotImplemented.h>
#include <wtf/NeverDestroyed.h>
+#if PLATFORM(GTK)
+#include "WebInspectorProxyClient.h"
+#endif
+
using namespace WebCore;
namespace WebKit {
Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h (218088 => 218089)
--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h 2017-06-12 05:19:00 UTC (rev 218088)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h 2017-06-12 06:05:05 UTC (rev 218089)
@@ -49,10 +49,6 @@
OBJC_CLASS WKWebViewConfiguration;
#endif
-#if PLATFORM(GTK)
-#include "WebInspectorClientGtk.h"
-#endif
-
namespace WebCore {
class URL;
}
@@ -60,6 +56,7 @@
namespace WebKit {
class WebFrameProxy;
+class WebInspectorProxyClient;
class WebPageProxy;
class WebPreferences;
@@ -115,7 +112,7 @@
#if PLATFORM(GTK)
GtkWidget* inspectorView() const { return m_inspectorView; };
- void initializeInspectorClientGtk(const WKInspectorClientGtkBase*);
+ void setClient(std::unique_ptr<WebInspectorProxyClient>&&);
#endif
void showConsole();
@@ -242,7 +239,7 @@
RunLoop::Timer<WebInspectorProxy> m_closeTimer;
String m_urlString;
#elif PLATFORM(GTK)
- WebInspectorClientGtk m_client;
+ std::unique_ptr<WebInspectorProxyClient> m_client;
GtkWidget* m_inspectorView { nullptr };
GtkWidget* m_inspectorWindow { nullptr };
GtkWidget* m_headerBar { nullptr };
Deleted: trunk/Source/WebKit2/UIProcess/gtk/WebInspectorClientGtk.cpp (218088 => 218089)
--- trunk/Source/WebKit2/UIProcess/gtk/WebInspectorClientGtk.cpp 2017-06-12 05:19:00 UTC (rev 218088)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebInspectorClientGtk.cpp 2017-06-12 06:05:05 UTC (rev 218089)
@@ -1,98 +0,0 @@
-/*
- * 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 "WebInspectorClientGtk.h"
-
-#include "WKAPICast.h"
-#include "WebInspectorProxy.h"
-#include <wtf/text/WTFString.h>
-
-namespace WebKit {
-
-bool WebInspectorClientGtk::openWindow(WebInspectorProxy* inspector)
-{
- if (!m_client.openWindow)
- return false;
- return m_client.openWindow(toAPI(inspector), m_client.base.clientInfo);
-}
-
-void WebInspectorClientGtk::didClose(WebInspectorProxy* inspector)
-{
- if (!m_client.didClose)
- return;
- m_client.didClose(toAPI(inspector), m_client.base.clientInfo);
-}
-
-bool WebInspectorClientGtk::bringToFront(WebInspectorProxy* inspector)
-{
- if (!m_client.bringToFront)
- return false;
- return m_client.bringToFront(toAPI(inspector), m_client.base.clientInfo);
-}
-
-void WebInspectorClientGtk::inspectedURLChanged(WebInspectorProxy* inspector, const String& url)
-{
- if (!m_client.inspectedURLChanged)
- return;
- m_client.inspectedURLChanged(toAPI(inspector), toAPI(url.impl()), m_client.base.clientInfo);
-}
-
-bool WebInspectorClientGtk::attach(WebInspectorProxy* inspector)
-{
- if (!m_client.attach)
- return false;
- return m_client.attach(toAPI(inspector), m_client.base.clientInfo);
-}
-
-bool WebInspectorClientGtk::detach(WebInspectorProxy* inspector)
-{
- if (!m_client.detach)
- return false;
- return m_client.detach(toAPI(inspector), m_client.base.clientInfo);
-}
-
-void WebInspectorClientGtk::didChangeAttachedHeight(WebInspectorProxy* inspector, unsigned height)
-{
- if (!m_client.didChangeAttachedHeight)
- return;
- m_client.didChangeAttachedHeight(toAPI(inspector), height, m_client.base.clientInfo);
-}
-
-void WebInspectorClientGtk::didChangeAttachedWidth(WebInspectorProxy* inspector, unsigned width)
-{
- if (!m_client.didChangeAttachedWidth)
- return;
- m_client.didChangeAttachedWidth(toAPI(inspector), width, m_client.base.clientInfo);
-}
-
-void WebInspectorClientGtk::didChangeAttachAvailability(WebInspectorProxy* inspector, bool available)
-{
- if (!m_client.didChangeAttachAvailability)
- return;
- m_client.didChangeAttachAvailability(toAPI(inspector), available, m_client.base.clientInfo);
-}
-
-} // namespace WebKit
Deleted: trunk/Source/WebKit2/UIProcess/gtk/WebInspectorClientGtk.h (218088 => 218089)
--- trunk/Source/WebKit2/UIProcess/gtk/WebInspectorClientGtk.h 2017-06-12 05:19:00 UTC (rev 218088)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebInspectorClientGtk.h 2017-06-12 06:05:05 UTC (rev 218089)
@@ -1,57 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include "APIClient.h"
-#include "WKInspectorClientGtk.h"
-#include <wtf/text/WTFString.h>
-
-namespace API {
-class Object;
-
-template<> struct ClientTraits<WKInspectorClientGtkBase> {
- typedef std::tuple<WKInspectorClientGtkV0> Versions;
-};
-}
-
-namespace WebKit {
-
-class WebInspectorProxy;
-
-class WebInspectorClientGtk : public API::Client<WKInspectorClientGtkBase> {
-public:
- bool openWindow(WebInspectorProxy*);
- void didClose(WebInspectorProxy*);
- bool bringToFront(WebInspectorProxy*);
- void inspectedURLChanged(WebInspectorProxy*, const String& url);
- bool attach(WebInspectorProxy*);
- bool detach(WebInspectorProxy*);
- void didChangeAttachedHeight(WebInspectorProxy*, unsigned height);
- void didChangeAttachedWidth(WebInspectorProxy*, unsigned width);
- void didChangeAttachAvailability(WebInspectorProxy*, bool available);
-};
-
-} // namespace WebKit
Copied: trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyClient.h (from rev 218086, trunk/Source/WebKit2/UIProcess/gtk/WebInspectorClientGtk.h) (0 => 218089)
--- trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyClient.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyClient.h 2017-06-12 06:05:05 UTC (rev 218089)
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include <wtf/text/WTFString.h>
+
+namespace WebKit {
+
+class WebInspectorProxy;
+
+class WebInspectorProxyClient {
+public:
+ virtual bool openWindow(WebInspectorProxy&) = 0;
+ virtual void didClose(WebInspectorProxy&) = 0;
+ virtual bool bringToFront(WebInspectorProxy&) = 0;
+ virtual void inspectedURLChanged(WebInspectorProxy&, const String& url) = 0;
+ virtual bool attach(WebInspectorProxy&) = 0;
+ virtual bool detach(WebInspectorProxy&) = 0;
+ virtual void didChangeAttachedHeight(WebInspectorProxy&, unsigned height) = 0;
+ virtual void didChangeAttachedWidth(WebInspectorProxy&, unsigned width) = 0;
+ virtual void didChangeAttachAvailability(WebInspectorProxy&, bool available) = 0;
+};
+
+} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp (218088 => 218089)
--- trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp 2017-06-12 05:19:00 UTC (rev 218088)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp 2017-06-12 06:05:05 UTC (rev 218089)
@@ -29,6 +29,7 @@
#include "config.h"
#include "WebInspectorProxy.h"
+#include "WebInspectorProxyClient.h"
#include "WebKitInspectorWindow.h"
#include "WebKitWebViewBasePrivate.h"
#include "WebPageGroup.h"
@@ -56,9 +57,9 @@
return std::max<unsigned long long>(expectedUsage, currentDatabaseUsage * 1.25);
}
-void WebInspectorProxy::initializeInspectorClientGtk(const WKInspectorClientGtkBase* inspectorClient)
+void WebInspectorProxy::setClient(std::unique_ptr<WebInspectorProxyClient>&& client)
{
- m_client.initialize(inspectorClient);
+ m_client = WTFMove(client);
}
WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
@@ -142,7 +143,7 @@
void WebInspectorProxy::createInspectorWindow()
{
- if (m_client.openWindow(this))
+ if (m_client && m_client->openWindow(*this))
return;
GtkWidget* inspectedViewParent = gtk_widget_get_toplevel(inspectedPage()->viewWidget());
@@ -184,7 +185,8 @@
if (m_inspectorView)
g_signal_handlers_disconnect_by_func(m_inspectorView, reinterpret_cast<void*>(inspectorViewDestroyed), this);
- m_client.didClose(this);
+ if (m_client)
+ m_client->didClose(*this);
if (m_inspectorWindow) {
gtk_widget_destroy(m_inspectorWindow);
@@ -208,7 +210,7 @@
void WebInspectorProxy::platformBringToFront()
{
- if (m_client.bringToFront(this))
+ if (m_client && m_client->bringToFront(*this))
return;
GtkWidget* parent = gtk_widget_get_toplevel(m_inspectorView);
@@ -232,7 +234,8 @@
void WebInspectorProxy::platformInspectedURLChanged(const String& url)
{
m_inspectedURLString = url;
- m_client.inspectedURLChanged(this, url);
+ if (m_client)
+ m_client->inspectedURLChanged(*this, url);
if (m_inspectorWindow)
updateInspectorWindowTitle();
@@ -285,7 +288,7 @@
platformSetAttachedWindowWidth(std::max(minimumAttachedWidth, std::min(defaultAttachedSize, maximumAttachedWidth)));
}
- if (m_client.attach(this))
+ if (m_client && m_client->attach(*this))
return;
webkitWebViewBaseAddWebInspector(WEBKIT_WEB_VIEW_BASE(inspectedPage()->viewWidget()), m_inspectorView, m_attachmentSide);
@@ -298,7 +301,7 @@
return;
GRefPtr<GtkWidget> inspectorView = m_inspectorView;
- if (!m_client.detach(this)) {
+ if (m_client && !m_client->detach(*this)) {
// Detach is called when m_isAttached is true, but it could called before
// the inspector is opened if the inspector is shown/closed quickly. So,
// we might not have a parent yet.
@@ -324,7 +327,8 @@
if (!m_isAttached)
return;
- m_client.didChangeAttachedHeight(this, height);
+ if (m_client)
+ m_client->didChangeAttachedHeight(*this, height);
webkitWebViewBaseSetInspectorViewSize(WEBKIT_WEB_VIEW_BASE(inspectedPage()->viewWidget()), height);
}
@@ -333,7 +337,8 @@
if (!m_isAttached)
return;
- m_client.didChangeAttachedWidth(this, width);
+ if (m_client)
+ m_client->didChangeAttachedWidth(*this, width);
webkitWebViewBaseSetInspectorViewSize(WEBKIT_WEB_VIEW_BASE(inspectedPage()->viewWidget()), width);
}
@@ -354,7 +359,8 @@
void WebInspectorProxy::platformAttachAvailabilityChanged(bool available)
{
- m_client.didChangeAttachAvailability(this, available);
+ if (m_client)
+ m_client->didChangeAttachAvailability(*this, available);
}
} // namespace WebKit