Title: [120278] trunk
Revision
120278
Author
[email protected]
Date
2012-06-13 21:37:22 -0700 (Wed, 13 Jun 2012)

Log Message

[WK2] Add implementation for dispatchIntent in WebFrameLoaderClient
https://bugs.webkit.org/show_bug.cgi?id=88340

Patch by Christophe Dumez <[email protected]> on 2012-06-13
Reviewed by Kenneth Rohde Christiansen.

Source/WebKit2:

Add implementation for dispatchIntent() in WebFrameLoaderClient.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Shared/API/c/WKBase.h:
* Shared/APIClientTraits.h:
* Shared/APIObject.h:
* Shared/IntentData.cpp: Added.
(WebKit):
(WebKit::IntentData::encode):
(WebKit::IntentData::decode):
* Shared/IntentData.h: Added.
(CoreIPC):
(WebKit):
(IntentData):
* Target.pri:
* UIProcess/API/C/WKAPICast.h:
(WebKit):
* UIProcess/API/C/WKPage.h:
* UIProcess/API/gtk/WebKitLoaderClient.cpp:
(attachLoaderClientToView):
* UIProcess/WebIntentData.cpp: Added.
(WebKit):
(WebKit::WebIntentData::WebIntentData):
(WebKit::WebIntentData::data):
* UIProcess/WebIntentData.h: Added.
(WebKit):
(WebIntentData):
(WebKit::WebIntentData::create):
(WebKit::WebIntentData::~WebIntentData):
(WebKit::WebIntentData::action):
(WebKit::WebIntentData::payloadType):
(WebKit::WebIntentData::extras):
(WebKit::WebIntentData::suggestions):
(WebKit::WebIntentData::type):
* UIProcess/WebLoaderClient.cpp:
(WebKit):
(WebKit::WebLoaderClient::didReceiveIntentForFrame):
* UIProcess/WebLoaderClient.h:
(WebKit):
(WebLoaderClient):
* UIProcess/WebPageProxy.cpp:
(WebKit):
(WebKit::WebPageProxy::didReceiveIntentForFrame):
* UIProcess/WebPageProxy.h:
(WebKit):
(WebPageProxy):
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchIntent):

Tools:

Update initialization of WKPageLoaderClient.

* MiniBrowser/mac/BrowserWindowController.m:
(-[BrowserWindowController awakeFromNib]):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/CMakeLists.txt (120277 => 120278)


--- trunk/Source/WebKit2/CMakeLists.txt	2012-06-14 04:19:51 UTC (rev 120277)
+++ trunk/Source/WebKit2/CMakeLists.txt	2012-06-14 04:37:22 UTC (rev 120278)
@@ -122,6 +122,7 @@
     Shared/FontInfo.cpp
     Shared/ImmutableArray.cpp
     Shared/ImmutableDictionary.cpp
+    Shared/IntentData.cpp
     Shared/MutableArray.cpp
     Shared/MutableDictionary.cpp
     Shared/OriginAndDatabases.cpp
@@ -236,6 +237,7 @@
     UIProcess/WebIconDatabase.cpp
     UIProcess/WebIconDatabaseClient.cpp
     UIProcess/WebInspectorProxy.cpp
+    UIProcess/WebIntentData.cpp
     UIProcess/WebKeyValueStorageManagerProxy.cpp
     UIProcess/WebLayerTreeRenderer.cpp
     UIProcess/WebLoaderClient.cpp

Modified: trunk/Source/WebKit2/ChangeLog (120277 => 120278)


