Title: [104531] trunk
Revision
104531
Author
[email protected]
Date
2012-01-09 18:29:38 -0800 (Mon, 09 Jan 2012)

Log Message

Source/WebCore: Implement navigator.startActivity; add IntentRequest object for managing web intents callbacks.
Web content will invoke navigator.startActivity to launch a new Web
Intents call. Each such call will map to an IntentRequest broker
object which is used by client code to correlate any return data to
the (optional) callbacks supplied by web content calls.
https://bugs.webkit.org/show_bug.cgi?id=75756

Patch by Greg Billock <[email protected]> on 2012-01-09
Reviewed by Adam Barth.

Test: webintents/web-intents-api.html

* Modules/intents/Intent.cpp: Added.
(WebCore::Intent::identifier):
(WebCore::Intent::setIdentifier):
* Modules/intents/Intent.h: Added.
* Modules/intents/Intent.idl: Added.
* Modules/intents/IntentResultCallback.h: Added.
(WebCore::IntentResultCallback::~IntentResultCallback):
* Modules/intents/IntentResultCallback.idl: Added.
* Modules/intents/IntentsRequest.cpp: Added.
* Modules/intents/IntentsRequest.h: Added.
* WebCore.gyp/WebCore.gyp:
* WebCore.gypi:
* bindings/scripts/CodeGeneratorV8.pm:
(GetNativeTypeForCallbacks):
* loader/FrameLoaderClient.h:
(WebCore::FrameLoaderClient::dispatchIntent):

LayoutTests: Implement navigator.startActivity; add IntentsController for managing web intents callbacks.
https://bugs.webkit.org/show_bug.cgi?id=75756

Patch by Greg Billock <[email protected]> on 2012-01-09
Reviewed by Adam Barth.

* webintents/web-intents-api-expected.txt: Added.
* webintents/web-intents-api.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (104530 => 104531)


--- trunk/LayoutTests/ChangeLog	2012-01-10 02:14:33 UTC (rev 104530)
+++ trunk/LayoutTests/ChangeLog	2012-01-10 02:29:38 UTC (rev 104531)
@@ -1,3 +1,13 @@
+2012-01-09  Greg Billock  <[email protected]>
+
+        Implement navigator.startActivity; add IntentsController for managing web intents callbacks.
+        https://bugs.webkit.org/show_bug.cgi?id=75756
+
+        Reviewed by Adam Barth.
+
+        * webintents/web-intents-api-expected.txt: Added.
+        * webintents/web-intents-api.html: Added.
+
 2012-01-09  Gavin Barraclough  <[email protected]>
 
         Error handling : in ISO8601 timezone

Modified: trunk/LayoutTests/webintents/web-intents-api-expected.txt (104530 => 104531)


--- trunk/LayoutTests/webintents/web-intents-api-expected.txt	2012-01-10 02:14:33 UTC (rev 104530)
+++ trunk/LayoutTests/webintents/web-intents-api-expected.txt	2012-01-10 02:29:38 UTC (rev 104531)
@@ -1,3 +1,4 @@
+PASS navigator.startActivity is defined.
 PASS var intent = new Intent() threw exception TypeError: Not enough arguments.
 PASS new Intent('a') threw exception TypeError: Not enough arguments.
 PASS new Intent('','','') threw exception Error: SYNTAX_ERR: DOM Exception 12.
@@ -25,6 +26,7 @@
 PASS intent7.data is true
 PASS intent8.data is null
 PASS intent9.data == '[object Object]' is true
+PASS navigator.startActivity(intent1) threw exception Error: INVALID_ACCESS_ERR: DOM Exception 15.
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/webintents/web-intents-api.html (104530 => 104531)


--- trunk/LayoutTests/webintents/web-intents-api.html	2012-01-10 02:14:33 UTC (rev 104530)
+++ trunk/LayoutTests/webintents/web-intents-api.html	2012-01-10 02:29:38 UTC (rev 104531)
@@ -5,8 +5,9 @@
 </head>
 <body>
 <script type="text/_javascript_">
+      shouldBeDefined("navigator.startActivity");
+      
       shouldThrow("var intent = new Intent()", "'TypeError: Not enough arguments'");;
-
       shouldThrow("new Intent('a')", "'TypeError: Not enough arguments'");
       shouldThrow("new Intent('','','')", "'Error: SYNTAX_ERR: DOM Exception 12'");
       shouldThrow("new Intent('','b','c')", "'Error: SYNTAX_ERR: DOM Exception 12'");
@@ -48,6 +49,8 @@
       shouldBeNull('intent8.data');
       var intent9 = new Intent('a', 'b', {});
       shouldEvaluateTo('intent9.data', {});
