+2012-01-19 Greg Billock <gbillock@google.com>
+
+ Web Intents chromium API modifications to track IntentRequest invocation method
+ https://bugs.webkit.org/show_bug.cgi?id=76014
+
+ Reviewed by Darin Fisher.
+
+ * public/WebFrameClient.h:
+ (WebKit::WebFrameClient::dispatchIntent):
+ * public/WebIntent.h:
+ * public/WebIntentRequest.h: Added.
+ * src/FrameLoaderClientImpl.cpp:
+ (WebKit::FrameLoaderClientImpl::dispatchIntent):
+ * src/FrameLoaderClientImpl.h:
+ * src/WebIntent.cpp:
+ * src/WebIntentRequest.cpp: Added.
+
2012-01-19 Michal Mocny <mmocny@google.com>
[chromium] Replace WGC3D visibility extension with resource_usage extension. [Part 1 of 3]
'public/WebInputElement.h',
'public/WebInputEvent.h',
'public/WebIntent.h',
+ 'public/WebIntentRequest.h',
'public/WebIntentServiceInfo.h',
'public/WebKit.h',
'public/WebLabelElement.h',
'src/WebInputEventConversion.cpp',
'src/WebInputEventConversion.h',
'src/WebIntent.cpp',
+ 'src/WebIntentRequest.cpp',
'src/WebIntentServiceInfo.cpp',
'src/WebKit.cpp',
'src/WebLabelElement.cpp',
class WebDOMEvent;
class WebFormElement;
class WebFrame;
-class WebIntentServiceInfo;
class WebIntent;
+class WebIntentRequest;
+class WebIntentServiceInfo;
class WebMediaPlayer;
class WebMediaPlayerClient;
class WebNode;
// Register a service to handle Web Intents.
virtual void registerIntentService(WebFrame*, const WebIntentServiceInfo&) { }
- // Start a Web Intents activity. Replies to this request should be sent to
- // the WebFrame starting the activity.
- virtual void dispatchIntent(WebFrame*, const WebIntent&) { }
+ // Start a Web Intents activity. The callee uses the |WebIntentRequest|
+ // object to coordinate replies to the intent invocation.
+ virtual void dispatchIntent(WebFrame*, const WebIntentRequest&) { }
// Messages ------------------------------------------------------
#define WebIntent_h
#include "platform/WebCommon.h"
+#include "platform/WebPrivatePtr.h"
#include "platform/WebString.h"
+namespace WebCore { class Intent; }
+
namespace WebKit {
// Holds data passed through a Web Intents invocation call from the Javascript
// See spec at http://www.chromium.org/developers/design-documents/webintentsapi
class WebIntent {
public:
- ~WebIntent() { }
+ WebIntent() { }
+ WebIntent(const WebIntent& other) { assign(other); }
+ ~WebIntent() { reset(); }
- WEBKIT_EXPORT WebString action() const;
- WEBKIT_EXPORT void setAction(const WebString&);
+ WebIntent& operator=(const WebIntent& other)
+ {
+ assign(other);
+ return *this;
+ }
+ WEBKIT_EXPORT void reset();
+ WEBKIT_EXPORT bool isNull() const;
+ WEBKIT_EXPORT bool equals(const WebIntent&) const;
+ WEBKIT_EXPORT void assign(const WebIntent&);
+ WEBKIT_EXPORT WebString action() const;
WEBKIT_EXPORT WebString type() const;
- WEBKIT_EXPORT void setType(const WebString&);
-
WEBKIT_EXPORT WebString data() const;
- WEBKIT_EXPORT void setData(const WebString&);
+ // FIXME: delete this.
WEBKIT_EXPORT int identifier() const;
- WEBKIT_EXPORT void setIdentifier(int);
#if WEBKIT_IMPLEMENTATION
- WebIntent();
+ WebIntent(const WTF::PassRefPtr<WebCore::Intent>&);
#endif
private:
- WebString m_action;
- WebString m_type;
- WebString m_data;
- int m_identifier;
+ WebPrivatePtr<WebCore::Intent> m_private;
};
} // namespace WebKit
--- /dev/null
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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 WebIntentRequest_h
+#define WebIntentRequest_h
+
+#include "platform/WebCommon.h"
+#include "platform/WebPrivatePtr.h"
+#include "platform/WebString.h"
+
+namespace WebCore { class IntentRequest; }
+
+namespace WebKit {
+
+class WebIntent;
+class WebSerializedScriptValue;
+
+// Holds data passed through a Web Intents invocation call from the Javascript
+// Intent object.
+// See spec at http://www.chromium.org/developers/design-documents/webintentsapi
+class WebIntentRequest {
+public:
+ WebIntentRequest() { }
+ WebIntentRequest(const WebIntentRequest& other) { assign(other); }
+ ~WebIntentRequest() { reset(); }
+
+ WebIntentRequest& operator=(const WebIntentRequest& other)
+ {
+ assign(other);
+ return *this;
+ }
+ WEBKIT_EXPORT void reset();
+ WEBKIT_EXPORT bool isNull() const;
+ WEBKIT_EXPORT bool equals(const WebIntentRequest&) const;
+ WEBKIT_EXPORT void assign(const WebIntentRequest&);
+
+ WEBKIT_EXPORT void postResult(const WebSerializedScriptValue&);
+ WEBKIT_EXPORT void postFailure(const WebSerializedScriptValue&);
+
+ WEBKIT_EXPORT WebIntent intent() const;
+
+#if WEBKIT_IMPLEMENTATION
+ WebIntentRequest(const WTF::PassRefPtr<WebCore::IntentRequest>&);
+#endif
+
+private:
+ WebPrivatePtr<WebCore::IntentRequest> m_private;
+};
+
+} // namespace WebKit
+
+#endif // WebIntentRequest_h
#include "WebFormElement.h"
#include "WebFrameClient.h"
#include "WebFrameImpl.h"
+#include "WebIntentRequest.h"
#include "WebKit.h"
#include "platform/WebKitPlatformSupport.h"
#include <public/WebMimeRegistry.h>
m_webFrame, WebSecurityOrigin(target), WebDOMMessageEvent(event));
}
+#if ENABLE(WEB_INTENTS)
+void FrameLoaderClientImpl::dispatchIntent(PassRefPtr<WebCore::IntentRequest> intentRequest)
+{
+ m_webFrame->client()->dispatchIntent(webFrame(), intentRequest);
+}
+#endif
+
} // namespace WebKit
virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext();
virtual bool willCheckAndDispatchMessageEvent(WebCore::SecurityOrigin* target, WebCore::MessageEvent*) const;
+#if ENABLE(WEB_INTENTS)
+ virtual void dispatchIntent(PassRefPtr<WebCore::IntentRequest>) OVERRIDE;
+#endif
+
private:
void makeDocumentView();
#include "config.h"
#include "WebIntent.h"
+#include "Intent.h"
+#include "SerializedScriptValue.h"
+
namespace WebKit {
-WebIntent::WebIntent() { }
+#if ENABLE(WEB_INTENTS)
+WebIntent::WebIntent(const PassRefPtr<WebCore::Intent>& intent)
+ : m_private(intent)
+{
+}
+#endif
-WebString WebIntent::action() const
+void WebIntent::reset()
{
- return m_action;
+#if ENABLE(WEB_INTENTS)
+ m_private.reset();
+#endif
}
-void WebIntent::setAction(const WebString& action)
+bool WebIntent::isNull() const
{
- m_action = action;
+#if ENABLE(WEB_INTENTS)
+ return m_private.isNull();
+#else
+ return true;
+#endif
}
-WebString WebIntent::type() const
+bool WebIntent::equals(const WebIntent& other) const
{
- return m_type;
+#if ENABLE(WEB_INTENTS)
+ return (m_private.get() == other.m_private.get());
+#else
+ return true;
+#endif
}
-void WebIntent::setType(const WebString& type)
+void WebIntent::assign(const WebIntent& other)
{
- m_type = type;
+#if ENABLE(WEB_INTENTS)
+ m_private = other.m_private;
+#endif
}
-WebString WebIntent::data() const
+WebString WebIntent::action() const
{
- return m_data;
+#if ENABLE(WEB_INTENTS)
+ return m_private->action();
+#else
+ return WebString();
+#endif
}
-void WebIntent::setData(const WebString& data)
+WebString WebIntent::type() const
{
- m_data = data;
+#if ENABLE(WEB_INTENTS)
+ return m_private->type();
+#else
+ return WebString();
+#endif
}
-int WebIntent::identifier() const
+WebString WebIntent::data() const
{
- return m_identifier;
+#if ENABLE(WEB_INTENTS)
+ return m_private->data()->toWireString();
+#else
+ return WebString();
+#endif
}
-void WebIntent::setIdentifier(int identifier)
+int WebIntent::identifier() const
{
- m_identifier = identifier;
+ return 0;
}
} // namespace WebKit
--- /dev/null
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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 "WebIntentRequest.h"
+
+#include "Intent.h"
+#include "IntentRequest.h"
+#include "SerializedScriptValue.h"
+#include "WebIntent.h"
+#include "platform/WebSerializedScriptValue.h"
+
+namespace WebKit {
+
+#if ENABLE(WEB_INTENTS)
+WebIntentRequest::WebIntentRequest(const PassRefPtr<WebCore::IntentRequest>& intentRequest)
+ : m_private(intentRequest)
+{
+}
+#endif
+
+void WebIntentRequest::reset()
+{
+#if ENABLE(WEB_INTENTS)
+ m_private.reset();
+#endif
+}
+
+bool WebIntentRequest::isNull() const
+{
+#if ENABLE(WEB_INTENTS)
+ return m_private.isNull();
+#else
+ return true;
+#endif
+}
+
+bool WebIntentRequest::equals(const WebIntentRequest& other) const
+{
+#if ENABLE(WEB_INTENTS)
+ return (m_private.get() == other.m_private.get());
+#else
+ return true;
+#endif
+}
+
+void WebIntentRequest::assign(const WebIntentRequest& other)
+{
+#if ENABLE(WEB_INTENTS)
+ m_private = other.m_private;
+#endif
+}
+
+WebIntent WebIntentRequest::intent() const
+{
+#if ENABLE(WEB_INTENTS)
+ return WebIntent(m_private->intent());
+#else
+ return WebIntent();
+#endif
+}
+
+void WebIntentRequest::postResult(const WebSerializedScriptValue& data)
+{
+#if ENABLE(WEB_INTENTS)
+ m_private->postResult(PassRefPtr<WebCore::SerializedScriptValue>(data).get());
+#endif
+}
+
+void WebIntentRequest::postFailure(const WebSerializedScriptValue& data)
+{
+#if ENABLE(WEB_INTENTS)
+ m_private->postFailure(PassRefPtr<WebCore::SerializedScriptValue>(data).get());
+#endif
+}
+
+
+} // namespace WebKit