Source/WebCore/ChangeLog

 12011-11-23 Greg Billock <gbillock@google.com>
 2
 3 [Web Intents] Flagged-off WebCore implementation of navigator.startActivity
 4 See http://www.chromium.org/developers/design-documents/webintentsapi
 5 for draft spec.
 6
 7 https://bugs.webkit.org/show_bug.cgi?id=73051
 8
 9 Reviewed by NOBODY (OOPS!).
 10
 11 No new tests. (OOPS!)
 12
 13 * WebCore.gypi:
 14 * bindings/v8/custom/V8IntentCustom.cpp: Added.
 15 (WebCore::V8Intent::constructorCallback):
 16 (WebCore::V8Intent::dataAccessorGetter):
 17 * loader/FrameLoaderClient.h:
 18 (WebCore::FrameLoaderClient::dispatchIntent):
 19 * page/DOMWindow.idl:
 20 * page/Intent.cpp: Added.
 21 (WebCore::Intent::Intent):
 22 (WebCore::Intent::action):
 23 (WebCore::Intent::setAction):
 24 (WebCore::Intent::type):
 25 (WebCore::Intent::setType):
 26 (WebCore::Intent::data):
 27 (WebCore::Intent::setData):
 28 * page/Intent.h: Added.
 29 (WebCore::Intent::create):
 30 * page/Intent.idl: Added.
 31 * page/IntentResultCallback.h: Added.
 32 (WebCore::IntentResultCallback::~IntentResultCallback):
 33 * page/IntentResultCallback.idl: Added.
 34 * page/IntentsController.cpp: Added.
 35 (WebCore::IntentsController::IntentsController):
 36 (WebCore::IntentsController::~IntentsController):
 37 (WebCore::IntentsController::getIntentId):
 38 (WebCore::IntentsController::postResult):
 39 (WebCore::IntentsController::postFailure):
 40 * page/IntentsController.h: Added.
 41 * page/Navigator.cpp:
 42 (WebCore::Navigator::startActivity):
 43 * page/Navigator.h:
 44 * page/Navigator.idl:
 45 * page/Page.cpp:
 46 (WebCore::Page::Page):
 47 * page/Page.h:
 48 (WebCore::Page::intentsController):
 49
1502011-11-25 Yury Semikhatsky <yurys@chromium.org>
251
352 [Chromium] Web Inspector: get rid of WebDevToolsFrontendClient::sendFrontendLoaded method

Source/WebKit/chromium/ChangeLog

 12011-11-23 Greg Billock <gbillock@google.com>
 2
 3 [Web Intents] Flagged-off WebCore implementation of navigator.startActivity
 4 https://bugs.webkit.org/show_bug.cgi?id=73051
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * WebKit.gyp:
 9 * features.gypi:
 10 * public/WebIntent.h:
 11 * src/FrameLoaderClientImpl.cpp:
 12 (WebKit::FrameLoaderClientImpl::dispatchIntent):
 13 * src/FrameLoaderClientImpl.h:
 14 * src/WebFrameImpl.cpp:
 15 (WebKit::WebFrameImpl::handleIntentResult):
 16 (WebKit::WebFrameImpl::handleIntentFailure):
 17 * src/WebIntent.cpp: Copied from Source/WebKit/chromium/public/WebIntent.h.
 18 (WebKit::WebIntent::WebIntent):
 19
1202011-11-25 Yury Semikhatsky <yurys@chromium.org>
221
322 Unreviewed. Chromium build fix.

522541 Reviewed by Darin Fisher.
523542
524543 * WebKit.gyp:
525  * public/WebIntent.h: Added.
526  * public/WebIntentServiceInfo.h: Added.
527  * public/WebFrame.h:
528  * public/WebFrameClient.h:
 544 * public/WebIntentsClient.h: Added.
 545 (WebKit::WebIntentsClient::~WebIntentsClient):
 546 * public/WebIntentsController.h: Added.
 547 * public/WebViewClient.h:
 548 (WebKit::WebViewClient::webIntentsClient):
 549 * src/WebIntentsController.cpp: Added.
 550 (WebKit::WebIntentsController::webIntentReply):
529551
5305522011-11-22 Scott Graham <scottmg@chromium.org>
531553

Source/WebCore/Modules/intents/Intent.cpp

 1/*
 2 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 * 3. Neither the name of Google, Inc. ("Google") nor the names of
 14 * its contributors may be used to endorse or promote products derived
 15 * from this software without specific prior written permission.
 16 *
 17 * THIS SOFTWARE IS PROVIDED BY GOOGLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 27 */
 28
 29#include "config.h"
 30#include "Intent.h"
 31
 32#if ENABLE(WEB_INTENTS)
 33
 34#include "SerializedScriptValue.h"
 35
 36namespace WebCore {
 37
 38
 39Intent::Intent(String action, String type, PassRefPtr<SerializedScriptValue> data)
 40 : m_action(action),
 41 m_type(type)
 42{
 43 setData(data);
 44}
 45
 46String Intent::action() const
 47{
 48 return m_action;
 49}
 50
 51String Intent::type() const
 52{
 53 return m_type;
 54}
 55
 56SerializedScriptValue* Intent::data() const
 57{
 58 return m_data.get();
 59}
 60
 61void Intent::setData(PassRefPtr<SerializedScriptValue> data)
 62{
 63 if (data.get())
 64 m_data = SerializedScriptValue::createFromWire(data->toWireString());
 65 else
 66 m_data = SerializedScriptValue::nullValue();
 67}
 68
 69} // namespace WebCore
 70
 71#endif // ENABLE(WEB_INTENTS)

Source/WebCore/Modules/intents/Intent.h

 1/*
 2 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 * 3. Neither the name of Google, Inc. ("Google") nor the names of
 14 * its contributors may be used to endorse or promote products derived
 15 * from this software without specific prior written permission.
 16 *
 17 * THIS SOFTWARE IS PROVIDED BY GOOGLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 27 */
 28
 29#ifndef Intent_h
 30#define Intent_h
 31
 32#if ENABLE(WEB_INTENTS)
 33
 34#include <wtf/Forward.h>
 35#include <wtf/PassRefPtr.h>
 36#include <wtf/RefCounted.h>
 37#include <wtf/RefPtr.h>
 38#include <wtf/text/WTFString.h>
 39
 40namespace WebCore {
 41
 42class SerializedScriptValue;
 43
 44class Intent : public RefCounted<Intent> {
 45public:
 46 static PassRefPtr<Intent> create(
 47 const String& action,
 48 const String& type,
 49 PassRefPtr<SerializedScriptValue> data) {
 50 return adoptRef(new Intent(action, type, data));
 51 }
 52
 53 String action() const;
 54 String type() const;
 55 SerializedScriptValue* data() const;
 56
 57protected:
 58 Intent(String action, String type, PassRefPtr<SerializedScriptValue> data);
 59
 60private:
 61 void setData(PassRefPtr<SerializedScriptValue>);
 62
 63 String m_action;
 64 String m_type;
 65 RefPtr<SerializedScriptValue> m_data;
 66};
 67
 68} // namespace WebCore
 69
 70#endif
 71
 72#endif // Intent_h

Source/WebCore/Modules/intents/Intent.idl

 1/*
 2 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 *
 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26module window {
 27 interface [
 28 Conditional=WEB_INTENTS,
 29 CanBeConstructed,
 30 CustomConstructFunction,
 31 V8CustomConstructor,
 32 ] Intent {
 33 readonly attribute DOMString action;
 34 readonly attribute DOMString type;
 35 readonly attribute [CustomGetter] any data;
 36 };
 37}

Source/WebCore/Modules/intents/IntentResultCallback.h

 1/*
 2 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 * 3. Neither the name of Google, Inc. ("Google") nor the names of
 14 * its contributors may be used to endorse or promote products derived
 15 * from this software without specific prior written permission.
 16 *
 17 * THIS SOFTWARE IS PROVIDED BY GOOGLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 27 */
 28
 29#ifndef IntentResultCallback_h
 30#define IntentResultCallback_h
 31
 32#include <wtf/RefPtr.h>
 33#include <wtf/ThreadSafeRefCounted.h>
 34
 35#if ENABLE(WEB_INTENTS)
 36
 37namespace WebCore {
 38
 39class SerializedScriptValue;
 40
 41class IntentResultCallback : public ThreadSafeRefCounted<IntentResultCallback> {
 42public:
 43 virtual ~IntentResultCallback() { }
 44 virtual bool handleEvent(RefPtr<SerializedScriptValue> result) = 0;
 45};
 46
 47}
 48
 49#endif
 50
 51#endif // IntentResultCallback_h

Source/WebCore/Modules/intents/IntentResultCallback.idl

 1/*
 2 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 *
 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26module window {
 27 interface [
 28 Conditional=WEB_INTENTS,
 29 LegacyDefaultOptionalArguments,
 30 Callback=FunctionOnly
 31 ] IntentResultCallback {
 32 boolean handleEvent(in SerializedScriptValue result);
 33 };
 34}

Source/WebCore/WebCore.gyp/WebCore.gyp

4949 '../',
5050 '../..',
5151 '../Modules/gamepad',
 52 '../Modules/intents',
5253 '../accessibility',
5354 '../accessibility/chromium',
5455 '../bindings',

Source/WebCore/WebCore.gypi

11331133 'webcore_bindings_idl_files': [
11341134 'Modules/gamepad/Gamepad.idl',
11351135 'Modules/gamepad/GamepadList.idl',
 1136 'Modules/intents/Intent.idl',
 1137 'Modules/intents/IntentResultCallback.idl',
11361138 'css/CSSCharsetRule.idl',
11371139 'css/CSSFontFaceRule.idl',
11381140 'css/CSSImportRule.idl',

16741676 'Modules/gamepad/Gamepad.h',
16751677 'Modules/gamepad/GamepadList.cpp',
16761678 'Modules/gamepad/GamepadList.h',
 1679 'Modules/intents/Intent.cpp',
 1680 'Modules/intents/Intent.h',
 1681 'Modules/intents/IntentResultCallback.h',
16771682 'accessibility/AXObjectCache.cpp',
16781683 'accessibility/AccessibilityARIAGrid.cpp',
16791684 'accessibility/AccessibilityARIAGrid.h',

22232228 'bindings/v8/custom/V8Int16ArrayCustom.cpp',
22242229 'bindings/v8/custom/V8Int32ArrayCustom.cpp',
22252230 'bindings/v8/custom/V8Int8ArrayCustom.cpp',
 2231 'bindings/v8/custom/V8IntentCustom.cpp',
22262232 'bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp',
22272233 'bindings/v8/custom/V8LocationCustom.cpp',
22282234 'bindings/v8/custom/V8MessageChannelConstructor.cpp',

29712977 'page/GroupSettings.cpp',
29722978 'page/History.cpp',
29732979 'page/History.h',
 2980 'page/IntentsController.cpp',
 2981 'page/IntentsController.h',
29742982 'page/Location.cpp',
29752983 'page/Location.h',
29762984 'page/MemoryInfo.cpp',

Source/WebCore/bindings/v8/custom/V8IntentCustom.cpp

 1/*
 2 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions are
 6 * met:
 7 *
 8 * * Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * * Redistributions in binary form must reproduce the above
 11 * copyright notice, this list of conditions and the following disclaimer
 12 * in the documentation and/or other materials provided with the
 13 * distribution.
 14 * * Neither the name of Google Inc. nor the names of its
 15 * contributors may be used to endorse or promote products derived from
 16 * this software without specific prior written permission.
 17 *
 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 29 */
 30
 31#include "config.h"
 32
 33#if ENABLE(WEB_INTENTS)
 34
 35#include "V8Intent.h"
 36
 37#include "SerializedScriptValue.h"
 38#include "V8Binding.h"
 39#include "V8DOMWrapper.h"
 40#include "V8Proxy.h"
 41#include "WrapperTypeInfo.h"
 42
 43#include <wtf/MathExtras.h>
 44
 45namespace WebCore {
 46
 47v8::Handle<v8::Value> V8Intent::constructorCallback(const v8::Arguments& args)
 48{
 49 INC_STATS("Intent.Constructor");
 50
 51 if (!args.IsConstructCall())
 52 return throwError("DOM object constructor cannot be called as a function.");
 53
 54 if (args.Length() == 0) {
 55 RefPtr<Intent> intent = Intent::create(String(), String(), SerializedScriptValue::nullValue());
 56 V8DOMWrapper::setDOMWrapper(args.Holder(), &info, intent.get());
 57 return toV8(intent.release(), args.Holder());
 58 }
 59
 60 if (args.Length() == 2) {
 61 String action = toWebCoreStringWithNullOrUndefinedCheck(args[0]);
 62 String type = toWebCoreStringWithNullOrUndefinedCheck(args[1]);
 63
 64 if (action.isEmpty())
 65 return throwError("Action cannot be empty");
 66 if (type.isEmpty())
 67 return throwError("Type cannot be empty");
 68
 69 RefPtr<Intent> intent = Intent::create(action, type, SerializedScriptValue::nullValue());
 70 V8DOMWrapper::setDOMWrapper(args.Holder(), &info, intent.get());
 71 return toV8(intent.release(), args.Holder());
 72 }
 73
 74 if (args.Length() == 3) {
 75 String action = toWebCoreStringWithNullOrUndefinedCheck(args[0]);
 76 String type = toWebCoreStringWithNullOrUndefinedCheck(args[1]);
 77
 78 if (action.isEmpty())
 79 return throwError("Action cannot be empty");
 80 if (type.isEmpty())
 81 return throwError("Type cannot be empty");
 82
 83 bool exception = false;
 84 RefPtr<SerializedScriptValue> data = SerializedScriptValue::create(args[2], 0, 0, exception);
 85 if (exception)
 86 return throwError("Intent constructor data must be a structured clone");
 87
 88 RefPtr<Intent> intent = Intent::create(action, type, data);
 89 V8DOMWrapper::setDOMWrapper(args.Holder(), &info, intent.get());
 90 return toV8(intent.release(), args.Holder());
 91 }
 92
 93 return throwError("Intent constructor must have zero or two or three parameters");
 94}
 95
 96v8::Handle<v8::Value> V8Intent::dataAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
 97{
 98 Intent* impl = V8Intent::toNative(info.Holder());
 99
 100 SerializedScriptValue* serializedValue = impl->data();
 101 if (serializedValue)
 102 return serializedValue->deserialize();
 103
 104 return v8::Undefined();
 105}
 106
 107} // namespace WebCore
 108
 109#endif // ENABLE(WEB_INTENTS)

Source/WebCore/loader/FrameLoaderClient.h

@@namespace WebCore {
7878#endif
7979 class HTMLPlugInElement;
8080 class IntSize;
 81#if ENABLE(WEB_INTENTS)
 82 class Intent;
 83#endif
8184 class KURL;
8285 class NavigationAction;
8386 class Page;

@@namespace WebCore {
319322 virtual PassRefPtr<FrameNetworkingContext> createNetworkingContext() = 0;
320323
321324 virtual bool shouldPaintBrokenImage(const KURL&) const { return true; }
 325
 326#if ENABLE(WEB_INTENTS)
 327 virtual void dispatchIntent(const Intent& intent, int id) { }
 328#endif
322329 };
323330
324331} // namespace WebCore

Source/WebCore/page/DOMWindow.idl

@@module window {
618618 attribute [EnabledAtRuntime=webkitVideoTrack] TrackEventConstructor TrackEvent;
619619#endif
620620
 621#if defined(ENABLE_WEB_INTENTS) && ENABLE_WEB_INTENTS
 622 attribute IntentConstructor Intent; // Usable with the new operator
 623#endif
 624
621625 attribute DOMPluginConstructor Plugin;
622626 attribute DOMPluginArrayConstructor PluginArray;
623627

Source/WebCore/page/IntentsController.cpp

 1/*
 2 * Copyright (C) 2010 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 *
 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#include "config.h"
 27#include "IntentsController.h"
 28
 29#if ENABLE(WEB_INTENTS)
 30
 31#include "IntentResultCallback.h"
 32#include "SerializedScriptValue.h"
 33
 34namespace WebCore {
 35
 36IntentsController::IntentsController()
 37{
 38}
 39
 40IntentsController::~IntentsController()
 41{
 42}
 43
 44int IntentsController::assignIntentId(PassRefPtr<IntentResultCallback> successCallback, PassRefPtr<IntentResultCallback> errorCallback)
 45{
 46 int id = m_successCallbacks.size();
 47 m_successCallbacks.append(successCallback);
 48 m_errorCallbacks.append(errorCallback);
 49 return id;
 50}
 51
 52void IntentsController::postResult(String& data, int intentId)
 53{
 54 RefPtr<SerializedScriptValue> value = SerializedScriptValue::createFromWire(data);
 55 if (m_successCallbacks[intentId].get())
 56 m_successCallbacks[intentId]->handleEvent(value);
 57
 58 m_successCallbacks[intentId].clear();
 59 m_errorCallbacks[intentId].clear();
 60}
 61
 62void IntentsController::postFailure(String& data, int intentId)
 63{
 64 RefPtr<SerializedScriptValue> value = SerializedScriptValue::createFromWire(data);
 65 if (m_errorCallbacks[intentId].get())
 66 m_errorCallbacks[intentId]->handleEvent(value);
 67
 68 m_successCallbacks[intentId].clear();
 69 m_errorCallbacks[intentId].clear();
 70}
 71
 72} // namespace WebCore
 73
 74#endif // ENABLE(WEB_INTENTS)

Source/WebCore/page/IntentsController.h

 1/*
 2 * Copyright (C) 2010 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 *
 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#ifndef IntentsController_h
 27#define IntentsController_h
 28
 29#if ENABLE(WEB_INTENTS)
 30
 31#include <wtf/Forward.h>
 32#include <wtf/PassRefPtr.h>
 33#include <wtf/Vector.h>
 34
 35namespace WebCore {
 36
 37class IntentResultCallback;
 38
 39class IntentsController {
 40public:
 41 IntentsController();
 42 ~IntentsController();
 43
 44 int assignIntentId(PassRefPtr<IntentResultCallback> successCallback, PassRefPtr<IntentResultCallback> errorCallback);
 45
 46 void postResult(String& data, int intentId);
 47 void postFailure(String& data, int intentId);
 48
 49private:
 50 Vector<RefPtr<IntentResultCallback> > m_successCallbacks;
 51 Vector<RefPtr<IntentResultCallback> > m_errorCallbacks;
 52};
 53
 54} // namespace WebCore
 55
 56#endif // ENABLE(WEB_INTENTS)
 57
 58#endif // IntentsController_h

Source/WebCore/page/Navigator.cpp

3333#include "FrameLoader.h"
3434#include "FrameLoaderClient.h"
3535#include "Geolocation.h"
 36#include "Intent.h"
 37#include "IntentResultCallback.h"
 38#include "IntentsController.h"
3639#include "PointerLock.h"
3740#include "KURL.h"
3841#include "Language.h"

@@GamepadList* Navigator::webkitGamepads()
319322}
320323#endif
321324
 325#if ENABLE(WEB_INTENTS)
 326void Navigator::startActivity(PassRefPtr<Intent> intent, PassRefPtr<IntentResultCallback> successCallback, PassRefPtr<IntentResultCallback> errorCallback, ExceptionCode& ec)
 327{
 328 if (!frame() || !frame()->loader() || !frame()->loader()->client() || !intent.get()) {
 329 ec = INVALID_STATE_ERR;
 330 return;
 331 }
 332
 333 if (intent->action().isEmpty() || intent->type().isEmpty()) {
 334 ec = VALIDATION_ERR;
 335 return;
 336 }
 337
 338 if (!ScriptController::processingUserGesture()) {
 339 ec = INVALID_ACCESS_ERR;
 340 return;
 341 }
 342
 343 int id = m_frame->page()->intentsController()->assignIntentId(successCallback, errorCallback);
 344 m_frame->loader()->client()->dispatchIntent(*intent, id);
 345}
 346#endif
 347
322348} // namespace WebCore

Source/WebCore/page/Navigator.h

@@class DOMPluginArray;
3333class Frame;
3434class GamepadList;
3535class Geolocation;
 36class Intent;
 37class IntentResultCallback;
3638class PointerLock;
3739class NavigatorUserMediaErrorCallback;
3840class NavigatorUserMediaSuccessCallback;

@@public:
7981 GamepadList* webkitGamepads();
8082#endif
8183
 84#if ENABLE(WEB_INTENTS)
 85 void startActivity(PassRefPtr<Intent>, PassRefPtr<IntentResultCallback> successCallback, PassRefPtr<IntentResultCallback> errorCallback, ExceptionCode&);
 86#endif
 87
8288private:
8389 Navigator(Frame*);
8490 Frame* m_frame;

Source/WebCore/page/Navigator.idl

@@module window {
6565#if defined(ENABLE_GAMEPAD) && ENABLE_GAMEPAD
6666 readonly attribute [EnabledAtRuntime] GamepadList webkitGamepads;
6767#endif
 68
 69#if defined(ENABLE_WEB_INTENTS) && ENABLE_WEB_INTENTS
 70 void startActivity(in Intent intent, in [Callback, Optional] IntentResultCallback successCallback, in [Callback, Optional] IntentResultCallback failureCallback)
 71 raises(DOMException);
 72#endif
6873 };
6974
7075}

Source/WebCore/page/Page.cpp

4949#include "HistoryItem.h"
5050#include "InspectorController.h"
5151#include "InspectorInstrumentation.h"
 52#include "IntentsController.h"
5253#include "Logging.h"
5354#include "MediaCanStartListener.h"
5455#include "Navigator.h"

@@Page::Page(PageClients& pageClients)
143144#if ENABLE(MEDIA_STREAM)
144145 , m_userMediaClient(pageClients.userMediaClient)
145146#endif
 147#if ENABLE(WEB_INTENTS)
 148 , m_intentsController(adoptPtr(new IntentsController()))
 149#endif
146150 , m_settings(adoptPtr(new Settings(this)))
147151 , m_progress(adoptPtr(new ProgressTracker))
148152 , m_backForwardController(adoptPtr(new BackForwardController(this, pageClients.backForwardClient)))

Source/WebCore/page/Page.h

@@namespace WebCore {
7070 class HistoryItem;
7171 class InspectorClient;
7272 class InspectorController;
 73 class IntentsController;
7374 class MediaCanStartListener;
7475 class Node;
7576 class PageGroup;

@@namespace WebCore {
189190#if ENABLE(MEDIA_STREAM)
190191 UserMediaClient* userMediaClient() const { return m_userMediaClient; }
191192#endif
 193#if ENABLE(WEB_INTENTS)
 194 IntentsController* intentsController() const { return m_intentsController.get(); }
 195#endif
192196 Settings* settings() const { return m_settings.get(); }
193197 ProgressTracker* progress() const { return m_progress.get(); }
194198 BackForwardController* backForward() const { return m_backForwardController.get(); }

@@namespace WebCore {
372376#if ENABLE(MEDIA_STREAM)
373377 UserMediaClient* m_userMediaClient;
374378#endif
 379#if ENABLE(WEB_INTENTS)
 380 OwnPtr<IntentsController> m_intentsController;
 381#endif
375382 OwnPtr<Settings> m_settings;
376383 OwnPtr<ProgressTracker> m_progress;
377384

Source/WebKit/chromium/features.gypi

154154 'ENABLE_REGISTER_PROTOCOL_HANDLER=1',
155155 ],
156156 }],
 157 ['enable_web_intents==1', {
 158 'feature_defines': [
 159 'ENABLE_WEB_INTENTS=1',
 160 ],
 161 }],
157162 ['OS=="mac"', {
158163 'feature_defines': [
159164 'ENABLE_RUBBER_BANDING=1',

Source/WebKit/chromium/public/WebIntent.h

3434#include "WebCommon.h"
3535#include "WebString.h"
3636
 37#if WEBKIT_IMPLEMENTATION
 38namespace WebCore { class Intent; }
 39#endif
 40
3741namespace WebKit {
3842
3943// Holds data passed through a Web Intents invocation call from the Javascript

@@public:
5761
5862#if WEBKIT_IMPLEMENTATION
5963 WebIntent();
 64 WebIntent(const WebCore::Intent&, int identifier);
6065#endif
6166
6267private:

Source/WebKit/chromium/public/WebIntentServiceInfo.h

@@public:
6868
6969#if WEBKIT_IMPLEMENTATION
7070 WebIntentServiceInfo();
 71 WebIntentServiceInfo(const WebString& action, const WebString& type, const WebURL& href,
 72 const WebString& title, const WebString& disposition);
7173#endif
7274
7375private:

Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp

6464#include "WebFormElement.h"
6565#include "WebFrameClient.h"
6666#include "WebFrameImpl.h"
 67#include "WebIntent.h"
6768#include "WebKit.h"
6869#include "WebKitPlatformSupport.h"
6970#include "WebMimeRegistry.h"

@@PassRefPtr<FrameNetworkingContext> FrameLoaderClientImpl::createNetworkingContex
16171618 return FrameNetworkingContextImpl::create(m_webFrame->frame());
16181619}
16191620
 1621void FrameLoaderClientImpl::dispatchIntent(const WebCore::Intent& intent, int intentId)
 1622{
 1623 WebIntent webIntent(intent, intentId);
 1624 m_webFrame->client()->dispatchIntent(webFrame(), webIntent);
 1625}
 1626
16201627} // namespace WebKit

Source/WebKit/chromium/src/FrameLoaderClientImpl.h

@@public:
208208
209209 virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext();
210210
 211 virtual void dispatchIntent(const WebCore::Intent&, int intentId);
 212
211213private:
212214 void makeDocumentView();
213215

Source/WebKit/chromium/src/WebFrameImpl.cpp

104104#include "HitTestResult.h"
105105#include "IconURL.h"
106106#include "InspectorController.h"
 107#include "IntentsController.h"
107108#include "KURL.h"
108109#include "Page.h"
109110#include "PageOverlay.h"

@@void WebFrameImpl::resetMatchCount()
18281829
18291830void WebFrameImpl::handleIntentResult(int intentIdentifier, const WebString& reply)
18301831{
 1832 if (!m_frame)
 1833 return;
 1834
 1835#if ENABLE(WEB_INTENTS)
 1836 WTF::String replyString = reply.operator String();
 1837 m_frame->page()->intentsController()->postResult(replyString, intentIdentifier);
 1838#endif
18311839}
18321840
18331841void WebFrameImpl::handleIntentFailure(int intentIdentifier, const WebString& reply)
18341842{
 1843 if (!m_frame)
 1844 return;
 1845
 1846#if ENABLE(WEB_INTENTS)
 1847 WTF::String replyString = reply.operator String();
 1848 m_frame->page()->intentsController()->postFailure(replyString, intentIdentifier);
 1849#endif
18351850}
18361851
18371852WebString WebFrameImpl::contentAsText(size_t maxChars) const

Source/WebKit/chromium/src/WebIntent.cpp

3131#include "config.h"
3232#include "WebIntent.h"
3333
 34#include "Intent.h"
 35#include "SerializedScriptValue.h"
 36
3437namespace WebKit {
3538
3639WebIntent::WebIntent() { }
3740
 41WebIntent::WebIntent(const WebCore::Intent& intent, int identifier)
 42 : m_action(intent.action()),
 43 m_type(intent.type()),
 44 m_data(intent.data()->toWireString()),
 45 m_identifier(identifier) { }
 46
3847WebString WebIntent::action() const
3948{
4049 return m_action;

Source/WebKit/chromium/src/WebIntentServiceInfo.cpp

@@namespace WebKit {
3535
3636WebIntentServiceInfo::WebIntentServiceInfo() { }
3737
 38WebIntentServiceInfo::WebIntentServiceInfo(const WebString& action,
 39 const WebString& type,
 40 const WebURL& href,
 41 const WebString& title,
 42 const WebString& disposition)
 43 : m_action(action),
 44 m_type(type),
 45 m_href(href),
 46 m_title(title),
 47 m_disposition(disposition) { }
 48
3849WebURL WebIntentServiceInfo::url() const
3950{
4051 return m_href;