+
+      shouldThrow('navigator.startActivity(intent1)', "'Error: INVALID_ACCESS_ERR: DOM Exception 15'");
 </script>
 <script src=""
 </body>

Modified: trunk/Source/WebCore/ChangeLog (104530 => 104531)


--- trunk/Source/WebCore/ChangeLog	2012-01-10 02:14:33 UTC (rev 104530)
+++ trunk/Source/WebCore/ChangeLog	2012-01-10 02:29:38 UTC (rev 104531)
@@ -1,3 +1,33 @@
+2012-01-09  Greg Billock  <[email protected]>
+
+        Implement navigator.startActivity; add IntentRequest object for managing web intents callbacks.
+        Web content will invoke navigator.startActivity to launch a new Web
+        Intents call. Each such call will map to an IntentRequest broker
+        object which is used by client code to correlate any return data to
+        the (optional) callbacks supplied by web content calls.
+        https://bugs.webkit.org/show_bug.cgi?id=75756
+
+        Reviewed by Adam Barth.
+
+        Test: webintents/web-intents-api.html
+
+        * Modules/intents/Intent.cpp: Added.
+        (WebCore::Intent::identifier):
+        (WebCore::Intent::setIdentifier):
+        * Modules/intents/Intent.h: Added.
+        * Modules/intents/Intent.idl: Added.
+        * Modules/intents/IntentResultCallback.h: Added.
+        (WebCore::IntentResultCallback::~IntentResultCallback):
+        * Modules/intents/IntentResultCallback.idl: Added.
+        * Modules/intents/IntentsRequest.cpp: Added.
+        * Modules/intents/IntentsRequest.h: Added.
+        * WebCore.gyp/WebCore.gyp:
+        * WebCore.gypi:
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GetNativeTypeForCallbacks):
+        * loader/FrameLoaderClient.h:
+        (WebCore::FrameLoaderClient::dispatchIntent):
+
 2012-01-09  Dan Bernstein  <[email protected]>
 
         -[DOMRange renderedImageForcingBlackText:] fails with non-user-selectable text

Added: trunk/Source/WebCore/Modules/intents/IntentRequest.cpp (0 => 104531)


--- trunk/Source/WebCore/Modules/intents/IntentRequest.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/intents/IntentRequest.cpp	2012-01-10 02:29:38 UTC (rev 104531)
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2012 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:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  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.
+ * 3.  Neither the name of Google, Inc. ("Google") 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 GOOGLE AND ITS 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 APPLE OR ITS 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 "IntentRequest.h"
+
+#if ENABLE(WEB_INTENTS)
+
+#include "ScriptExecutionContext.h"
+#include "SerializedScriptValue.h"
+
+namespace WebCore {
+
+PassRefPtr<IntentRequest> IntentRequest::create(ScriptExecutionContext* context,
+                                                PassRefPtr<Intent> intent,
+                                                PassRefPtr<IntentResultCallback> successCallback,
+                                                PassRefPtr<IntentResultCallback> errorCallback)
+{
+    return adoptRef(new IntentRequest(context, intent, successCallback, errorCallback));
+}
+
+IntentRequest::IntentRequest(ScriptExecutionContext* context,
+                             PassRefPtr<Intent> intent,
+                             PassRefPtr<IntentResultCallback> successCallback,
+                             PassRefPtr<IntentResultCallback> errorCallback)
+    : ActiveDOMObject(context, this)
+    , m_intent(intent)
+    , m_successCallback(successCallback)
+    , m_errorCallback(errorCallback)
+{
+    setPendingActivity(this);
+}
+
+void IntentRequest::contextDestroyed()
+{
+    ContextDestructionObserver::contextDestroyed();
+    m_successCallback.clear();
+    m_errorCallback.clear();
+}
+
+void IntentRequest::stop()
+{
+    m_successCallback.clear();
+    m_errorCallback.clear();
+}
+
+void IntentRequest::postResult(SerializedScriptValue* data)
+{
+    // Callback could lead to deletion of this.
+    RefPtr<IntentRequest> protector(this);
+
+    if (!m_successCallback)
+        return;
+
+    m_successCallback->handleEvent(data);
+
+    m_successCallback.clear();
+    m_errorCallback.clear();
+    unsetPendingActivity(this);
+}
+
+void IntentRequest::postFailure(SerializedScriptValue* data)
+{
+    // Callback could lead to deletion of this.
+    RefPtr<IntentRequest> protector(this);
+
+    if (!m_errorCallback)
+        return;
+
+    m_errorCallback->handleEvent(data);
+
+    m_successCallback.clear();
+    m_errorCallback.clear();
+    unsetPendingActivity(this);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_INTENTS)

Added: trunk/Source/WebCore/Modules/intents/IntentRequest.h (0 => 104531)


--- trunk/Source/WebCore/Modules/intents/IntentRequest.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/intents/IntentRequest.h	2012-01-10 02:29:38 UTC (rev 104531)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2012 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:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  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.
+ * 3.  Neither the name of Google, Inc. ("Google") 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 GOOGLE AND ITS 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 APPLE OR ITS 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 IntentRequest_h
+#define IntentRequest_h
+
+#if ENABLE(WEB_INTENTS)
+
+#include "ActiveDOMObject.h"
+#include "Intent.h"
+#include "IntentResultCallback.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class ScriptExecutionContext;
+
+class IntentRequest : public RefCounted<IntentRequest>, public ActiveDOMObject {
+public:
+    static PassRefPtr<IntentRequest> create(ScriptExecutionContext*, PassRefPtr<Intent>, PassRefPtr<IntentResultCallback> successCallback, PassRefPtr<IntentResultCallback> errorCallback);
+
+    Intent* intent() { return m_intent.get(); }
+
+    void postResult(SerializedScriptValue*);
+    void postFailure(SerializedScriptValue*);
+
+    virtual void contextDestroyed() OVERRIDE;
+
+    virtual void stop() OVERRIDE;
+
+private:
+    IntentRequest(ScriptExecutionContext*, PassRefPtr<Intent>, PassRefPtr<IntentResultCallback> successCallback, PassRefPtr<IntentResultCallback> errorCallback);
+
+    RefPtr<Intent> m_intent;
+    RefPtr<IntentResultCallback> m_successCallback;
+    RefPtr<IntentResultCallback> m_errorCallback;
+};
+
+} // namespace WebCore
+
+#endif
+
+#endif // IntentRequest_h

