Changeset 117793 in webkit
- Timestamp:
- May 21, 2012, 9:24:06 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
-
LayoutTests/webintents/web-intents-obj-constructor-expected.txt (modified) (2 diffs)
-
LayoutTests/webintents/web-intents-obj-constructor.html (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/intents/DeliveredIntent.cpp (modified) (2 diffs)
-
Source/WebCore/Modules/intents/Intent.cpp (modified) (4 diffs)
-
Source/WebCore/Modules/intents/Intent.h (modified) (3 diffs)
-
Source/WebKit/chromium/ChangeLog (modified) (1 diff)
-
Source/WebKit/chromium/public/WebIntent.h (modified) (1 diff)
-
Source/WebKit/chromium/src/WebIntent.cpp (modified) (1 diff)
-
Tools/DumpRenderTree/chromium/WebViewHost.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/webintents/web-intents-obj-constructor-expected.txt
r115264 r117793 6 6 Received Web Intent: action=action1 type=text/plain+port 7 7 Have 1 ports 8 Received Web Intent: action=action1 type=text/plain+suggestions 9 Have suggestion http://www.example.com/ 8 10 PASS successfullyParsed is true 9 11 … … 44 46 * sent intent with extras 45 47 * sent intent with port 48 PASS new WebKitIntent(badPortIntentObj) threw exception Error: DATA_CLONE_ERR: DOM Exception 25. 49 PASS new WebKitIntent(suggestionsIntent) threw exception Error: SYNTAX_ERR: DOM Exception 12. 50 PASS new WebKitIntent(suggestionsIntent) threw exception Error: SYNTAX_ERR: DOM Exception 12. 51 * sent intent with suggestions 46 52 -
trunk/LayoutTests/webintents/web-intents-obj-constructor.html
r115264 r117793 93 93 navigator.webkitStartActivity(portIntent); 94 94 debug("* sent intent with port"); 95 96 // Ports, if present, must be put in |transfer|. 97 var badchannel = new MessageChannel(); 98 badchannel.port2.onMessage = function() { 99 debug("* got message"); 100 } 101 badPortIntentObj = 102 {"action":"action1", 103 "type":"text/plain+badport", 104 "data":badchannel.port1}; 105 shouldThrow("new WebKitIntent(badPortIntentObj)", "'Error: DATA_CLONE_ERR: DOM Exception 25'"); 106 107 suggestionsIntent = 108 {"action":"action1", 109 "type":"text/plain+suggestions", 110 "data":"message", 111 "suggestions":["www.example.com/", "http://ww2.example.com"]}; 112 shouldThrow("new WebKitIntent(suggestionsIntent)", "'Error: SYNTAX_ERR: DOM Exception 12'"); 113 114 suggestionsIntent.suggestions = [15]; 115 shouldThrow("new WebKitIntent(suggestionsIntent)", "'Error: SYNTAX_ERR: DOM Exception 12'"); 116 117 suggestionsIntent.suggestions = ["http://www.example.com/"]; 118 navigator.webkitStartActivity(new WebKitIntent(suggestionsIntent)); 119 debug("* sent intent with suggestions"); 120 95 121 } 96 122 </script> -
trunk/Source/WebCore/ChangeLog
r117792 r117793 1 2012-05-21 Greg Billock <gbillock@google.com> 2 3 Add suggestions field to web intents API. 4 https://bugs.webkit.org/show_bug.cgi?id=86791 5 6 Reviewed by Adam Barth. 7 8 The |suggestions| field is used by the client to avoid an empty 9 web intents selection window (picker). The UA can add the given 10 suggestions to the picker if it would otherwise be empty. See 11 http://dvcs.w3.org/hg/web-intents/raw-file/tip/spec/Overview.html#intent-parameters-dictionary 12 13 * Modules/intents/DeliveredIntent.cpp: 14 (WebCore::DeliveredIntent::DeliveredIntent): 15 * Modules/intents/Intent.cpp: 16 (WebCore::Intent::create): 17 (WebCore::Intent::Intent): 18 * Modules/intents/Intent.h: 19 (WebCore::Intent::suggestions): 20 (Intent): 21 1 22 2012-05-21 Stephen Chenney <schenney@chromium.org> 2 23 -
trunk/Source/WebCore/Modules/intents/DeliveredIntent.cpp
r117384 r117793 36 36 #include "Frame.h" 37 37 #include "SerializedScriptValue.h" 38 #include <wtf/Vector.h> 38 39 39 40 namespace WebCore { … … 49 50 PassRefPtr<SerializedScriptValue> data, PassOwnPtr<MessagePortArray> ports, 50 51 const HashMap<String, String>& extras) 51 : Intent(action, type, data, PassOwnPtr<MessagePortChannelArray>(), extras, KURL() )52 : Intent(action, type, data, PassOwnPtr<MessagePortChannelArray>(), extras, KURL(), Vector<KURL>()) 52 53 , FrameDestructionObserver(frame) 53 54 , m_client(client) -
trunk/Source/WebCore/Modules/intents/Intent.cpp
r116763 r117793 35 35 #include "MessagePort.h" 36 36 #include "SerializedScriptValue.h" 37 #include <wtf/HashSet.h> 37 38 38 39 namespace WebCore { … … 51 52 OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(&ports, ec); 52 53 53 WTF::HashMap<String, String> extras; 54 KURL serviceUrl; 54 HashMap<String, String> extras; 55 KURL serviceURL; 56 Vector<KURL> suggestions; 55 57 56 return adoptRef(new Intent(action, type, data, channels.release(), extras, serviceU rl));58 return adoptRef(new Intent(action, type, data, channels.release(), extras, serviceURL, suggestions)); 57 59 } 58 60 … … 97 99 } 98 100 99 WTF::HashMap<String, String> extras;101 HashMap<String, String> extras; 100 102 Dictionary extrasDictionary; 101 103 if (options.get("extras", extrasDictionary)) 102 104 extrasDictionary.getOwnPropertiesAsStringHashMap(extras); 103 105 104 return adoptRef(new Intent(action, type, serializedData.release(), channels.release(), extras, serviceUrl)); 106 HashSet<AtomicString> suggestionsStrings; 107 Vector<KURL> suggestions; 108 if (options.get("suggestions", suggestionsStrings)) { 109 for (HashSet<AtomicString>::iterator iter = suggestionsStrings.begin(); iter != suggestionsStrings.end(); ++iter) { 110 KURL suggestedURL = KURL(KURL(), *iter); 111 if (!suggestedURL.isValid()) { 112 ec = SYNTAX_ERR; 113 return 0; 114 } 115 suggestions.append(suggestedURL); 116 } 117 } 118 119 return adoptRef(new Intent(action, type, serializedData.release(), channels.release(), extras, serviceUrl, suggestions)); 105 120 } 106 121 107 122 Intent::Intent(const String& action, const String& type, 108 123 PassRefPtr<SerializedScriptValue> data, PassOwnPtr<MessagePortChannelArray> ports, 109 const WTF::HashMap<String, String>& extras, const KURL& service)124 const HashMap<String, String>& extras, const KURL& service, const Vector<KURL>& suggestions) 110 125 : m_action(action) 111 126 , m_type(type) … … 113 128 , m_service(service) 114 129 , m_extras(extras) 130 , m_suggestions(suggestions) 115 131 { 116 132 if (data) -
trunk/Source/WebCore/Modules/intents/Intent.h
r117384 r117793 41 41 #include <wtf/RefCounted.h> 42 42 #include <wtf/RefPtr.h> 43 #include <wtf/Vector.h> 43 44 #include <wtf/text/WTFString.h> 44 45 … … 62 63 MessagePortChannelArray* messagePorts() const { return m_ports.get(); } 63 64 const KURL& service() const { return m_service; } 64 const WTF::HashMap<String, String>& extras() const { return m_extras; } 65 const HashMap<String, String>& extras() const { return m_extras; } 66 const Vector<KURL>& suggestions() const { return m_suggestions; } 65 67 66 68 protected: 67 69 Intent(const String& action, const String& type, 68 70 PassRefPtr<SerializedScriptValue> data, PassOwnPtr<MessagePortChannelArray> ports, 69 const WTF::HashMap<String, String>& extras, const KURL& service);71 const HashMap<String, String>& extras, const KURL& service, const Vector<KURL>& suggestions); 70 72 71 73 private: … … 75 77 OwnPtr<MessagePortChannelArray> m_ports; 76 78 KURL m_service; 77 WTF::HashMap<String, String> m_extras; 79 HashMap<String, String> m_extras; 80 Vector<KURL> m_suggestions; 78 81 }; 79 82 -
trunk/Source/WebKit/chromium/ChangeLog
r117766 r117793 1 2012-05-21 Greg Billock <gbillock@google.com> 2 3 Add suggestions field to web intents API. 4 https://bugs.webkit.org/show_bug.cgi?id=86791 5 6 Reviewed by Adam Barth. 7 8 * public/WebIntent.h: 9 (WebIntent): 10 * src/WebIntent.cpp: 11 (WebKit::WebIntent::suggestions): 12 (WebKit): 13 1 14 2012-05-20 Kinuko Yasuda <kinuko@chromium.org> 2 15 -
trunk/Source/WebKit/chromium/public/WebIntent.h
r117423 r117793 67 67 WEBKIT_EXPORT WebString data() const; 68 68 WEBKIT_EXPORT WebURL service() const; 69 WEBKIT_EXPORT WebVector<WebURL> suggestions() const; 69 70 70 71 // Retrieve a list of the names of extra metadata associated with the -
trunk/Source/WebKit/chromium/src/WebIntent.cpp
r117384 r117793 128 128 } 129 129 130 WebVector<WebURL> WebIntent::suggestions() const 131 { 132 #if ENABLE(WEB_INTENTS) 133 WebVector<WebURL> suggestions(m_private->suggestions().size()); 134 for (size_t i = 0; i < m_private->suggestions().size(); ++i) 135 suggestions[i] = m_private->suggestions().at(i); 136 return suggestions; 137 #else 138 return WebVector<WebURL>(); 139 #endif 140 } 141 130 142 WebMessagePortChannelArray* WebIntent::messagePortChannelsRelease() const 131 143 { -
trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp
r117680 r117793 1347 1347 delete ports; 1348 1348 } 1349 1349 1350 if (!request.intent().service().isEmpty()) 1350 1351 printf("Explicit intent service: %s\n", request.intent().service().spec().data()); 1352 1351 1353 WebVector<WebString> extras = request.intent().extrasNames(); 1352 1354 for (size_t i = 0; i < extras.size(); ++i) { … … 1354 1356 request.intent().extrasValue(extras[i]).utf8().data()); 1355 1357 } 1358 1359 WebVector<WebURL> suggestions = request.intent().suggestions(); 1360 for (size_t i = 0; i < suggestions.size(); ++i) 1361 printf("Have suggestion %s\n", suggestions[i].spec().data()); 1356 1362 } 1357 1363
Note:
See TracChangeset
for help on using the changeset viewer.