--- trunk/Source/WebKit2/ChangeLog	2012-06-14 04:19:51 UTC (rev 120277)
+++ trunk/Source/WebKit2/ChangeLog	2012-06-14 04:37:22 UTC (rev 120278)
@@ -1,3 +1,61 @@
+2012-06-13  Christophe Dumez  <[email protected]>
+
+        [WK2] Add implementation for dispatchIntent in WebFrameLoaderClient
+        https://bugs.webkit.org/show_bug.cgi?id=88340
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Add implementation for dispatchIntent() in WebFrameLoaderClient.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * Shared/API/c/WKBase.h:
+        * Shared/APIClientTraits.h:
+        * Shared/APIObject.h:
+        * Shared/IntentData.cpp: Added.
+        (WebKit):
+        (WebKit::IntentData::encode):
+        (WebKit::IntentData::decode):
+        * Shared/IntentData.h: Added.
+        (CoreIPC):
+        (WebKit):
+        (IntentData):
+        * Target.pri:
+        * UIProcess/API/C/WKAPICast.h:
+        (WebKit):
+        * UIProcess/API/C/WKPage.h:
+        * UIProcess/API/gtk/WebKitLoaderClient.cpp:
+        (attachLoaderClientToView):
+        * UIProcess/WebIntentData.cpp: Added.
+        (WebKit):
+        (WebKit::WebIntentData::WebIntentData):
+        (WebKit::WebIntentData::data):
+        * UIProcess/WebIntentData.h: Added.
+        (WebKit):
+        (WebIntentData):
+        (WebKit::WebIntentData::create):
+        (WebKit::WebIntentData::~WebIntentData):
+        (WebKit::WebIntentData::action):
+        (WebKit::WebIntentData::payloadType):
+        (WebKit::WebIntentData::extras):
+        (WebKit::WebIntentData::suggestions):
+        (WebKit::WebIntentData::type):
+        * UIProcess/WebLoaderClient.cpp:
+        (WebKit):
+        (WebKit::WebLoaderClient::didReceiveIntentForFrame):
+        * UIProcess/WebLoaderClient.h:
+        (WebKit):
+        (WebLoaderClient):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit):
+        (WebKit::WebPageProxy::didReceiveIntentForFrame):
+        * UIProcess/WebPageProxy.h:
+        (WebKit):
+        (WebPageProxy):
+        * UIProcess/WebPageProxy.messages.in:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchIntent):
+
 2012-06-13  Tim Horton  <[email protected]>
 
         Rename _swapView:with: to _replaceView:with:

Modified: trunk/Source/WebKit2/GNUmakefile.list.am (120277 => 120278)


--- trunk/Source/WebKit2/GNUmakefile.list.am	2012-06-14 04:19:51 UTC (rev 120277)
+++ trunk/Source/WebKit2/GNUmakefile.list.am	2012-06-14 04:37:22 UTC (rev 120278)
@@ -362,6 +362,8 @@
 	Source/WebKit2/Shared/ImmutableArray.h \
 	Source/WebKit2/Shared/ImmutableDictionary.cpp \
 	Source/WebKit2/Shared/ImmutableDictionary.h \
+	Source/WebKit2/Shared/IntentData.cpp \
+	Source/WebKit2/Shared/IntentData.h \
 	Source/WebKit2/Shared/LayerTreeContext.h \
 	Source/WebKit2/Shared/MutableArray.cpp \
 	Source/WebKit2/Shared/MutableArray.h \
@@ -801,6 +803,8 @@
 	Source/WebKit2/UIProcess/WebIconDatabaseClient.h \
 	Source/WebKit2/UIProcess/WebInspectorProxy.cpp \
 	Source/WebKit2/UIProcess/WebInspectorProxy.h \
+	Source/WebKit2/UIProcess/WebIntentData.cpp \
+	Source/WebKit2/UIProcess/WebIntentData.h \
 	Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp \
 	Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.h \
 	Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.cpp \

Modified: trunk/Source/WebKit2/Shared/API/c/WKBase.h (120277 => 120278)


--- trunk/Source/WebKit2/Shared/API/c/WKBase.h	2012-06-14 04:19:51 UTC (rev 120277)
+++ trunk/Source/WebKit2/Shared/API/c/WKBase.h	2012-06-14 04:37:22 UTC (rev 120278)
@@ -98,6 +98,7 @@
 typedef const struct OpaqueWKHitTestResult* WKHitTestResultRef;
 typedef const struct OpaqueWKIconDatabase* WKIconDatabaseRef;
 typedef const struct OpaqueWKInspector* WKInspectorRef;
+typedef const struct OpaqueWKIntentData* WKIntentDataRef;
 typedef const struct OpaqueWKKeyValueStorageManager* WKKeyValueStorageManagerRef;
 typedef const struct OpaqueWKMediaCacheManager* WKMediaCacheManagerRef;
 typedef const struct OpaqueWKNavigationData* WKNavigationDataRef;