Added: trunk/Source/WebCore/Modules/intents/IntentResultCallback.h (0 => 104531)


--- trunk/Source/WebCore/Modules/intents/IntentResultCallback.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/intents/IntentResultCallback.h	2012-01-10 02:29:38 UTC (rev 104531)
@@ -0,0 +1,51 @@
+/*
+ * 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:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  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.
+ * 3.  Neither the name of Google, Inc. ("Google") 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 GOOGLE AND ITS 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 APPLE OR ITS 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 IntentResultCallback_h
+#define IntentResultCallback_h
+
+#if ENABLE(WEB_INTENTS)
+
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class SerializedScriptValue;
+
+class IntentResultCallback : public RefCounted<IntentResultCallback> {
+public:
+    virtual ~IntentResultCallback() { }
+    virtual bool handleEvent(SerializedScriptValue* result) = 0;
+};
+
+}
+
+#endif
+
+#endif // IntentResultCallback_h

Added: trunk/Source/WebCore/Modules/intents/IntentResultCallback.idl (0 => 104531)


--- trunk/Source/WebCore/Modules/intents/IntentResultCallback.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/intents/IntentResultCallback.idl	2012-01-10 02:29:38 UTC (rev 104531)
@@ -0,0 +1,33 @@
+/*
+ * 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:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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.
+ */
+
+module window {
+  interface [
+      Conditional=WEB_INTENTS,
+      Callback=FunctionOnly
+  ] IntentResultCallback {
+      boolean handleEvent(in SerializedScriptValue result);
+  };
+}

Added: trunk/Source/WebCore/Modules/intents/NavigatorIntents.cpp (0 => 104531)


