diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-07 11:21:11 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-07 11:21:11 +0200 |
commit | 2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (patch) | |
tree | 988e8c5b116dd0466244ae2fe5af8ee9be926d76 /Source/WebKit/chromium/src/WebIntent.cpp | |
parent | dd91e772430dc294e3bf478c119ef8d43c0a3358 (diff) | |
download | qtwebkit-2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47.tar.gz |
Imported WebKit commit 7e538425aa020340619e927792f3d895061fb54b (http://svn.webkit.org/repository/webkit/trunk@116286)
Diffstat (limited to 'Source/WebKit/chromium/src/WebIntent.cpp')
-rw-r--r-- | Source/WebKit/chromium/src/WebIntent.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Source/WebKit/chromium/src/WebIntent.cpp b/Source/WebKit/chromium/src/WebIntent.cpp index 77d766d76..ce4e15bd6 100644 --- a/Source/WebKit/chromium/src/WebIntent.cpp +++ b/Source/WebKit/chromium/src/WebIntent.cpp @@ -32,7 +32,9 @@ #include "WebIntent.h" #include "Intent.h" +#include "PlatformMessagePortChannel.h" #include "SerializedScriptValue.h" +#include <wtf/HashMap.h> namespace WebKit { @@ -102,4 +104,56 @@ WebString WebIntent::data() const #endif } +WebURL WebIntent::service() const +{ +#if ENABLE(WEB_INTENTS) + return WebURL(m_private->service()); +#else + return WebURL(); +#endif +} + +WebMessagePortChannelArray* WebIntent::messagePortChannelsRelease() const +{ + // Note: see PlatformMessagePortChannel::postMessageToRemote. + WebMessagePortChannelArray* webChannels = 0; + WebCore::MessagePortChannelArray* messagePorts = m_private->messagePorts(); + if (messagePorts) { + webChannels = new WebMessagePortChannelArray(messagePorts->size()); + for (size_t i = 0; i < messagePorts->size(); ++i) { + WebCore::PlatformMessagePortChannel* platformChannel = messagePorts->at(i)->channel(); + (*webChannels)[i] = platformChannel->webChannelRelease(); + (*webChannels)[i]->setClient(0); + } + } + + return webChannels; +} + +WebVector<WebString> WebIntent::extrasNames() const +{ +#if ENABLE(WEB_INTENTS) + size_t numExtras = m_private->extras().size(); + WebVector<WebString> keyStrings(numExtras); + WTF::HashMap<String, String>::const_iterator::Keys keyIter = m_private->extras().begin().keys(); + for (size_t i = 0; keyIter != m_private->extras().end().keys(); ++keyIter, ++i) + keyStrings[i] = *keyIter; + return keyStrings; +#else + return WebVector<WebString>(); +#endif +} + +WebString WebIntent::extrasValue(const WebString& name) const +{ +#if ENABLE(WEB_INTENTS) + WTF::HashMap<String, String>::const_iterator val = m_private->extras().find(name); + if (val == m_private->extras().end()) + return WebString(); + return val->second; +#else + return WebString(); +#endif +} + } // namespace WebKit |