Modified: trunk/Source/WebKit2/Shared/APIClientTraits.h (120277 => 120278)


--- trunk/Source/WebKit2/Shared/APIClientTraits.h	2012-06-14 04:19:51 UTC (rev 120277)
+++ trunk/Source/WebKit2/Shared/APIClientTraits.h	2012-06-14 04:37:22 UTC (rev 120278)
@@ -53,7 +53,7 @@
 };
 
 template<> struct APIClientTraits<WKPageLoaderClient> {
-    static const size_t interfaceSizesByVersion[2];
+    static const size_t interfaceSizesByVersion[3];
 };
 
 template<> struct APIClientTraits<WKPageUIClient> {

Modified: trunk/Source/WebKit2/Shared/APIObject.h (120277 => 120278)


--- trunk/Source/WebKit2/Shared/APIObject.h	2012-06-14 04:19:51 UTC (rev 120277)
+++ trunk/Source/WebKit2/Shared/APIObject.h	2012-06-14 04:37:22 UTC (rev 120278)
@@ -88,6 +88,7 @@
         TypeGrammarDetail,
         TypeIconDatabase,
         TypeInspector,
+        TypeIntentData,
         TypeKeyValueStorageManager,
         TypeMediaCacheManager,
         TypeNavigationData,

Copied: trunk/Source/WebKit2/Shared/IntentData.cpp (from rev 120277, trunk/Source/WebKit2/Shared/APIClientTraits.h) (0 => 120278)


--- trunk/Source/WebKit2/Shared/IntentData.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/IntentData.cpp	2012-06-14 04:37:22 UTC (rev 120278)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * 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 "IntentData.h"
+
+#if ENABLE(WEB_INTENTS)
+
+#include "APIObject.h"
+#include "DataReference.h"
+#include "WebCoreArgumentCoders.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void IntentData::encode(CoreIPC::ArgumentEncoder* encoder) const
+{
+    encoder->encode(action);
+    encoder->encode(type);
+    encoder->encode(CoreIPC::DataReference(data));
+    encoder->encode(extras);
+    encoder->encode(suggestions);
+}
+
+bool IntentData::decode(CoreIPC::ArgumentDecoder* decoder, IntentData& intentData)
+{
+    if (!decoder->decode(intentData.action))
+        return false;
+    if (!decoder->decode(intentData.type))
+        return false;
+    CoreIPC::DataReference data;
+    if (!decoder->decode(data))
+        return false;
+    intentData.data.append(data.data(), data.size());
+    if (!decoder->decode(intentData.extras))
+        return false;
+    if (!decoder->decode(intentData.suggestions))
+        return false;
+
+    return true;
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(WEB_INTENTS)
+

Copied: trunk/Source/WebKit2/Shared/IntentData.h (from rev 120277, trunk/Source/WebKit2/Shared/APIClientTraits.h) (0 => 120278)


--- trunk/Source/WebKit2/Shared/IntentData.h	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/IntentData.h	2012-06-14 04:37:22 UTC (rev 120278)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * 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 IntentData_h
+#define IntentData_h
+
+#if ENABLE(WEB_INTENTS)
+
+#include "APIObject.h"
+#include "GenericCallback.h"
+#include <wtf/text/WTFString.h>
+
+namespace CoreIPC {
+class ArgumentDecoder;
+class ArgumentEncoder;
+}
+
+namespace WebKit {
+
+struct IntentData {
+    void encode(CoreIPC::ArgumentEncoder*) const;
+    static bool decode(CoreIPC::ArgumentDecoder*, IntentData&);
+
+    String action;
+    String type;
+    Vector<uint8_t> data;
+    HashMap<String, String> extras;
+    Vector<WebCore::KURL> suggestions;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(WEB_INTENTS)
+
+#endif // IntentData_h

Modified: trunk/Source/WebKit2/Target.pri (120277 => 120278)


--- trunk/Source/WebKit2/Target.pri	2012-06-14 04:19:51 UTC (rev 120277)
+++ trunk/Source/WebKit2/Target.pri	2012-06-14 04:37:22 UTC (rev 120278)
@@ -76,6 +76,7 @@
     Shared/ImageOptions.h \
     Shared/ImmutableArray.h \
     Shared/ImmutableDictionary.h \
+    Shared/IntentData.h \
     Shared/LayerTreeContext.h \
     Shared/MutableArray.h \
     Shared/MutableDictionary.h \
@@ -252,6 +253,7 @@
     UIProcess/WebIconDatabase.h \
     UIProcess/WebIconDatabaseClient.h \
     UIProcess/WebInspectorProxy.h \
+    UIProcess/WebIntentData.h \
     UIProcess/WebKeyValueStorageManagerProxy.h \
     UIProcess/WebLayerTreeRenderer.h \
     UIProcess/WebLoaderClient.h \
@@ -440,6 +442,7 @@
     Shared/FontInfo.cpp \
     Shared/ImmutableArray.cpp \
     Shared/ImmutableDictionary.cpp \
+    Shared/IntentData.cpp \
     Shared/MutableArray.cpp \
     Shared/MutableDictionary.cpp \
     Shared/OriginAndDatabases.cpp \
@@ -596,6 +599,7 @@
     UIProcess/WebIconDatabase.cpp \
     UIProcess/WebIconDatabaseClient.cpp \
     UIProcess/WebInspectorProxy.cpp \
+    UIProcess/WebIntentData.cpp \
     UIProcess/WebKeyValueStorageManagerProxy.cpp \
     UIProcess/WebLayerTreeRenderer.cpp \
     UIProcess/WebLoaderClient.cpp \

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h (120277 => 120278)


--- trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h	2012-06-14 04:19:51 UTC (rev 120277)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h	2012-06-14 04:37:22 UTC (rev 120278)
@@ -70,6 +70,7 @@
 class WebHitTestResult;
 class WebIconDatabase;
 class WebInspectorProxy;
+class WebIntentData;
 class WebKeyValueStorageManagerProxy;
 class WebMediaCacheManagerProxy;
 class WebNavigationData;
@@ -107,6 +108,7 @@
 WK_ADD_API_MAPPING(WKGrammarDetailRef, WebGrammarDetail)
 WK_ADD_API_MAPPING(WKHitTestResultRef, WebHitTestResult)
 WK_ADD_API_MAPPING(WKIconDatabaseRef, WebIconDatabase)
+WK_ADD_API_MAPPING(WKIntentDataRef, WebIntentData)
 WK_ADD_API_MAPPING(WKKeyValueStorageManagerRef, WebKeyValueStorageManagerProxy)
 WK_ADD_API_MAPPING(WKMediaCacheManagerRef, WebMediaCacheManagerProxy)
 WK_ADD_API_MAPPING(WKNavigationDataRef, WebNavigationData)

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.h (120277 => 120278)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.h	2012-06-14 04:19:51 UTC (rev 120277)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.h	2012-06-14 04:37:22 UTC (rev 120278)
@@ -73,6 +73,7 @@
 typedef void (*WKPageDidNewFirstVisuallyNonEmptyLayoutCallback)(WKPageRef page, WKTypeRef userData, const void *clientInfo);
 typedef void (*WKPageWillGoToBackForwardListItemCallback)(WKPageRef page, WKBackForwardListItemRef item, WKTypeRef userData, const void *clientInfo);
 typedef void (*WKPagePluginDidFailCallback)(WKPageRef page, WKErrorCode errorCode, WKStringRef mimeType, WKStringRef pluginIdentifier, WKStringRef pluginVersion, const void* clientInfo);
+typedef void (*WKPageDidReceiveIntentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKIntentDataRef intent, const void *clientInfo);
 
 // Deprecated
 typedef void (*WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef mimeType, const void* clientInfo);
@@ -120,10 +121,13 @@
 
     WKPageCallback                                                      interactionOccurredWhileProcessUnresponsive;
     WKPagePluginDidFailCallback                                         pluginDidFail;
+
+    // Version 2
+    WKPageDidReceiveIntentForFrameCallback                              didReceiveIntentForFrame;
 };
 typedef struct WKPageLoaderClient WKPageLoaderClient;
 
-enum { kWKPageLoaderClientCurrentVersion = 1 };
+enum { kWKPageLoaderClientCurrentVersion = 2 };
 
 // Policy Client.
 typedef void (*WKPageDecidePolicyForNavigationActionCallback)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp (120277 => 120278)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp	2012-06-14 04:19:51 UTC (rev 120277)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp	2012-06-14 04:37:22 UTC (rev 120278)
@@ -149,6 +149,7 @@
         0, // willGoToBackForwardListItem
         0, // interactionOccurredWhileProcessUnresponsive
         0, // pluginDidFail
+        0, // didReceiveIntentForFrame
     };
     WKPageRef wkPage = toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView)));
     WKPageSetPageLoaderClient(wkPage, &wkLoaderClient);

