Diff
Modified: trunk/Source/WebCore/ChangeLog (119507 => 119508)
--- trunk/Source/WebCore/ChangeLog 2012-06-05 18:32:10 UTC (rev 119507)
+++ trunk/Source/WebCore/ChangeLog 2012-06-05 18:39:37 UTC (rev 119508)
@@ -1,3 +1,16 @@
+2012-06-05 Greg Billock <[email protected]>
+
+ New constructor for WebIntent to be used for delivery
+ https://bugs.webkit.org/show_bug.cgi?id=87143
+
+ Reviewed by Darin Fisher.
+
+ * Modules/intents/Intent.cpp:
+ (WebCore::Intent::setExtras):
+ (WebCore):
+ * Modules/intents/Intent.h:
+ (Intent):
+
2012-06-01 Ojan Vafai <[email protected]>
Change overrideSizes to be content-box instead of border-box
Modified: trunk/Source/WebCore/Modules/intents/Intent.cpp (119507 => 119508)
--- trunk/Source/WebCore/Modules/intents/Intent.cpp 2012-06-05 18:32:10 UTC (rev 119507)
+++ trunk/Source/WebCore/Modules/intents/Intent.cpp 2012-06-05 18:39:37 UTC (rev 119508)
@@ -135,6 +135,11 @@
m_data = SerializedScriptValue::nullValue();
}
+void Intent::setExtras(const WTF::HashMap<String, String>& extras)
+{
+ m_extras = extras;
+}
+
} // namespace WebCore
#endif // ENABLE(WEB_INTENTS)
Modified: trunk/Source/WebCore/Modules/intents/Intent.h (119507 => 119508)
--- trunk/Source/WebCore/Modules/intents/Intent.h 2012-06-05 18:32:10 UTC (rev 119507)
+++ trunk/Source/WebCore/Modules/intents/Intent.h 2012-06-05 18:39:37 UTC (rev 119508)
@@ -65,6 +65,8 @@
const HashMap<String, String>& extras() const { return m_extras; }
const Vector<KURL>& suggestions() const { return m_suggestions; }
+ void setExtras(const WTF::HashMap<String, String>&);
+
protected:
Intent(const String& action, const String& type,
PassRefPtr<SerializedScriptValue> data, PassOwnPtr<MessagePortChannelArray> ports,
Modified: trunk/Source/WebKit/chromium/ChangeLog (119507 => 119508)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-06-05 18:32:10 UTC (rev 119507)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-06-05 18:39:37 UTC (rev 119508)
@@ -1,3 +1,23 @@
+2012-06-05 Greg Billock <[email protected]>
+
+ New constructor for WebIntent to be used for delivery
+ https://bugs.webkit.org/show_bug.cgi?id=87143
+
+ Reviewed by Darin Fisher.
+
+ When delivering an intent to webkit, the caller needs to be able to
+ provide the action, type, and data, and also extra data and ports.
+
+ * public/WebIntent.h:
+ (WebIntent):
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::deliverIntent):
+ * src/WebIntent.cpp:
+ (WebKit::WebIntent::WebIntent):
+ (WebKit):
+ (WebKit::WebIntent::reset):
+ (WebKit::WebIntent::messagePortChannelsRelease):
+
2012-06-05 Ryosuke Niwa <[email protected]>
Roll Chromium DEPS from r140492 to r140528.
Modified: trunk/Source/WebKit/chromium/public/WebFrame.h (119507 => 119508)
--- trunk/Source/WebKit/chromium/public/WebFrame.h 2012-06-05 18:32:10 UTC (rev 119507)
+++ trunk/Source/WebKit/chromium/public/WebFrame.h 2012-06-05 18:39:37 UTC (rev 119508)
@@ -32,6 +32,7 @@
#define WebFrame_h
#include "WebIconURL.h"
+#include "WebMessagePortChannel.h"
#include "WebNode.h"
#include "WebURLLoaderOptions.h"
#include "platform/WebCanvas.h"
@@ -591,7 +592,9 @@
// Web Intents ---------------------------------------------------------
// Called on a target service page to deliver an intent to the window.
- virtual void deliverIntent(const WebIntent&, WebDeliveredIntentClient*) = 0;
+ // The ports are any transferred ports that accompany the intent as a result
+ // of MessagePort transfer.
+ virtual void deliverIntent(const WebIntent&, WebMessagePortChannelArray* ports, WebDeliveredIntentClient*) = 0;
// Utility -------------------------------------------------------------
Modified: trunk/Source/WebKit/chromium/public/WebIntent.h (119507 => 119508)
--- trunk/Source/WebKit/chromium/public/WebIntent.h 2012-06-05 18:32:10 UTC (rev 119507)
+++ trunk/Source/WebKit/chromium/public/WebIntent.h 2012-06-05 18:39:37 UTC (rev 119508)
@@ -48,7 +48,6 @@
class WebIntent {
public:
WebIntent() { }
- WEBKIT_EXPORT WebIntent(const WebString& action, const WebString& type, const WebString& data);
WebIntent(const WebIntent& other) { assign(other); }
~WebIntent() { reset(); }
@@ -57,6 +56,10 @@
assign(other);
return *this;
}
+
+ WEBKIT_EXPORT static WebIntent create(const WebString& action, const WebString& type, const WebString& data,
+ const WebVector<WebString>& extrasNames, const WebVector<WebString>& extrasValues);
+
WEBKIT_EXPORT void reset();
WEBKIT_EXPORT bool isNull() const;
WEBKIT_EXPORT bool equals(const WebIntent&) const;
Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp (119507 => 119508)
--- trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp 2012-06-05 18:32:10 UTC (rev 119507)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp 2012-06-05 18:39:37 UTC (rev 119508)
@@ -109,10 +109,12 @@
#include "IconURL.h"
#include "InspectorController.h"
#include "KURL.h"
+#include "MessagePort.h"
#include "Node.h"
#include "Page.h"
#include "PageOverlay.h"
#include "Performance.h"
+#include "PlatformMessagePortChannel.h"
#include "PlatformSupport.h"
#include "PluginDocument.h"
#include "PrintContext.h"
@@ -1901,16 +1903,28 @@
m_frame->domWindow()->dispatchMessageEventWithOriginCheck(intendedTargetOrigin.get(), event, 0);
}
-void WebFrameImpl::deliverIntent(const WebIntent& intent, WebDeliveredIntentClient* intentClient)
+void WebFrameImpl::deliverIntent(const WebIntent& intent, WebMessagePortChannelArray* ports, WebDeliveredIntentClient* intentClient)
{
#if ENABLE(WEB_INTENTS)
OwnPtr<WebCore::DeliveredIntentClient> client(adoptPtr(new DeliveredIntentClientImpl(intentClient)));
- OwnPtr<MessagePortArray> ports;
WebSerializedScriptValue intentData = WebSerializedScriptValue::fromString(intent.data());
const WebCore::Intent* webcoreIntent = intent;
- RefPtr<DeliveredIntent> deliveredIntent = DeliveredIntent::create(m_frame, client.release(), intent.action(), intent.type(), intentData, ports.release(), webcoreIntent->extras());
+ // See PlatformMessagePortChannel.cpp
+ OwnPtr<MessagePortChannelArray> channels;
+ if (ports && ports->size()) {
+ channels = adoptPtr(new MessagePortChannelArray(ports->size()));
+ for (size_t i = 0; i < ports->size(); ++i) {
+ RefPtr<PlatformMessagePortChannel> platformChannel = PlatformMessagePortChannel::create((*ports)[i]);
+ (*ports)[i]->setClient(platformChannel.get());
+ (*channels)[i] = MessagePortChannel::create(platformChannel);
+ }
+ }
+ OwnPtr<MessagePortArray> portArray = WebCore::MessagePort::entanglePorts(*(m_frame->domWindow()->scriptExecutionContext()), channels.release());
+
+ RefPtr<DeliveredIntent> deliveredIntent = DeliveredIntent::create(m_frame, client.release(), intent.action(), intent.type(), intentData, portArray.release(), webcoreIntent->extras());
+
DOMWindowIntents::from(m_frame->domWindow())->deliver(deliveredIntent.release());
#endif
}
Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.h (119507 => 119508)
--- trunk/Source/WebKit/chromium/src/WebFrameImpl.h 2012-06-05 18:32:10 UTC (rev 119507)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.h 2012-06-05 18:39:37 UTC (rev 119508)
@@ -217,7 +217,7 @@
const WebSecurityOrigin& intendedTargetOrigin,
const WebDOMEvent&);
- virtual void deliverIntent(const WebIntent&, WebDeliveredIntentClient*);
+ virtual void deliverIntent(const WebIntent&, WebMessagePortChannelArray*, WebDeliveredIntentClient*);
virtual WebString contentAsText(size_t maxChars) const;
virtual WebString contentAsMarkup() const;
Modified: trunk/Source/WebKit/chromium/src/WebIntent.cpp (119507 => 119508)
--- trunk/Source/WebKit/chromium/src/WebIntent.cpp 2012-06-05 18:32:10 UTC (rev 119507)
+++ trunk/Source/WebKit/chromium/src/WebIntent.cpp 2012-06-05 18:39:37 UTC (rev 119508)
@@ -35,20 +35,27 @@
#include "MessagePort.h"
#include "PlatformMessagePortChannel.h"
#include "SerializedScriptValue.h"
+#include "platform/WebSerializedScriptValue.h"
#include <wtf/HashMap.h>
namespace WebKit {
-WebIntent::WebIntent(const WebString& action, const WebString& type, const WebString& data)
+WebIntent WebIntent::create(const WebString& action, const WebString& type, const WebString& data,
+ const WebVector<WebString>& extrasNames, const WebVector<WebString>& extrasValues)
{
#if ENABLE(WEB_INTENTS)
WebCore::ExceptionCode ec = 0;
- WebCore::MessagePortArray ports;
- RefPtr<WebCore::Intent> intent = WebCore::Intent::create(action, type, WebCore::SerializedScriptValue::createFromWire(data), ports, ec);
+ WebCore::MessagePortArray dummyPorts;
+ RefPtr<WebCore::Intent> intent = WebCore::Intent::create(action, type, WebCore::SerializedScriptValue::createFromWire(data), dummyPorts, ec);
if (ec)
- return;
+ return WebIntent();
- m_private = intent.release();
+ HashMap<String, String> extras;
+ for (size_t i = 0; i < extrasNames.size() && i < extrasValues.size(); ++i)
+ extras.add(extrasNames[i], extrasValues[i]);
+ intent->setExtras(extras);
+
+ return WebIntent(intent.release());
#endif
}
Modified: trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp (119507 => 119508)
--- trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp 2012-06-05 18:32:10 UTC (rev 119507)
+++ trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp 2012-06-05 18:39:37 UTC (rev 119508)
@@ -2159,9 +2159,9 @@
WebSerializedScriptValue serializedData = WebSerializedScriptValue::serialize(
v8::String::New(data.data(), data.length()));
- WebIntent intent(action, type, serializedData.toString());
+ WebIntent intent = WebIntent::create(action, type, serializedData.toString(), WebVector<WebString>(), WebVector<WebString>());
- m_shell->webView()->mainFrame()->deliverIntent(intent, m_intentClient.get());
+ m_shell->webView()->mainFrame()->deliverIntent(intent, 0, m_intentClient.get());
}
void LayoutTestController::setPluginsEnabled(const CppArgumentList& arguments, CppVariant* result)