Diff
Modified: trunk/Source/WebKit2/ChangeLog (123910 => 123911)
--- trunk/Source/WebKit2/ChangeLog 2012-07-27 19:49:28 UTC (rev 123910)
+++ trunk/Source/WebKit2/ChangeLog 2012-07-27 20:10:19 UTC (rev 123911)
@@ -1,3 +1,24 @@
+2012-07-27 Christophe Dumez <[email protected]>
+
+ [WK2][WTR] LayoutTestController.deliverWebIntent() needs to be implemented
+ https://bugs.webkit.org/show_bug.cgi?id=92228
+
+ Reviewed by Anders Carlsson.
+
+ Add C API to create a WKIntentData and to deliver
+ it to a frame. This is needed by WebKitTestRunner
+ to implement LayoutTestController.deliverWebIntent().
+
+ * UIProcess/API/C/WKIntentData.cpp:
+ (WKIntentDataCreate):
+ * UIProcess/API/C/WKIntentData.h:
+ * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+ (WKBundlePageDeliverIntentToFrame):
+ * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+ * WebProcess/WebPage/WebPage.h:
+ (WebPage): Make deliverIntentToFrame() public so that it can
+ be used by WKBundlePage.
+
2012-07-27 Anders Carlsson <[email protected]>
Show the unavailable plug-in indicator for Java applets as well
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKIntentData.cpp (123910 => 123911)
--- trunk/Source/WebKit2/UIProcess/API/C/WKIntentData.cpp 2012-07-27 19:49:28 UTC (rev 123910)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKIntentData.cpp 2012-07-27 20:10:19 UTC (rev 123911)
@@ -29,6 +29,8 @@
#include "ImmutableArray.h"
#include "ImmutableDictionary.h"
#include "WKAPICast.h"
+#include "WKDictionary.h"
+#include "WKString.h"
#if ENABLE(WEB_INTENTS)
#include "WebIntentData.h"
@@ -45,6 +47,27 @@
#endif
}
+WKIntentDataRef WKIntentDataCreate(WKDictionaryRef initDictionaryRef)
+{
+#if ENABLE(WEB_INTENTS)
+ IntentData intentData;
+ WKStringRef action = "" WKStringCreateWithUTF8CString("action")));
+ ASSERT(action);
+ intentData.action = ""
+ WKStringRef type = static_cast<WKStringRef>(WKDictionaryGetItemForKey(initDictionaryRef, WKStringCreateWithUTF8CString("type")));
+ ASSERT(type);
+ intentData.type = toImpl(type)->string();
+ WKSerializedScriptValueRef data = "" WKStringCreateWithUTF8CString("data")));
+ if (data)
+ intentData.data = ""
+
+ RefPtr<WebIntentData> webIntentData = WebIntentData::create(intentData);
+ return toAPI(webIntentData.release().leakRef());
+#else
+ return 0;
+#endif
+}
+
WKStringRef WKIntentDataCopyAction(WKIntentDataRef intentRef)
{
#if ENABLE(WEB_INTENTS)
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKIntentData.h (123910 => 123911)
--- trunk/Source/WebKit2/UIProcess/API/C/WKIntentData.h 2012-07-27 19:49:28 UTC (rev 123910)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKIntentData.h 2012-07-27 20:10:19 UTC (rev 123911)
@@ -33,6 +33,9 @@
#endif
WK_EXPORT WKTypeID WKIntentDataGetTypeID();
+
+WK_EXPORT WKIntentDataRef WKIntentDataCreate(WKDictionaryRef initDictionary);
+
WK_EXPORT WKStringRef WKIntentDataCopyAction(WKIntentDataRef intentRef);
WK_EXPORT WKStringRef WKIntentDataCopyType(WKIntentDataRef intentRef);
WK_EXPORT WKURLRef WKIntentDataCopyService(WKIntentDataRef intentRef);
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp (123910 => 123911)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp 2012-07-27 19:49:28 UTC (rev 123910)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp 2012-07-27 20:10:19 UTC (rev 123911)
@@ -31,6 +31,7 @@
#include "InjectedBundleNodeHandle.h"
#include "WKAPICast.h"
#include "WKBundleAPICast.h"
+#include "WebFrame.h"
#include "WebFullScreenManager.h"
#include "WebImage.h"
#include "WebPage.h"
@@ -45,6 +46,10 @@
#include <WebCore/KURL.h>
#include <WebCore/Page.h>
+#if ENABLE(WEB_INTENTS)
+#include "WebIntentData.h"
+#endif
+
using namespace WebKit;
WKTypeID WKBundlePageGetTypeID()
@@ -305,6 +310,13 @@
return toImpl(pageRef)->deviceScaleFactor();
}
+void WKBundlePageDeliverIntentToFrame(WKBundlePageRef pageRef, WKBundleFrameRef frameRef, WKIntentDataRef intentRef)
+{
+#if ENABLE(WEB_INTENTS)
+ toImpl(pageRef)->deliverIntentToFrame(toImpl(frameRef)->frameID(), toImpl(intentRef)->store());
+#endif
+}
+
#if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR
WKBundleInspectorRef WKBundlePageGetInspector(WKBundlePageRef pageRef)
{
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h (123910 => 123911)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h 2012-07-27 19:49:28 UTC (rev 123910)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h 2012-07-27 20:10:19 UTC (rev 123911)
@@ -404,6 +404,8 @@
WK_EXPORT double WKBundlePageGetBackingScaleFactor(WKBundlePageRef page);
+WK_EXPORT void WKBundlePageDeliverIntentToFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKIntentDataRef intent);
+
#if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR
WK_EXPORT WKBundleInspectorRef WKBundlePageGetInspector(WKBundlePageRef page);
#endif
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (123910 => 123911)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2012-07-27 19:49:28 UTC (rev 123910)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2012-07-27 20:10:19 UTC (rev 123911)
@@ -477,6 +477,10 @@
bool isSmartInsertDeleteEnabled() const { return m_isSmartInsertDeleteEnabled; }
#endif
+#if ENABLE(WEB_INTENTS)
+ void deliverIntentToFrame(uint64_t frameID, const IntentData&);
+#endif
+
void replaceSelectionWithText(WebCore::Frame*, const String&);
void clearSelection();
@@ -655,10 +659,6 @@
void runJavaScriptInMainFrame(const String&, uint64_t callbackID);
void forceRepaint(uint64_t callbackID);
-#if ENABLE(WEB_INTENTS)
- void deliverIntentToFrame(uint64_t frameID, const IntentData&);
-#endif
-
void preferencesDidChange(const WebPreferencesStore&);
void platformPreferencesDidChange(const WebPreferencesStore&);
void updatePreferences(const WebPreferencesStore&);
Modified: trunk/Tools/ChangeLog (123910 => 123911)
--- trunk/Tools/ChangeLog 2012-07-27 19:49:28 UTC (rev 123910)
+++ trunk/Tools/ChangeLog 2012-07-27 20:10:19 UTC (rev 123911)
@@ -1,3 +1,24 @@
+2012-07-27 Christophe Dumez <[email protected]>
+
+ [WK2][WTR] LayoutTestController.deliverWebIntent() needs to be implemented
+ https://bugs.webkit.org/show_bug.cgi?id=92228
+
+ Reviewed by Anders Carlsson.
+
+ Implement LayoutTestController.deliverWebIntent() to
+ allow test cases to deliver a Web intent and test this
+ functionality.
+
+ This functionality is needed by:
+ - webintents/web-intents-delivery.html
+
+ * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
+ * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
+ (WTR::LayoutTestController::deliverWebIntent):
+ (WTR):
+ * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
+ (LayoutTestController):
+
2012-07-27 Jer Noble <[email protected]>
Unreviewed build fix.
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl (123910 => 123911)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl 2012-07-27 19:49:28 UTC (rev 123910)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl 2012-07-27 20:10:19 UTC (rev 123911)
@@ -131,6 +131,7 @@
// Web intents testing.
void sendWebIntentResponse(in DOMString reply);
+ void deliverWebIntent(in DOMString action, in DOMString type, in DOMString data);
// Focus testing.
void addChromeInputField(in object callback);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp (123910 => 123911)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp 2012-07-27 19:49:28 UTC (rev 123910)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp 2012-07-27 20:10:19 UTC (rev 123911)
@@ -50,6 +50,7 @@
#if ENABLE(WEB_INTENTS)
#include <WebKit2/WKBundleIntentRequest.h>
+#include <WebKit2/WKIntentData.h>
#endif
namespace WTR {
@@ -633,6 +634,26 @@
#endif
}
+void LayoutTestController::deliverWebIntent(JSStringRef action, JSStringRef type, JSStringRef data)
+{
+#if ENABLE(WEB_INTENTS)
+ WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
+ JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
+
+ WKRetainPtr<WKStringRef> actionWK = toWK(action);
+ WKRetainPtr<WKStringRef> typeWK = toWK(type);
+ WKRetainPtr<WKSerializedScriptValueRef> dataWK(AdoptWK, WKSerializedScriptValueCreate(context, JSValueMakeString(context, data), 0));
+
+ WKRetainPtr<WKMutableDictionaryRef> intentInitDict(AdoptWK, WKMutableDictionaryCreate());
+ WKDictionaryAddItem(intentInitDict.get(), WKStringCreateWithUTF8CString("action"), actionWK.get());
+ WKDictionaryAddItem(intentInitDict.get(), WKStringCreateWithUTF8CString("type"), typeWK.get());
+ WKDictionaryAddItem(intentInitDict.get(), WKStringCreateWithUTF8CString("data"), dataWK.get());
+
+ WKRetainPtr<WKIntentDataRef> wkIntentData(AdoptWK, WKIntentDataCreate(intentInitDict.get()));
+ WKBundlePageDeliverIntentToFrame(InjectedBundle::shared().page()->page(), mainFrame, wkIntentData.get());
+#endif
+}
+
void LayoutTestController::setAlwaysAcceptCookies(bool accept)
{
WKBundleSetAlwaysAcceptCookies(InjectedBundle::shared().bundle(), accept);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h (123910 => 123911)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h 2012-07-27 19:49:28 UTC (rev 123910)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h 2012-07-27 20:10:19 UTC (rev 123911)
@@ -207,6 +207,7 @@
// Web intents testing.
void sendWebIntentResponse(JSStringRef reply);
+ void deliverWebIntent(JSStringRef action, JSStringRef type, JSStringRef data);
// Cookies testing
void setAlwaysAcceptCookies(bool);