[WK2] Add support for Web Intents MessagePorts
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Aug 2012 13:03:19 +0000 (13:03 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Aug 2012 13:03:19 +0000 (13:03 +0000)
commitaec2ec968e79c73838b2412c1cd01021132fca6e
treebbb87e06339dfcd36a418571a9f1526bd04eb28f
parent102cbb9edd169f3084a8e6d20bd442b7226b2cdd
[WK2] Add support for Web Intents MessagePorts
https://bugs.webkit.org/show_bug.cgi?id=89072

Patch by Christophe Dumez <christophe.dumez@intel.com> on 2012-08-15
Reviewed by Kenneth Rohde Christiansen.

Source/WebKit2:

Add support for WebIntents MessagePorts in WebKit2.
MessagePorts can be passed with a Web Intent in
order to open a direct communication channel
between the Web application and the intent service.

This functionality is already supported by WebKit 1.

This patch introduces a new InjectedBundleIntent
class which wraps a WebCore::Intent. This way
information regarding the MessagePorts in a Web
Intent is kept when using an injected bundle.

For the UIProcess, WebIntentData now carries
identifiers for the MessagePorts which can go over
IPC. Those identifiers map to actual MessagePorts
stored in the Web process. This way, when the UI
delivers an intent to a frame, we can get back the
corresponding MessagePorts from the Web process
before delivering the intent to the DOMWindow.

This functionality is already tested by:

- webintents/web-intents-invoke-port.html
- webintents/web-intents-obj-constructor.html

* CMakeLists.txt:
* GNUmakefile.list.am:
* Shared/API/c/WKBase.h:
* Shared/APIObject.h:
* Shared/IntentData.cpp: Add MessagePort identifiers.
(WebKit::IntentData::IntentData):
(WebKit::IntentData::encode):
(WebKit::IntentData::decode):
* Shared/IntentData.h:
(IntentData):
* Target.pri:
* UIProcess/API/C/WKIntentData.cpp: Rename WKIntentDataCopyExtra() to
WKIntentDataCopyExtraValue() for clarity.
(WKIntentDataCopyExtraValue):
* UIProcess/API/C/WKIntentData.h: Remove WKIntentDataCreate() function now
that WTR uses WKBundleIntentCreate() instead.
* UIProcess/API/efl/ewk_intent.cpp:
(ewk_intent_extra_get): Use WKIntentDataCopyExtraValue() instead of
WKIntentDataCopyExtra() since it was renamed.
* UIProcess/WebIntentData.cpp:
(WebKit::WebIntentData::WebIntentData):
(WebKit::WebIntentData::~WebIntentData): Remove MessagePorts from WebProcess upon
WebIntentData destruction.
(WebKit):
(WebKit::WebIntentData::extras):
* UIProcess/WebIntentData.h:
(WebKit):
(WebKit::WebIntentData::create):
(WebIntentData):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didReceiveIntentForFrame):
* UIProcess/WebProcessProxy.cpp:
(WebKit):
(WebKit::WebProcessProxy::removeMessagePortChannel):
* UIProcess/WebProcessProxy.h:
(WebProcessProxy):
* WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
(WebKit):
* WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp: Copied from Source/WebKit2/UIProcess/API/C/WKIntentData.cpp.
(WKBundleIntentGetTypeID):
(WKBundleIntentCreate):
(WKBundleIntentCopyAction):
(WKBundleIntentCopyType):
(WKBundleIntentCopyService):
(WKBundleIntentCopySuggestions):
(WKBundleIntentCopyExtraValue):
(WKBundleIntentCopyExtras):
(WKBundleIntentMessagePortCount):
* WebProcess/InjectedBundle/API/c/WKBundleIntent.h: Copied from Source/WebKit2/UIProcess/API/C/WKIntentData.h.
* WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.cpp:
(WKBundleIntentRequestCopyIntent):
* WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.h:
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageDeliverIntentToFrame):
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
* WebProcess/InjectedBundle/InjectedBundleIntent.cpp: Copied from Source/WebKit2/UIProcess/WebIntentData.cpp.
(WebKit):
(WebKit::InjectedBundleIntent::create):
(WebKit::InjectedBundleIntent::InjectedBundleIntent):
(WebKit::InjectedBundleIntent::action):
(WebKit::InjectedBundleIntent::payloadType):
(WebKit::InjectedBundleIntent::service):
(WebKit::InjectedBundleIntent::data):
(WebKit::InjectedBundleIntent::extra):
(WebKit::InjectedBundleIntent::extras):
(WebKit::InjectedBundleIntent::suggestions):
* WebProcess/InjectedBundle/InjectedBundleIntent.h: Copied from Source/WebKit2/UIProcess/WebIntentData.h.
(WebKit):
(InjectedBundleIntent):
(WebKit::InjectedBundleIntent::coreIntent):
(WebKit::InjectedBundleIntent::type):
* WebProcess/InjectedBundle/InjectedBundleIntentRequest.cpp:
(WebKit::InjectedBundleIntentRequest::intent):
* WebProcess/InjectedBundle/InjectedBundleIntentRequest.h:
(WebKit):
(InjectedBundleIntentRequest):
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::deliverIntent):
(WebKit):
* WebProcess/WebPage/WebFrame.h:
(WebCore):
(WebFrame):
* WebProcess/WebPage/WebPage.cpp:
(WebKit):
(WebKit::WebPage::deliverCoreIntentToFrame):
* WebProcess/WebPage/WebPage.h:
(WebCore):
(WebPage):
* WebProcess/WebProcess.cpp: Store MessagePorts in WebProcess and keep mapping with
their identifiers.
(WebKit):
(WebKit::WebProcess::addMessagePortChannel):
(WebKit::WebProcess::messagePortChannel):
(WebKit::WebProcess::removeMessagePortChannel):
* WebProcess/WebProcess.h:
(WebCore):
(WebProcess):
* WebProcess/WebProcess.messages.in:

Tools:

Use WKBundleIntent instead of WebIntentData in
WebKitTestRunner. WTR now prints the number of
MessagePorts in received Web intents as
expected by the following layout tests:
webintents/web-intents-invoke-port.html
webintents/web-intents-obj-constructor.html

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::didReceiveIntentForFrame):
* WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
(WTR::LayoutTestController::deliverWebIntent):

LayoutTests:

Unskip webintents/web-intents-invoke-port.html and
webintents/web-intents-obj-constructor.html for
WebKit2 EFL now that information about message ports
is correctly displayed by WebKitTestRunner.

* platform/efl-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@125670 268f45cc-cd09-0410-ab3c-d52691b4dbfc
39 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/efl-wk2/TestExpectations
Source/WebKit2/CMakeLists.txt
Source/WebKit2/ChangeLog
Source/WebKit2/GNUmakefile.list.am
Source/WebKit2/Shared/API/c/WKBase.h
Source/WebKit2/Shared/APIObject.h
Source/WebKit2/Shared/IntentData.cpp
Source/WebKit2/Shared/IntentData.h
Source/WebKit2/Target.pri
Source/WebKit2/UIProcess/API/C/WKIntentData.cpp
Source/WebKit2/UIProcess/API/C/WKIntentData.h
Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp
Source/WebKit2/UIProcess/WebIntentData.cpp
Source/WebKit2/UIProcess/WebIntentData.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebProcessProxy.cpp
Source/WebKit2/UIProcess/WebProcessProxy.h
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.h [new file with mode: 0644]
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.h
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntent.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntent.h [new file with mode: 0644]
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.cpp
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.h
Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
Source/WebKit2/WebProcess/WebPage/WebFrame.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebProcess.cpp
Source/WebKit2/WebProcess/WebProcess.h
Source/WebKit2/WebProcess/WebProcess.messages.in
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp