Changeset 117384 in webkit
- Timestamp:
- May 16, 2012 8:17:02 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 18 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r117383 r117384 1 2012-05-16 Greg Billock <gbillock@google.com> 2 3 IDL and implementation for Web Intents delivery 4 https://bugs.webkit.org/show_bug.cgi?id=83634 5 6 Reviewed by Adam Barth. 7 8 The delivered intent has some extra fields and methods (extras, 9 postResult, postFailure) from the invocation intent. It is implemented 10 as a subclass. Responses from the service JS are passed to an embedder 11 client object provided when the intent is delivered. 12 See http://dvcs.w3.org/hg/web-intents/raw-file/tip/spec/Overview.html 13 Test: webintents/web-intents-delivery.html 14 15 * Modules/intents/DOMWindowIntents.cpp: Copied from Source/WebCore/Modules/intents/DOMWindowIntents.idl. 16 (WebCore): 17 (WebCore::DOMWindowIntents::DOMWindowIntents): 18 (WebCore::DOMWindowIntents::~DOMWindowIntents): 19 (WebCore::DOMWindowIntents::from): 20 (WebCore::DOMWindowIntents::webkitIntent): 21 (WebCore::DOMWindowIntents::deliver): 22 * Modules/intents/DOMWindowIntents.h: Copied from Source/WebCore/Modules/intents/DOMWindowIntents.idl. 23 (WebCore): 24 (DOMWindowIntents): 25 * Modules/intents/DOMWindowIntents.idl: 26 * Modules/intents/DeliveredIntent.cpp: Copied from Source/WebCore/Modules/intents/Intent.h. 27 (WebCore): 28 (WebCore::DeliveredIntent::create): 29 (WebCore::DeliveredIntent::DeliveredIntent): 30 (WebCore::DeliveredIntent::ports): 31 (WebCore::DeliveredIntent::getExtra): 32 (WebCore::DeliveredIntent::postResult): 33 (WebCore::DeliveredIntent::postFailure): 34 * Modules/intents/DeliveredIntent.h: Copied from Source/WebCore/Modules/intents/Intent.h. 35 (WebCore): 36 (DeliveredIntent): 37 (WebCore::DeliveredIntent::~DeliveredIntent): 38 * Modules/intents/DeliveredIntent.idl: Copied from Source/WebCore/Modules/intents/Intent.h. 39 * Modules/intents/Intent.h: 40 (WebCore::Intent::~Intent): 41 (Intent): 42 * WebCore.gyp/WebCore.gyp: 43 * WebCore.gypi: 44 * bindings/v8/custom/V8DeliveredIntentCustom.cpp: Copied from Source/WebCore/Modules/intents/Intent.h. 45 (WebCore): 46 (WebCore::V8DeliveredIntent::portsAccessorGetter): 47 1 48 2012-05-16 Kentaro Hara <haraken@chromium.org> 2 49 -
trunk/Source/WebCore/Modules/intents/DOMWindowIntents.h
r117383 r117384 25 25 */ 26 26 27 module window { 27 #ifndef DOMWindowIntents_h 28 #define DOMWindowIntents_h 28 29 29 interface [ 30 Conditional=WEB_INTENTS, 31 Supplemental=DOMWindow 32 ] DOMWindowIntents { 33 attribute IntentConstructor WebKitIntent; 34 }; 30 #if ENABLE(WEB_INTENTS) 35 31 36 } 32 #include "DOMWindowProperty.h" 33 #include "Supplementable.h" 34 35 namespace WebCore { 36 37 class DOMWindow; 38 class DeliveredIntent; 39 40 class DOMWindowIntents : public DOMWindowProperty, public Supplement<DOMWindow> { 41 public: 42 virtual ~DOMWindowIntents(); 43 static DOMWindowIntents* from(DOMWindow*); 44 45 static DeliveredIntent* webkitIntent(DOMWindow*); 46 47 void deliver(PassRefPtr<DeliveredIntent>); 48 49 private: 50 explicit DOMWindowIntents(DOMWindow*); 51 52 DeliveredIntent* webkitIntent(); 53 54 RefPtr<DeliveredIntent> m_intent; 55 }; 56 57 } // namespace WebCore 58 59 #endif // ENABLE(WEB_INTENTS) 60 61 #endif // DOMWindowIntents_h -
trunk/Source/WebCore/Modules/intents/DOMWindowIntents.idl
r113282 r117384 32 32 ] DOMWindowIntents { 33 33 attribute IntentConstructor WebKitIntent; 34 35 readonly attribute [Replaceable] DeliveredIntent webkitIntent; 34 36 }; 35 37 -
trunk/Source/WebCore/Modules/intents/DeliveredIntent.h
r117383 r117384 27 27 */ 28 28 29 #ifndef Intent_h30 #define Intent_h29 #ifndef DeliveredIntent_h 30 #define DeliveredIntent_h 31 31 32 32 #if ENABLE(WEB_INTENTS) 33 33 34 #include " Dictionary.h"35 #include " KURL.h"34 #include "FrameDestructionObserver.h" 35 #include "Intent.h" 36 36 #include "MessagePort.h" 37 #include "MessagePortChannel.h"38 #include "ScriptState.h"39 37 #include <wtf/Forward.h> 38 #include <wtf/HashMap.h> 40 39 #include <wtf/PassRefPtr.h> 41 40 #include <wtf/RefCounted.h> … … 45 44 namespace WebCore { 46 45 46 class Frame; 47 47 class SerializedScriptValue; 48 48 49 typedef int ExceptionCode; 49 // JS calls to postResult/postFailure on DeliveredIntent will be forwarded 50 // to this client interface. The object is owned by the DeliveredIntent to 51 // which it is attached, and will be deleted when the delivered intent will issue 52 // no further calls to it. Before that point, the destroy() method is invoked. 53 class DeliveredIntentClient { 54 public: 55 virtual ~DeliveredIntentClient() { } 50 56 51 class Intent : public RefCounted<Intent> { 57 virtual void postResult(PassRefPtr<SerializedScriptValue> data) = 0; 58 virtual void postFailure(PassRefPtr<SerializedScriptValue> data) = 0; 59 }; 60 61 class DeliveredIntent : public Intent, public FrameDestructionObserver { 52 62 public: 53 static PassRefPtr<Intent> create(const String& action, const String& type, PassRefPtr<SerializedScriptValue> data, const MessagePortArray& ports, ExceptionCode&); 54 static PassRefPtr<Intent> create(ScriptState*, const Dictionary&, ExceptionCode&); 63 static PassRefPtr<DeliveredIntent> create(Frame*, PassOwnPtr<DeliveredIntentClient>, const String& action, const String& type, 64 PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortArray>, 65 const HashMap<String, String>&); 55 66 56 const String& action() const { return m_action; } 57 const String& type() const { return m_type; } 58 SerializedScriptValue* data() const { return m_data.get(); } 67 virtual ~DeliveredIntent() { } 59 68 60 MessagePortChannelArray* messagePorts() const { return m_ports.get(); } 61 const KURL& service() const { return m_service; } 62 const WTF::HashMap<String, String>& extras() const { return m_extras; } 69 MessagePortArray* ports() const; 70 String getExtra(const String& key); 71 void postResult(PassRefPtr<SerializedScriptValue> data); 72 void postFailure(PassRefPtr<SerializedScriptValue> data); 63 73 64 protected: 65 Intent(const String& action, const String& type, 66 PassRefPtr<SerializedScriptValue> data, PassOwnPtr<MessagePortChannelArray> ports, 67 const WTF::HashMap<String, String>& extras, const KURL& service); 74 void setClient(PassRefPtr<DeliveredIntentClient>); 75 76 virtual void frameDestroyed() OVERRIDE; 68 77 69 78 private: 79 DeliveredIntent(Frame*, PassOwnPtr<DeliveredIntentClient>, const String& action, const String& type, 80 PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortArray>, 81 const HashMap<String, String>&); 70 82 71 String m_action; 72 String m_type; 73 RefPtr<SerializedScriptValue> m_data; 74 OwnPtr<MessagePortChannelArray> m_ports; 75 KURL m_service; 76 WTF::HashMap<String, String> m_extras; 83 OwnPtr<DeliveredIntentClient> m_client; 84 OwnPtr<MessagePortArray> m_ports; 77 85 }; 78 86 -
trunk/Source/WebCore/Modules/intents/Intent.h
r116763 r117384 54 54 static PassRefPtr<Intent> create(ScriptState*, const Dictionary&, ExceptionCode&); 55 55 56 virtual ~Intent() { } 57 56 58 const String& action() const { return m_action; } 57 59 const String& type() const { return m_type; } … … 68 70 69 71 private: 70 71 72 String m_action; 72 73 String m_type; -
trunk/Source/WebCore/WebCore.gyp/WebCore.gyp
r117209 r117384 1022 1022 '--include', '../Modules/filesystem', 1023 1023 '--include', '../Modules/indexeddb', 1024 '--include', '../Modules/intents', 1024 1025 '--include', '../Modules/mediastream', 1025 1026 '--include', '../Modules/webaudio', -
trunk/Source/WebCore/WebCore.gypi
r117369 r117384 813 813 'Modules/indexeddb/IDBVersionChangeRequest.idl', 814 814 'Modules/indexeddb/WorkerContextIndexedDatabase.idl', 815 'Modules/intents/DeliveredIntent.idl', 815 816 'Modules/intents/DOMWindowIntents.idl', 816 817 'Modules/intents/Intent.idl', … … 1507 1508 'Modules/indexeddb/WorkerContextIndexedDatabase.cpp', 1508 1509 'Modules/indexeddb/WorkerContextIndexedDatabase.h', 1510 'Modules/intents/DeliveredIntent.cpp', 1511 'Modules/intents/DeliveredIntent.h', 1512 'Modules/intents/DOMWindowIntents.cpp', 1513 'Modules/intents/DOMWindowIntents.h', 1509 1514 'Modules/intents/Intent.cpp', 1510 1515 'Modules/intents/Intent.h', -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r117374 r117384 989 989 } 990 990 } elsif ($attribute->signature->type eq "MessagePortArray") { 991 AddToImplIncludes("V8Array.h");992 991 AddToImplIncludes("MessagePort.h"); 992 AddToImplIncludes("V8MessagePort.h"); 993 993 my $getterFunc = $codeGenerator->WK_lcfirst($attribute->signature->name); 994 994 push(@implContentDecls, <<END); -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp
r115797 r117384 28 28 #include "RuntimeEnabledFeatures.h" 29 29 #include "SerializedScriptValue.h" 30 #include "V8Array.h"31 30 #include "V8Binding.h" 32 31 #include "V8BindingMacros.h" … … 34 33 #include "V8DOMWrapper.h" 35 34 #include "V8IsolatedContext.h" 35 #include "V8MessagePort.h" 36 36 #include "V8Proxy.h" 37 37 #include <wtf/ArrayBuffer.h> -
trunk/Source/WebKit/chromium/ChangeLog
r117379 r117384 1 2012-05-16 Greg Billock <gbillock@google.com> 2 3 IDL and implementation for Web Intents delivery 4 https://bugs.webkit.org/show_bug.cgi?id=83634 5 6 Reviewed by Adam Barth. 7 8 The embedder will implement the WebDeliveredIntentClient interface, which 9 will get notifications of postResult/postFailure from the service page. 10 11 * public/WebDeliveredIntentClient.h: 12 * public/WebFrame.h: 13 (WebKit): 14 (WebFrame): 15 * src/WebDeliveredIntentClient.cpp: 16 * src/WebFrameImpl.cpp: 17 (WebKit::WebFrameImpl::deliverIntent): 18 (WebKit): 19 * src/WebFrameImpl.h: 20 (WebFrameImpl): 21 1 22 2012-05-16 James Robinson <jamesr@chromium.org> 2 23 -
trunk/Source/WebKit/chromium/WebKit.gyp
r117213 r117384 129 129 'public/WebDatabase.h', 130 130 'public/WebDatabaseObserver.h', 131 'public/WebDeliveredIntentClient.h', 131 132 'public/WebDevToolsAgent.h', 132 133 'public/WebDevToolsAgentClient.h', … … 389 390 'src/ContextMenuClientImpl.h', 390 391 'src/DatabaseObserver.cpp', 392 'src/DeliveredIntentClientImpl.cpp', 393 'src/DeliveredIntentClientImpl.h', 391 394 'src/DeviceOrientationClientProxy.cpp', 392 395 'src/DeviceOrientationClientProxy.h', -
trunk/Source/WebKit/chromium/public/WebDeliveredIntentClient.h
r117383 r117384 29 29 */ 30 30 31 #ifndef Web Intent_h32 #define Web Intent_h31 #ifndef WebDeliveredIntentClient_h 32 #define WebDeliveredIntentClient_h 33 33 34 #include "WebMessagePortChannel.h"35 34 #include "platform/WebCommon.h" 36 #include "platform/WebPrivatePtr.h"37 #include "platform/WebString.h"38 #include "platform/WebURL.h"39 #include "platform/WebVector.h"40 41 namespace WebCore { class Intent; }42 35 43 36 namespace WebKit { 44 37 45 // Holds data passed through a Web Intents invocation call from the Javascript 46 // Intent object. 38 class WebSerializedScriptValue; 39 40 // The embedder implements this interface to receive reply calls from the service 41 // in response to the delivery of a web intent. This client must remain valid 42 // until the destroy() method is called. 47 43 // See spec at http://www.chromium.org/developers/design-documents/webintentsapi 48 class Web Intent {44 class WebDeliveredIntentClient { 49 45 public: 50 WebIntent() { } 51 WebIntent(const WebIntent& other) { assign(other); } 52 ~WebIntent() { reset(); } 46 virtual ~WebDeliveredIntentClient() { } 53 47 54 WebIntent& operator=(const WebIntent& other) 55 { 56 assign(other); 57 return *this; 58 } 59 WEBKIT_EXPORT void reset(); 60 WEBKIT_EXPORT bool isNull() const; 61 WEBKIT_EXPORT bool equals(const WebIntent&) const; 62 WEBKIT_EXPORT void assign(const WebIntent&); 63 64 WEBKIT_EXPORT WebString action() const; 65 WEBKIT_EXPORT WebString type() const; 66 WEBKIT_EXPORT WebString data() const; 67 WEBKIT_EXPORT WebURL service() const; 68 69 // Retrieve a list of the names of extra metadata associated with the 70 // intent. 71 WEBKIT_EXPORT WebVector<WebString> extrasNames() const; 72 73 // Retrieve the value of an extra metadata element. The argument should 74 // be one of the names retrieved with |extrasNames|. Returns an empty 75 // string if the name is invalid. 76 WEBKIT_EXPORT WebString extrasValue(const WebString&) const; 77 78 // Caller takes ownership of the ports. 79 WEBKIT_EXPORT WebMessagePortChannelArray* messagePortChannelsRelease() const; 80 81 #if WEBKIT_IMPLEMENTATION 82 WebIntent(const WTF::PassRefPtr<WebCore::Intent>&); 83 #endif 84 85 private: 86 WebPrivatePtr<WebCore::Intent> m_private; 48 virtual void postResult(const WebSerializedScriptValue& data) const = 0; 49 virtual void postFailure(const WebSerializedScriptValue& data) const = 0; 50 virtual void destroy() = 0; 87 51 }; 88 52 89 53 } // namespace WebKit 90 54 91 #endif // Web Intent_h55 #endif // WebDeliveredIntentClient_h -
trunk/Source/WebKit/chromium/public/WebFrame.h
r117200 r117384 58 58 class WebData; 59 59 class WebDataSource; 60 class WebDeliveredIntentClient; 60 61 class WebDocument; 61 62 class WebElement; … … 63 64 class WebHistoryItem; 64 65 class WebInputElement; 66 class WebIntent; 65 67 class WebPerformance; 66 68 class WebRange; … … 606 608 // Web Intents --------------------------------------------------------- 607 609 608 // Forwards a web intents reply from the invoked activity back to the 609 // appropriate registered Javascript callback. The |intentIdentifier| is 610 // the WebIntent parameter received from the dispatchIntent method. 611 virtual void handleIntentResult(int intentIdentifier, const WebString&) = 0; 612 613 // Forwards a web intents failure notification from the invoked activity 614 // or intervening browser logic back to the appropriate registered 615 // Javascript callback. The |intentIdentifier| is the WebIntent parameter 616 // received from the dispatchIntent method. 617 virtual void handleIntentFailure(int intentIdentifier, const WebString&) = 0; 610 // Called on a target service page to deliver an intent to the window. 611 virtual void deliverIntent(const WebIntent&, WebDeliveredIntentClient*) = 0; 618 612 619 613 -
trunk/Source/WebKit/chromium/public/WebIntent.h
r115264 r117384 49 49 public: 50 50 WebIntent() { } 51 WebIntent(const WebString& action, const WebString& type, const WebString& data); 51 52 WebIntent(const WebIntent& other) { assign(other); } 52 53 ~WebIntent() { reset(); } … … 81 82 #if WEBKIT_IMPLEMENTATION 82 83 WebIntent(const WTF::PassRefPtr<WebCore::Intent>&); 84 operator WebCore::Intent*() const; 83 85 #endif 84 86 -
trunk/Source/WebKit/chromium/src/DeliveredIntentClientImpl.h
r117383 r117384 29 29 */ 30 30 31 #ifndef WebIntent_h32 #define WebIntent_h31 #ifndef DeliveredIntentClientImpl_h 32 #define DeliveredIntentClientImpl_h 33 33 34 #include "WebMessagePortChannel.h" 34 #include "DeliveredIntent.h" 35 #include "SerializedScriptValue.h" 35 36 #include "platform/WebCommon.h" 36 #include "platform/WebPrivatePtr.h" 37 #include "platform/WebString.h" 38 #include "platform/WebURL.h" 39 #include "platform/WebVector.h" 40 41 namespace WebCore { class Intent; } 37 #include <wtf/PassRefPtr.h> 42 38 43 39 namespace WebKit { 44 40 45 // Holds data passed through a Web Intents invocation call from the Javascript 46 // Intent object. 41 class WebDeliveredIntentClient; 42 class WebSerializedScriptValue; 43 44 // The embedder implements this interface to receive reply calls from the service 45 // in response to the delivery of a web intent. This client must remain valid 46 // until the destroy() method is called, or until the WebFrame to which it is 47 // delivered is destroyed. 47 48 // See spec at http://www.chromium.org/developers/design-documents/webintentsapi 48 class WebIntent { 49 class DeliveredIntentClientImpl : public WebCore::DeliveredIntentClient { 50 WTF_MAKE_NONCOPYABLE(DeliveredIntentClientImpl); 49 51 public: 50 WebIntent() { } 51 WebIntent(const WebIntent& other) { assign(other); } 52 ~WebIntent() { reset(); } 52 explicit DeliveredIntentClientImpl(WebDeliveredIntentClient*); 53 virtual ~DeliveredIntentClientImpl(); 53 54 54 WebIntent& operator=(const WebIntent& other) 55 { 56 assign(other); 57 return *this; 58 } 59 WEBKIT_EXPORT void reset(); 60 WEBKIT_EXPORT bool isNull() const; 61 WEBKIT_EXPORT bool equals(const WebIntent&) const; 62 WEBKIT_EXPORT void assign(const WebIntent&); 63 64 WEBKIT_EXPORT WebString action() const; 65 WEBKIT_EXPORT WebString type() const; 66 WEBKIT_EXPORT WebString data() const; 67 WEBKIT_EXPORT WebURL service() const; 68 69 // Retrieve a list of the names of extra metadata associated with the 70 // intent. 71 WEBKIT_EXPORT WebVector<WebString> extrasNames() const; 72 73 // Retrieve the value of an extra metadata element. The argument should 74 // be one of the names retrieved with |extrasNames|. Returns an empty 75 // string if the name is invalid. 76 WEBKIT_EXPORT WebString extrasValue(const WebString&) const; 77 78 // Caller takes ownership of the ports. 79 WEBKIT_EXPORT WebMessagePortChannelArray* messagePortChannelsRelease() const; 80 81 #if WEBKIT_IMPLEMENTATION 82 WebIntent(const WTF::PassRefPtr<WebCore::Intent>&); 83 #endif 55 virtual void postResult(PassRefPtr<WebCore::SerializedScriptValue> data); 56 virtual void postFailure(PassRefPtr<WebCore::SerializedScriptValue> data); 84 57 85 58 private: 86 Web PrivatePtr<WebCore::Intent> m_private;59 WebDeliveredIntentClient* m_client; 87 60 }; 88 61 89 62 } // namespace WebKit 90 63 91 #endif // WebIntent_h64 #endif // DeliveredIntentClientImpl_h -
trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp
r117210 r117384 79 79 #include "DOMUtilitiesPrivate.h" 80 80 #include "DOMWindow.h" 81 #include "DOMWindowIntents.h" 82 #include "DeliveredIntent.h" 83 #include "DeliveredIntentClientImpl.h" 81 84 #include "Document.h" 82 85 #include "DocumentLoader.h" … … 143 146 #include "WebDOMEventListener.h" 144 147 #include "WebDataSourceImpl.h" 148 #include "WebDeliveredIntentClient.h" 145 149 #include "WebDevToolsAgentPrivate.h" 146 150 #include "WebDocument.h" … … 151 155 #include "WebIconURL.h" 152 156 #include "WebInputElement.h" 157 #include "WebIntent.h" 153 158 #include "WebNode.h" 154 159 #include "WebPerformance.h" … … 165 170 #include "platform/WebPoint.h" 166 171 #include "platform/WebRect.h" 172 #include "platform/WebSerializedScriptValue.h" 167 173 #include "platform/WebSize.h" 168 174 #include "platform/WebURLError.h" … … 172 178 #include <public/Platform.h> 173 179 #include <wtf/CurrentTime.h> 180 #include <wtf/HashMap.h> 174 181 175 182 #if USE(V8) … … 506 513 return loader ? WebDataSourceImpl::fromDocumentLoader(loader) : 0; 507 514 } 508 509 515 510 516 // WebFrame ------------------------------------------------------------------- … … 1871 1877 } 1872 1878 1873 void WebFrameImpl::handleIntentResult(int intentIdentifier, const WebString& reply)1874 {1875 }1876 1877 void WebFrameImpl::handleIntentFailure(int intentIdentifier, const WebString& reply)1878 {1879 }1880 1881 1879 void WebFrameImpl::sendOrientationChangeEvent(int orientation) 1882 1880 { … … 1917 1915 // Pass an empty call stack, since we don't have the one from the other process. 1918 1916 m_frame->domWindow()->dispatchMessageEventWithOriginCheck(intendedTargetOrigin.get(), event, 0); 1917 } 1918 1919 void WebFrameImpl::deliverIntent(const WebIntent& intent, WebDeliveredIntentClient* intentClient) 1920 { 1921 #if ENABLE(WEB_INTENTS) 1922 OwnPtr<WebCore::DeliveredIntentClient> client(adoptPtr(new DeliveredIntentClientImpl(intentClient))); 1923 1924 OwnPtr<MessagePortArray> ports; 1925 WebSerializedScriptValue intentData = WebSerializedScriptValue::fromString(intent.data()); 1926 const WebCore::Intent* webcoreIntent = intent; 1927 RefPtr<DeliveredIntent> deliveredIntent = DeliveredIntent::create(m_frame, client.release(), intent.action(), intent.type(), intentData, ports.release(), webcoreIntent->extras()); 1928 1929 DOMWindowIntents::from(m_frame->domWindow())->deliver(deliveredIntent.release()); 1930 #endif 1919 1931 } 1920 1932 -
trunk/Source/WebKit/chromium/src/WebFrameImpl.h
r117200 r117384 56 56 class ChromePrintContext; 57 57 class WebDataSourceImpl; 58 class WebDeliveredIntentClient; 58 59 class WebInputElement; 60 class WebIntent; 59 61 class WebFrameClient; 60 62 class WebPerformance; … … 211 213 virtual void resetMatchCount(); 212 214 213 virtual void handleIntentResult(int, const WebString&);214 virtual void handleIntentFailure(int, const WebString&);215 216 215 virtual void sendOrientationChangeEvent(int orientation); 217 216 … … 224 223 const WebSecurityOrigin& intendedTargetOrigin, 225 224 const WebDOMEvent&); 225 226 virtual void deliverIntent(const WebIntent&, WebDeliveredIntentClient*); 226 227 227 228 virtual WebString contentAsText(size_t maxChars) const; -
trunk/Source/WebKit/chromium/src/WebIntent.cpp
r115264 r117384 33 33 34 34 #include "Intent.h" 35 #include "MessagePort.h" 35 36 #include "PlatformMessagePortChannel.h" 36 37 #include "SerializedScriptValue.h" … … 38 39 39 40 namespace WebKit { 41 42 WebIntent::WebIntent(const WebString& action, const WebString& type, const WebString& data) 43 { 44 #if ENABLE(WEB_INTENTS) 45 WebCore::ExceptionCode ec = 0; 46 WebCore::MessagePortArray ports; 47 RefPtr<WebCore::Intent> intent = WebCore::Intent::create(action, type, WebCore::SerializedScriptValue::createFromWire(data), ports, ec); 48 if (ec) 49 return; 50 51 m_private = intent.release(); 52 #endif 53 } 40 54 41 55 #if ENABLE(WEB_INTENTS) … … 131 145 } 132 146 147 WebIntent::operator WebCore::Intent*() const 148 { 149 return m_private.get(); 150 } 151 133 152 WebVector<WebString> WebIntent::extrasNames() const 134 153 { -
trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp
r116729 r117384 50 50 #include "WebIDBFactory.h" 51 51 #include "WebInputElement.h" 52 #include "WebIntent.h" 52 53 #include "WebIntentRequest.h" 53 54 #include "WebKit.h" … … 80 81 using namespace std; 81 82 83 class EmptyWebDeliveredIntentClient : public WebKit::WebDeliveredIntentClient { 84 public: 85 EmptyWebDeliveredIntentClient() { } 86 ~EmptyWebDeliveredIntentClient() { } 87 88 virtual void postResult(const WebSerializedScriptValue& data) const { } 89 virtual void postFailure(const WebSerializedScriptValue& data) const { } 90 virtual void destroy() { } 91 }; 92 82 93 LayoutTestController::LayoutTestController(TestShell* shell) 83 94 : m_shell(shell) … … 86 97 , m_showDebugLayerTree(false) 87 98 , m_workQueue(this) 99 , m_intentClient(adoptPtr(new EmptyWebDeliveredIntentClient)) 88 100 , m_shouldStayOnPageAfterHandlingBeforeUnload(false) 89 101 { … … 272 284 bindProperty("workerThreadCount", &LayoutTestController::workerThreadCount); 273 285 bindMethod("sendWebIntentResponse", &LayoutTestController::sendWebIntentResponse); 286 bindMethod("deliverWebIntent", &LayoutTestController::deliverWebIntent); 274 287 } 275 288 … … 2154 2167 } 2155 2168 2169 void LayoutTestController::deliverWebIntent(const CppArgumentList& arguments, CppVariant* result) 2170 { 2171 if (arguments.size() < 3) 2172 return; 2173 2174 v8::HandleScope scope; 2175 v8::Local<v8::Context> ctx = m_shell->webView()->mainFrame()->mainWorldScriptContext(); 2176 result->set(m_shell->webView()->mainFrame()->selectionAsMarkup().utf8()); 2177 v8::Context::Scope cscope(ctx); 2178 2179 WebString action = cppVariantToWebString(arguments[0]); 2180 WebString type = cppVariantToWebString(arguments[1]); 2181 WebKit::WebCString data = cppVariantToWebString(arguments[2]).utf8(); 2182 WebSerializedScriptValue serializedData = WebSerializedScriptValue::serialize( 2183 v8::String::New(data.data(), data.length())); 2184 2185 WebIntent intent(action, type, serializedData.toString()); 2186 2187 m_shell->webView()->mainFrame()->deliverIntent(intent, m_intentClient.get()); 2188 } 2189 2156 2190 void LayoutTestController::setPluginsEnabled(const CppArgumentList& arguments, CppVariant* result) 2157 2191 { -
trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h
r116729 r117384 44 44 #include "CppBoundClass.h" 45 45 #include "Task.h" 46 #include "WebDeliveredIntentClient.h" 46 47 #include "platform/WebArrayBufferView.h" 47 48 #include "platform/WebString.h" … … 439 440 440 441 // Expects one string argument for sending successful result, zero 441 // for sending a failure result.442 // arguments for sending a failure result. 442 443 void sendWebIntentResponse(const CppArgumentList&, CppVariant*); 444 445 // Cause the web intent to be delivered to this context. 446 void deliverWebIntent(const CppArgumentList&, CppVariant*); 443 447 444 448 public: … … 706 710 WebKit::WebArrayBufferView m_audioData; 707 711 712 // Mock object for testing delivering web intents. 713 OwnPtr<WebKit::WebDeliveredIntentClient> m_intentClient; 714 708 715 bool m_shouldStayOnPageAfterHandlingBeforeUnload; 709 716 -
trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp
r117190 r117384 59 59 #include "platform/WebRect.h" 60 60 #include "WebScreenInfo.h" 61 #include "platform/WebSerializedScriptValue.h" 61 62 #include "platform/WebSize.h" 62 63 #include "WebStorageNamespace.h" … … 1353 1354 request.intent().extrasValue(extras[i]).utf8().data()); 1354 1355 } 1356 } 1357 1358 void WebViewHost::deliveredIntentResult(WebFrame* frame, int id, const WebSerializedScriptValue& data) 1359 { 1360 printf("Web intent success for id %d\n", id); 1361 } 1362 1363 void WebViewHost::deliveredIntentFailure(WebFrame* frame, int id, const WebSerializedScriptValue& data) 1364 { 1365 printf("Web intent failure for id %d\n", id); 1355 1366 } 1356 1367 -
trunk/Tools/DumpRenderTree/chromium/WebViewHost.h
r116384 r117384 59 59 class WebGeolocationServiceMock; 60 60 class WebIntentServiceInfo; 61 class WebSerializedScriptValue; 61 62 class WebSharedWorkerClient; 62 63 class WebSpeechInputController; … … 243 244 virtual void registerIntentService(WebKit::WebFrame*, const WebKit::WebIntentServiceInfo&); 244 245 virtual void dispatchIntent(WebKit::WebFrame*, const WebKit::WebIntentRequest&); 246 virtual void deliveredIntentResult(WebKit::WebFrame*, int, const WebKit::WebSerializedScriptValue&); 247 virtual void deliveredIntentFailure(WebKit::WebFrame*, int, const WebKit::WebSerializedScriptValue&); 245 248 246 249 WebKit::WebDeviceOrientationClientMock* deviceOrientationClientMock();
Note: See TracChangeset
for help on using the changeset viewer.