summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp')
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp62
1 files changed, 57 insertions, 5 deletions
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp
index 083d27c84..522e5b635 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/gobject/GRefPtr.h>
+#include <wtf/glib/GRefPtr.h>
#include <wtf/text/CString.h>
using namespace WebKit;
@@ -72,7 +72,8 @@ enum {
PROP_0,
PROP_INSPECTED_URI,
- PROP_ATTACHED_HEIGHT
+ PROP_ATTACHED_HEIGHT,
+ PROP_CAN_ATTACH
};
struct _WebKitWebInspectorPrivate {
@@ -84,6 +85,7 @@ struct _WebKitWebInspectorPrivate {
RefPtr<WebInspectorProxy> webInspector;
CString inspectedURI;
unsigned attachedHeight;
+ bool canAttach;
};
WEBKIT_DEFINE_TYPE(WebKitWebInspector, webkit_web_inspector, G_TYPE_OBJECT)
@@ -101,6 +103,9 @@ 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);
}
@@ -137,6 +142,24 @@ 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
*
@@ -217,7 +240,7 @@ static void webkit_web_inspector_class_init(WebKitWebInspectorClass* findClass)
* if you want to attach the inspector view yourself (for example, to add
* the inspector view to a browser tab).
*
- * To prevent the inspector vew from being attached you can connect to this
+ * To prevent the inspector view from being attached you can connect to this
* signal and simply return %TRUE.
*
* Returns: %TRUE to stop other handlers from being invoked for the event.
@@ -295,7 +318,7 @@ static bool attach(WKInspectorRef, const void* clientInfo)
return returnValue;
}
-static bool detach(WKInspectorRef inspector, const void* clientInfo)
+static bool detach(WKInspectorRef, const void* clientInfo)
{
gboolean returnValue;
g_signal_emit(WEBKIT_WEB_INSPECTOR(clientInfo), signals[DETACH], 0, &returnValue);
@@ -311,6 +334,15 @@ 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));
@@ -328,7 +360,8 @@ WebKitWebInspector* webkitWebInspectorCreate(WebInspectorProxy* webInspector)
attach,
detach,
didChangeAttachedHeight,
- nullptr // didChangeAttachedWidth
+ nullptr, // didChangeAttachedWidth
+ didChangeAttachAvailability
};
WKInspectorSetInspectorClientGtk(toAPI(webInspector), &wkInspectorClientGtk.base);
@@ -371,6 +404,25 @@ 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
*