Copied: trunk/Source/WebKit2/UIProcess/WebIntentData.cpp (from rev 120277, trunk/Source/WebKit2/Shared/APIClientTraits.h) (0 => 120278)


--- trunk/Source/WebKit2/UIProcess/WebIntentData.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/WebIntentData.cpp	2012-06-14 04:37:22 UTC (rev 120278)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * 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 "WebIntentData.h"
+
+#if ENABLE(WEB_INTENTS)
+
+namespace WebKit {
+
+WebIntentData::WebIntentData(const IntentData& store)
+    : m_store(store)
+{
+}
+
+PassRefPtr<WebSerializedScriptValue> WebIntentData::data() const
+{
+    Vector<uint8_t> dataCopy = m_store.data;
+    return WebSerializedScriptValue::adopt(dataCopy);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(WEB_INTENTS)
+

Copied: trunk/Source/WebKit2/UIProcess/WebIntentData.h (from rev 120277, trunk/Source/WebKit2/Shared/APIClientTraits.h) (0 => 120278)


--- trunk/Source/WebKit2/UIProcess/WebIntentData.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/WebIntentData.h	2012-06-14 04:37:22 UTC (rev 120278)
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * 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 WebIntentData_h
+#define WebIntentData_h
+
+#if ENABLE(WEB_INTENTS)
+
+#include "APIObject.h"
+#include "IntentData.h"
+#include "WebSerializedScriptValue.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebKit {
+
+class WebIntentData : public APIObject {
+public:
+    static const Type APIType = TypeIntentData;
+
+    static PassRefPtr<WebIntentData> create(const IntentData& store)
+    {
+        return adoptRef(new WebIntentData(store));
+    }
+
+    virtual ~WebIntentData() { }
+
+    const String& action() const { return m_store.action; }
+    const String& payloadType() const { return m_store.type; }
+    PassRefPtr<WebSerializedScriptValue> data() const;
+    const HashMap<String, String>& extras() const { return m_store.extras; }
+    const Vector<WebCore::KURL>& suggestions() const { return m_store.suggestions; }
+
+private:
+    WebIntentData(const IntentData&);
+
+    virtual Type type() const { return APIType; }
+
+    IntentData m_store;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(WEB_INTENTS)
+
+#endif // WebIntentData_h

Modified: trunk/Source/WebKit2/UIProcess/WebLoaderClient.cpp (120277 => 120278)


--- trunk/Source/WebKit2/UIProcess/WebLoaderClient.cpp	2012-06-14 04:19:51 UTC (rev 120277)
+++ trunk/Source/WebKit2/UIProcess/WebLoaderClient.cpp	2012-06-14 04:37:22 UTC (rev 120278)
@@ -27,10 +27,14 @@
 #include "WebLoaderClient.h"
 
 #include "ImmutableArray.h"
+#include "WKAPICast.h"
 #include "WebBackForwardListItem.h"
-#include "WKAPICast.h"
 #include <string.h>
 
+#if ENABLE(WEB_INTENTS)
+#include "WebIntentData.h"
+#endif
+
 using namespace WebCore;
 
 namespace WebKit {
@@ -163,6 +167,16 @@
     m_client.didDetectXSSForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
 }
 
+#if ENABLE(WEB_INTENTS)
+void WebLoaderClient::didReceiveIntentForFrame(WebPageProxy* page, WebFrameProxy* frame, WebIntentData* intentData)
+{
+    if (!m_client.didReceiveIntentForFrame)
+        return;
+
+    m_client.didReceiveIntentForFrame(toAPI(page), toAPI(frame), toAPI(intentData), m_client.clientInfo);
+}
+#endif
+
 bool WebLoaderClient::canAuthenticateAgainstProtectionSpaceInFrame(WebPageProxy* page, WebFrameProxy* frame, WebProtectionSpace* protectionSpace)
 {
     if (!m_client.canAuthenticateAgainstProtectionSpaceInFrame)

Modified: trunk/Source/WebKit2/UIProcess/WebLoaderClient.h (120277 => 120278)


--- trunk/Source/WebKit2/UIProcess/WebLoaderClient.h	2012-06-14 04:19:51 UTC (rev 120277)
+++ trunk/Source/WebKit2/UIProcess/WebLoaderClient.h	2012-06-14 04:37:22 UTC (rev 120278)
@@ -47,6 +47,10 @@
 class WebPageProxy;
 class WebProtectionSpace;
 
+#if ENABLE(WEB_INTENTS)
+class WebIntentData;
+#endif
+
 class WebLoaderClient : public APIClient<WKPageLoaderClient, kWKPageLoaderClientCurrentVersion> {
 public:
     void didStartProvisionalLoadForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
@@ -64,6 +68,9 @@
     void didDisplayInsecureContentForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
     void didRunInsecureContentForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
     void didDetectXSSForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
+#if ENABLE(WEB_INTENTS)
+    void didReceiveIntentForFrame(WebPageProxy*, WebFrameProxy*, WebIntentData*);
+#endif
 
     // FIXME: didFirstVisuallyNonEmptyLayoutForFrame and didNewFirstVisuallyNonEmptyLayout should be merged.
     // The only reason for both to exist is to experiment with different heuristics for the time being.

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (120277 => 120278)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-06-14 04:19:51 UTC (rev 120277)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-06-14 04:37:22 UTC (rev 120278)
@@ -85,6 +85,11 @@
 #include <WebCore/WindowFeatures.h>
 #include <stdio.h>
 
+#if ENABLE(WEB_INTENTS)
+#include "IntentData.h"
+#include "WebIntentData.h"
+#endif
+
 #if USE(UI_SIDE_COMPOSITING)
 #include "LayerTreeHostProxyMessages.h"
 #endif
@@ -2136,6 +2141,17 @@
     m_loaderClient.didDetectXSSForFrame(this, frame, userData.get());
 }
 
+#if ENABLE(WEB_INTENTS)
+void WebPageProxy::didReceiveIntentForFrame(uint64_t frameID, const IntentData& intentData)
+{
+    WebFrameProxy* frame = process()->webFrame(frameID);
+    MESSAGE_CHECK(frame);
+
+    RefPtr<WebIntentData> webIntentData = WebIntentData::create(intentData);
+    m_loaderClient.didReceiveIntentForFrame(this, frame, webIntentData.get());
+}
+#endif
+
 void WebPageProxy::frameDidBecomeFrameSet(uint64_t frameID, bool value)
 {
     WebFrameProxy* frame = process()->webFrame(frameID);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (120277 => 120278)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2012-06-14 04:19:51 UTC (rev 120277)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2012-06-14 04:37:22 UTC (rev 120278)
@@ -156,6 +156,10 @@
 class WebGestureEvent;
 #endif
 
+#if ENABLE(WEB_INTENTS)
+struct IntentData;
+#endif
+
 typedef GenericCallback<WKStringRef, StringImpl*> StringCallback;
 typedef GenericCallback<WKSerializedScriptValueRef, WebSerializedScriptValue*> ScriptValueCallback;
 
@@ -713,6 +717,10 @@
     void didStartProgress();
     void didChangeProgress(double);
     void didFinishProgress();
+
+#if ENABLE(WEB_INTENTS)
+    void didReceiveIntentForFrame(uint64_t frameID, const IntentData&);
+#endif
     
     void decidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const WebCore::ResourceRequest&, uint64_t listenerID, CoreIPC::ArgumentDecoder*, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID);
     void decidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const WebCore::ResourceRequest&, const String& frameName, uint64_t listenerID, CoreIPC::ArgumentDecoder*);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (120277 => 120278)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2012-06-14 04:19:51 UTC (rev 120277)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2012-06-14 04:37:22 UTC (rev 120278)
@@ -89,6 +89,11 @@
     DecidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WebCore::ResourceRequest request, WTF::String frameName, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData)
     UnableToImplementPolicy(uint64_t frameID, WebCore::ResourceError error, WebKit::InjectedBundleUserMessageEncoder userData)
 
+    # Intent messages
+#if ENABLE(WEB_INTENTS)
+    DidReceiveIntentForFrame(uint64_t frameID, WebKit::IntentData intent)
+#endif
+
     # Progress messages
     DidChangeProgress(double value)
     DidFinishProgress()

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (120277 => 120278)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2012-06-14 04:19:51 UTC (rev 120277)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2012-06-14 04:37:22 UTC (rev 120278)
@@ -74,6 +74,7 @@
 #include <WebCore/WindowFeatures.h>
 
 #if ENABLE(WEB_INTENTS)
+#include "IntentData.h"
 #include <WebCore/IntentRequest.h>
 #endif
 
@@ -1540,9 +1541,22 @@
 #endif // PLATFORM(WIN) && USE(CFNETWORK)
 
 #if ENABLE(WEB_INTENTS)
-void WebFrameLoaderClient::dispatchIntent(PassRefPtr<IntentRequest>)
+void WebFrameLoaderClient::dispatchIntent(PassRefPtr<IntentRequest> request)
 {
-    notImplemented();
+    WebPage* webPage = m_frame->page();
+    if (!webPage)
+        return;
+
+    IntentData intentData;
+    Intent* coreIntent = request->intent();
+    ASSERT(coreIntent);
+    intentData.action = ""
+    intentData.type = coreIntent->type();
+    intentData.data = ""
+    intentData.extras = coreIntent->extras();
+    intentData.suggestions = coreIntent->suggestions();
+
+    webPage->send(Messages::WebPageProxy::DidReceiveIntentForFrame(m_frame->frameID(), intentData));
 }
 #endif
 

Modified: trunk/Tools/ChangeLog (120277 => 120278)


--- trunk/Tools/ChangeLog	2012-06-14 04:19:51 UTC (rev 120277)
+++ trunk/Tools/ChangeLog	2012-06-14 04:37:22 UTC (rev 120278)
@@ -1,3 +1,17 @@
+2012-06-13  Christophe Dumez  <[email protected]>
+
+        [WK2] Add implementation for dispatchIntent in WebFrameLoaderClient
+        https://bugs.webkit.org/show_bug.cgi?id=88340
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Update initialization of WKPageLoaderClient.
+
+        * MiniBrowser/mac/BrowserWindowController.m:
+        (-[BrowserWindowController awakeFromNib]):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::initialize):
+
 2012-06-13  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r120268.

Modified: trunk/Tools/MiniBrowser/mac/BrowserWindowController.m (120277 => 120278)


--- trunk/Tools/MiniBrowser/mac/BrowserWindowController.m	2012-06-14 04:19:51 UTC (rev 120277)
+++ trunk/Tools/MiniBrowser/mac/BrowserWindowController.m	2012-06-14 04:37:22 UTC (rev 120278)
@@ -612,6 +612,7 @@
         0, // willGoToBackForwardListItem
         0, // interactionOccurredWhileProcessUnresponsive
         0, // pluginDidFail
+        0, // didReceiveIntentForFrame
     };
     WKPageSetPageLoaderClient(_webView.pageRef, &loadClient);
     

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (120277 => 120278)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2012-06-14 04:19:51 UTC (rev 120277)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2012-06-14 04:37:22 UTC (rev 120278)
@@ -409,6 +409,7 @@
         0, // willGoToBackForwardListItem
         0, // interactionOccurredWhileProcessUnresponsive
         0, // pluginDidFail
+        0, // didReceiveIntentForFrame
     };
     WKPageSetPageLoaderClient(m_mainWebView->page(), &pageLoaderClient);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to