--- trunk/Source/WebCore/Modules/intents/NavigatorIntents.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/intents/NavigatorIntents.cpp	2012-01-10 02:29:38 UTC (rev 104531)
@@ -0,0 +1,80 @@
+/*
+ * 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 "NavigatorIntents.h"
+
+#if ENABLE(WEB_INTENTS)
+
+#include "Document.h"
+#include "ExceptionCode.h"
+#include "Frame.h"
+#include "FrameLoader.h"
+#include "FrameLoaderClient.h"
+#include "Intent.h"
+#include "IntentRequest.h"
+#include "IntentResultCallback.h"
+#include "Navigator.h"
+#include "ScriptController.h"
+
+namespace WebCore {
+
+NavigatorIntents::NavigatorIntents()
+{
+}
+
+NavigatorIntents::~NavigatorIntents()
+{
+}
+
+void NavigatorIntents::startActivity(Navigator* navigator,
+                                     PassRefPtr<Intent> intent,
+                                     PassRefPtr<IntentResultCallback> successCallback,
+                                     PassRefPtr<IntentResultCallback> errorCallback,
+                                     ExceptionCode& ec)
+{
+    if (!navigator->frame() || !intent) {
+        ec = INVALID_STATE_ERR;
+        return;
+    }
+
+    if (intent->action().isEmpty() || intent->type().isEmpty()) {
+        ec = VALIDATION_ERR;
+        return;
+    }
+
+    if (!ScriptController::processingUserGesture()) {
+        ec = INVALID_ACCESS_ERR;
+        return;
+    }
+
+    RefPtr<IntentRequest> request = IntentRequest::create(navigator->frame()->document(),
+                                                          intent, successCallback, errorCallback);
+    navigator->frame()->loader()->client()->dispatchIntent(request);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_INTENTS)

Added: trunk/Source/WebCore/Modules/intents/NavigatorIntents.h (0 => 104531)


--- trunk/Source/WebCore/Modules/intents/NavigatorIntents.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/intents/NavigatorIntents.h	2012-01-10 02:29:38 UTC (rev 104531)
@@ -0,0 +1,54 @@
+/*
+ * 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 NavigatorIntents_h
+#define NavigatorIntents_h
+
+#if ENABLE(WEB_INTENTS)
+
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+class Intent;
+class IntentResultCallback;
+class Navigator;
+
+typedef int ExceptionCode;
+
+class NavigatorIntents {
+public:
+    static void startActivity(Navigator*, PassRefPtr<Intent>, PassRefPtr<IntentResultCallback> successCallback, PassRefPtr<IntentResultCallback> errorCallback, ExceptionCode&);
+
+private:
+    NavigatorIntents();
+    ~NavigatorIntents();
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_INTENTS)
+
+#endif // NavigatorIntents_h

Added: trunk/Source/WebCore/Modules/intents/NavigatorIntents.idl (0 => 104531)


--- trunk/Source/WebCore/Modules/intents/NavigatorIntents.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/intents/NavigatorIntents.idl	2012-01-10 02:29:38 UTC (rev 104531)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+module window {
+
+    interface [
+        Conditional=WEB_INTENTS,
+        Supplemental=Navigator
+    ] NavigatorIntents {
+        void startActivity(in Intent intent,
+                           in [Callback=FunctionOnly, Optional] IntentResultCallback successCallback,
+                           in [Callback=FunctionOnly, Optional] IntentResultCallback failureCallback)
+            raises(DOMException);
+    };
+
+}

Modified: trunk/Source/WebCore/WebCore.gypi (104530 => 104531)


--- trunk/Source/WebCore/WebCore.gypi	2012-01-10 02:14:33 UTC (rev 104530)
+++ trunk/Source/WebCore/WebCore.gypi	2012-01-10 02:29:38 UTC (rev 104531)
@@ -1150,6 +1150,8 @@
             'Modules/gamepad/GamepadList.idl',
             'Modules/gamepad/NavigatorGamepad.idl',
             'Modules/intents/Intent.idl',
+            'Modules/intents/IntentResultCallback.idl',
+            'Modules/intents/NavigatorIntents.idl',
             'css/CSSCharsetRule.idl',
             'css/CSSFontFaceRule.idl',
             'css/CSSImportRule.idl',
@@ -1698,6 +1700,11 @@
             'Modules/gamepad/NavigatorGamepad.h',
             'Modules/intents/Intent.cpp',
             'Modules/intents/Intent.h',
+            'Modules/intents/IntentRequest.cpp',
+            'Modules/intents/IntentRequest.h',
+            'Modules/intents/IntentResultCallback.h',
+            'Modules/intents/NavigatorIntents.cpp',
+            'Modules/intents/NavigatorIntents.h',
             'accessibility/AXObjectCache.cpp',
             'accessibility/AccessibilityARIAGrid.cpp',
             'accessibility/AccessibilityARIAGrid.h',

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (104530 => 104531)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-01-10 02:14:33 UTC (rev 104530)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-01-10 02:29:38 UTC (rev 104531)
@@ -3405,6 +3405,7 @@
 {
     my $type = shift;
     return "const String&" if $type eq "DOMString";
+    return "SerializedScriptValue*" if $type eq "SerializedScriptValue";
 
     # Callbacks use raw pointers, so pass isParameter = 1
     return GetNativeType($type, 1);

Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (104530 => 104531)


--- trunk/Source/WebCore/loader/FrameLoaderClient.h	2012-01-10 02:14:33 UTC (rev 104530)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h	2012-01-10 02:29:38 UTC (rev 104531)
@@ -78,6 +78,9 @@
 #endif
     class HTMLPlugInElement;
     class IntSize;
+#if ENABLE(WEB_INTENTS)
+    class IntentRequest;
+#endif
     class KURL;
     class MessageEvent;
     class NavigationAction;
@@ -323,6 +326,10 @@
 
         // Returns true if the embedder intercepted the postMessage call
         virtual bool willCheckAndDispatchMessageEvent(SecurityOrigin* /*target*/, MessageEvent*) const { return false; }
+
+#if ENABLE(WEB_INTENTS)
+        virtual void dispatchIntent(PassRefPtr<IntentRequest> intentRequest) { }
+#endif
     };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to