Diff
Modified: trunk/Source/WebKit2/ChangeLog (120830 => 120831)
--- trunk/Source/WebKit2/ChangeLog 2012-06-20 17:14:23 UTC (rev 120830)
+++ trunk/Source/WebKit2/ChangeLog 2012-06-20 17:22:10 UTC (rev 120831)
@@ -1,3 +1,36 @@
+2012-06-20 Christophe Dumez <[email protected]>
+
+ [WK2] Implement Web Intent delivery
+ https://bugs.webkit.org/show_bug.cgi?id=88989
+
+ Reviewed by Anders Carlsson.
+
+ Add a deliverIntent() method to the WebFrame so that
+ Web intents can be delivered once matched to a
+ specific service.
+
+ * UIProcess/WebFrameProxy.cpp:
+ (WebKit):
+ (WebKit::WebFrameProxy::deliverIntent):
+ * UIProcess/WebFrameProxy.h:
+ (WebKit):
+ (WebFrameProxy):
+ * UIProcess/WebIntentData.h:
+ (WebKit::WebIntentData::store):
+ * WebProcess/WebPage/WebFrame.cpp:
+ (WebKit):
+ (WebKit::WebFrame::deliverIntent):
+ * WebProcess/WebPage/WebFrame.h:
+ (WebKit):
+ (WebFrame):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit):
+ (WebKit::WebPage::deliverIntentToFrame):
+ * WebProcess/WebPage/WebPage.h:
+ (WebKit):
+ (WebPage):
+ * WebProcess/WebPage/WebPage.messages.in:
+
2012-06-20 Alexis Menard <[email protected]>
REGRESSION (120705) : LayerTreeHostQt asserts in debug.
Modified: trunk/Source/WebKit2/UIProcess/WebFrameProxy.cpp (120830 => 120831)
--- trunk/Source/WebKit2/UIProcess/WebFrameProxy.cpp 2012-06-20 17:14:23 UTC (rev 120830)
+++ trunk/Source/WebKit2/UIProcess/WebFrameProxy.cpp 2012-06-20 17:22:10 UTC (rev 120831)
@@ -37,6 +37,10 @@
#include <stdio.h>
#include <wtf/text/WTFString.h>
+#if ENABLE(WEB_INTENTS)
+#include "WebIntentData.h"
+#endif
+
using namespace WebCore;
using namespace std;
@@ -94,6 +98,19 @@
m_page->process()->send(Messages::WebPage::StopLoadingFrame(m_frameID), m_page->pageID());
}
+
+#if ENABLE(WEB_INTENTS)
+void WebFrameProxy::deliverIntent(WebIntentData* webIntentData)
+{
+ if (!m_page)
+ return;
+
+ if (!m_page->isValid())
+ return;
+
+ m_page->process()->send(Messages::WebPage::DeliverIntentToFrame(m_frameID, webIntentData->store()), m_page->pageID());
+}
+#endif
bool WebFrameProxy::canProvideSource() const
{
Modified: trunk/Source/WebKit2/UIProcess/WebFrameProxy.h (120830 => 120831)
--- trunk/Source/WebKit2/UIProcess/WebFrameProxy.h 2012-06-20 17:14:23 UTC (rev 120830)
+++ trunk/Source/WebKit2/UIProcess/WebFrameProxy.h 2012-06-20 17:22:10 UTC (rev 120831)
@@ -50,6 +50,10 @@
class WebFramePolicyListenerProxy;
class WebPageProxy;
+#if ENABLE(WEB_INTENTS)
+class WebIntentData;
+#endif
+
typedef GenericCallback<WKDataRef> DataCallback;
class WebFrameProxy : public APIObject {
@@ -86,6 +90,10 @@
bool isFrameSet() const { return m_isFrameSet; }
LoadState loadState() const { return m_loadState; }
+
+#if ENABLE(WEB_INTENTS)
+ void deliverIntent(WebIntentData*);
+#endif
void stopLoading() const;
Modified: trunk/Source/WebKit2/UIProcess/WebIntentData.h (120830 => 120831)
--- trunk/Source/WebKit2/UIProcess/WebIntentData.h 2012-06-20 17:14:23 UTC (rev 120830)
+++ trunk/Source/WebKit2/UIProcess/WebIntentData.h 2012-06-20 17:22:10 UTC (rev 120831)
@@ -52,6 +52,7 @@
PassRefPtr<WebSerializedScriptValue> data() const;
const HashMap<String, String>& extras() const { return m_store.extras; }
const Vector<WebCore::KURL>& suggestions() const { return m_store.suggestions; }
+ const IntentData& store() const { return m_store; }
private:
WebIntentData(const IntentData&);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp (120830 => 120831)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp 2012-06-20 17:14:23 UTC (rev 120830)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp 2012-06-20 17:22:10 UTC (rev 120831)
@@ -59,6 +59,12 @@
#include <WebCore/TextResourceDecoder.h>
#include <wtf/text/StringBuilder.h>
+#if ENABLE(WEB_INTENTS)
+#include "IntentData.h"
+#include <WebCore/DOMWindowIntents.h>
+#include <WebCore/DeliveredIntent.h>
+#endif
+
#if PLATFORM(MAC) || PLATFORM(WIN)
#include <WebCore/LegacyWebArchive.h>
#endif
@@ -236,6 +242,19 @@
m_policyDownloadID = 0;
}
+#if ENABLE(WEB_INTENTS)
+void WebFrame::deliverIntent(const IntentData& intentData)
+{
+ OwnPtr<DeliveredIntentClient> dummyClient;
+ OwnPtr<MessagePortArray> dummyPorts;
+ Vector<uint8_t> dataCopy = intentData.data;
+ RefPtr<DeliveredIntent> deliveredIntent = DeliveredIntent::create(m_coreFrame, dummyClient.release(), intentData.action, intentData.type,
+ SerializedScriptValue::adopt(dataCopy), dummyPorts.release(),
+ intentData.extras);
+ WebCore::DOMWindowIntents::from(m_coreFrame->domWindow())->deliver(deliveredIntent.release());
+}
+#endif
+
String WebFrame::source() const
{
if (!m_coreFrame)
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h (120830 => 120831)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h 2012-06-20 17:14:23 UTC (rev 120830)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h 2012-06-20 17:22:10 UTC (rev 120831)
@@ -52,6 +52,10 @@
class InjectedBundleScriptWorld;
class WebPage;
+#if ENABLE(WEB_INTENTS)
+struct IntentData;
+#endif
+
class WebFrame : public APIObject {
public:
static const Type APIType = TypeBundleFrame;
@@ -75,6 +79,10 @@
void startDownload(const WebCore::ResourceRequest&);
void convertHandleToDownload(WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
+#if ENABLE(WEB_INTENTS)
+ void deliverIntent(const IntentData&);
+#endif
+
String source() const;
String contentsAsString() const;
String selectionAsString() const;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (120830 => 120831)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2012-06-20 17:14:23 UTC (rev 120830)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2012-06-20 17:22:10 UTC (rev 120831)
@@ -124,6 +124,10 @@
#endif
#endif
+#if ENABLE(WEB_INTENTS)
+#include "IntentData.h"
+#endif
+
#if PLATFORM(MAC)
#include "BuiltInPDFView.h"
#endif
@@ -1914,6 +1918,17 @@
send(Messages::WebPageProxy::VoidCallback(callbackID));
}
+#if ENABLE(WEB_INTENTS)
+void WebPage::deliverIntentToFrame(uint64_t frameID, const IntentData& intentData)
+{
+ WebFrame* frame = WebProcess::shared().webFrame(frameID);
+ if (!frame)
+ return;
+
+ frame->deliverIntent(intentData);
+}
+#endif
+
void WebPage::preferencesDidChange(const WebPreferencesStore& store)
{
WebPreferencesStore::removeTestRunnerOverrides();
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (120830 => 120831)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2012-06-20 17:14:23 UTC (rev 120830)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2012-06-20 17:22:10 UTC (rev 120831)
@@ -143,6 +143,10 @@
struct WebPageCreationParameters;
struct WebPreferencesStore;
+#if ENABLE(WEB_INTENTS)
+struct IntentData;
+#endif
+
#if ENABLE(GESTURE_EVENTS)
class WebGestureEvent;
#endif
@@ -635,6 +639,10 @@
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/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (120830 => 120831)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2012-06-20 17:14:23 UTC (rev 120830)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2012-06-20 17:22:10 UTC (rev 120831)
@@ -220,6 +220,11 @@
SetCanRunBeforeUnloadConfirmPanel(bool canRunBeforeUnloadConfirmPanel)
SetCanRunModal(bool canRunModal)
+ # Web Intents
+#if ENABLE(WEB_INTENTS)
+ DeliverIntentToFrame(uint64_t frameID, WebKit::IntentData intentData);
+#endif
+
#if PLATFORM(QT)
SetComposition(WTF::String text, WTF::Vector<WebCore::CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd)
ConfirmComposition(WTF::String text, int64_t selectionStart, int64_t selectionLength)