Changeset 211158 in webkit
- Timestamp:
- Jan 25, 2017 12:16:17 PM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r211154 r211158 1 2017-01-25 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Add support for named pasteboards, pasteboard strategies and platform pasteboards 4 https://bugs.webkit.org/show_bug.cgi?id=167404 5 6 Reviewed by Enrica Casucci. 7 8 Refactors some pasteboard-related code to plumb the name of the pasteboard across from WebCore to the client 9 layer. No new tests, because there should be no change in behavior. 10 11 * platform/DragData.h: 12 * platform/Pasteboard.h: 13 * platform/PasteboardStrategy.h: 14 * platform/PlatformPasteboard.h: 15 * platform/ios/PasteboardIOS.mm: 16 (WebCore::Pasteboard::Pasteboard): 17 (WebCore::Pasteboard::write): 18 (WebCore::Pasteboard::writePlainText): 19 (WebCore::Pasteboard::read): 20 (WebCore::Pasteboard::hasData): 21 (WebCore::Pasteboard::clear): 22 (WebCore::Pasteboard::readString): 23 (WebCore::Pasteboard::writeString): 24 (WebCore::Pasteboard::types): 25 1 26 2017-01-25 Antoine Quint <graouts@apple.com> 2 27 -
trunk/Source/WebCore/platform/DragData.h
r210360 r211158 108 108 void setFileNames(Vector<String>& fileNames) { m_fileNames = WTFMove(fileNames); } 109 109 const Vector<String>& fileNames() const { return m_fileNames; } 110 #if PLATFORM( MAC)110 #if PLATFORM(COCOA) 111 111 const String& pasteboardName() const { return m_pasteboardName; } 112 112 bool containsPromise() const; … … 133 133 DragApplicationFlags m_applicationFlags; 134 134 Vector<String> m_fileNames; 135 #if PLATFORM( MAC)135 #if PLATFORM(COCOA) 136 136 String m_pasteboardName; 137 137 #endif -
trunk/Source/WebCore/platform/Pasteboard.h
r208576 r211158 202 202 #endif 203 203 204 #if PLATFORM( MAC)204 #if PLATFORM(COCOA) 205 205 explicit Pasteboard(const String& pasteboardName); 206 206 … … 232 232 #endif 233 233 234 #if PLATFORM(IOS) 235 long m_changeCount; 236 #endif 237 238 #if PLATFORM(MAC) 234 #if PLATFORM(COCOA) 239 235 String m_pasteboardName; 240 236 long m_changeCount; -
trunk/Source/WebCore/platform/PasteboardStrategy.h
r206256 r211158 43 43 public: 44 44 #if PLATFORM(IOS) 45 // FIXME: We should move Mac to this. 46 virtual void writeToPasteboard(const PasteboardWebContent&) = 0; 47 virtual void writeToPasteboard(const PasteboardImage&) = 0; 48 virtual void writeToPasteboard(const String& pasteboardType, const String&) = 0; 49 virtual int getPasteboardItemsCount() = 0; 50 virtual String readStringFromPasteboard(int index, const String& pasteboardType) = 0; 51 virtual RefPtr<SharedBuffer> readBufferFromPasteboard(int index, const String& pasteboardType) = 0; 52 virtual URL readURLFromPasteboard(int index, const String& pasteboardType) = 0; 53 virtual long changeCount() = 0; 45 virtual void writeToPasteboard(const PasteboardWebContent&, const String& pasteboardName) = 0; 46 virtual void writeToPasteboard(const PasteboardImage&, const String& pasteboardName) = 0; 47 virtual void writeToPasteboard(const String& pasteboardType, const String&, const String& pasteboardName) = 0; 48 virtual int getPasteboardItemsCount(const String& pasteboardName) = 0; 49 virtual String readStringFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) = 0; 50 virtual RefPtr<SharedBuffer> readBufferFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) = 0; 51 virtual URL readURLFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) = 0; 54 52 #endif // PLATFORM(IOS) 55 53 #if PLATFORM(COCOA) -
trunk/Source/WebCore/platform/PlatformPasteboard.h
r206256 r211158 52 52 class PlatformPasteboard { 53 53 public: 54 // FIXME: probably we don't need a constructor that takes a pasteboard name for iOS.55 54 WEBCORE_EXPORT explicit PlatformPasteboard(const String& pasteboardName); 56 55 #if PLATFORM(IOS) -
trunk/Source/WebCore/platform/ios/PasteboardIOS.mm
r210828 r211158 83 83 84 84 Pasteboard::Pasteboard() 85 : m_changeCount(platformStrategies()->pasteboardStrategy()->changeCount( ))85 : m_changeCount(platformStrategies()->pasteboardStrategy()->changeCount(m_pasteboardName)) 86 86 { 87 87 } … … 103 103 void Pasteboard::write(const PasteboardWebContent& content) 104 104 { 105 platformStrategies()->pasteboardStrategy()->writeToPasteboard(content );105 platformStrategies()->pasteboardStrategy()->writeToPasteboard(content, m_pasteboardName); 106 106 } 107 107 … … 113 113 void Pasteboard::write(const PasteboardImage& pasteboardImage) 114 114 { 115 platformStrategies()->pasteboardStrategy()->writeToPasteboard(pasteboardImage );115 platformStrategies()->pasteboardStrategy()->writeToPasteboard(pasteboardImage, m_pasteboardName); 116 116 } 117 117 118 118 void Pasteboard::writePlainText(const String& text, SmartReplaceOption) 119 119 { 120 platformStrategies()->pasteboardStrategy()->writeToPasteboard(kUTTypeText, text );120 platformStrategies()->pasteboardStrategy()->writeToPasteboard(kUTTypeText, text, m_pasteboardName); 121 121 } 122 122 123 123 void Pasteboard::write(const PasteboardURL& pasteboardURL) 124 124 { 125 platformStrategies()->pasteboardStrategy()->writeToPasteboard(kUTTypeURL, pasteboardURL.url.string() );125 platformStrategies()->pasteboardStrategy()->writeToPasteboard(kUTTypeURL, pasteboardURL.url.string(), m_pasteboardName); 126 126 } 127 127 … … 147 147 { 148 148 PasteboardStrategy& strategy = *platformStrategies()->pasteboardStrategy(); 149 text.text = strategy.readStringFromPasteboard(0, kUTTypeText );149 text.text = strategy.readStringFromPasteboard(0, kUTTypeText, m_pasteboardName); 150 150 if (text.text.isEmpty()) 151 text.text = strategy.readStringFromPasteboard(0, kUTTypeURL );151 text.text = strategy.readStringFromPasteboard(0, kUTTypeURL, m_pasteboardName); 152 152 } 153 153 … … 161 161 PasteboardStrategy& strategy = *platformStrategies()->pasteboardStrategy(); 162 162 163 int numberOfItems = strategy.getPasteboardItemsCount( );163 int numberOfItems = strategy.getPasteboardItemsCount(m_pasteboardName); 164 164 165 165 if (!numberOfItems) … … 174 174 175 175 if ([type isEqualToString:WebArchivePboardType]) { 176 if (RefPtr<SharedBuffer> buffer = strategy.readBufferFromPasteboard(i, WebArchivePboardType )) {176 if (RefPtr<SharedBuffer> buffer = strategy.readBufferFromPasteboard(i, WebArchivePboardType, m_pasteboardName)) { 177 177 if (reader.readWebArchive(buffer.get())) 178 178 break; … … 181 181 182 182 if ([type isEqualToString:(NSString *)kUTTypeHTML]) { 183 String htmlString = strategy.readStringFromPasteboard(i, kUTTypeHTML );183 String htmlString = strategy.readStringFromPasteboard(i, kUTTypeHTML, m_pasteboardName); 184 184 if (!htmlString.isNull() && reader.readHTML(htmlString)) 185 185 break; … … 187 187 188 188 if ([type isEqualToString:(NSString *)kUTTypeFlatRTFD]) { 189 if (RefPtr<SharedBuffer> buffer = strategy.readBufferFromPasteboard(i, kUTTypeFlatRTFD )) {189 if (RefPtr<SharedBuffer> buffer = strategy.readBufferFromPasteboard(i, kUTTypeFlatRTFD, m_pasteboardName)) { 190 190 if (reader.readRTFD(*buffer)) 191 191 break; … … 194 194 195 195 if ([type isEqualToString:(NSString *)kUTTypeRTF]) { 196 if (RefPtr<SharedBuffer> buffer = strategy.readBufferFromPasteboard(i, kUTTypeRTF )) {196 if (RefPtr<SharedBuffer> buffer = strategy.readBufferFromPasteboard(i, kUTTypeRTF, m_pasteboardName)) { 197 197 if (reader.readRTF(*buffer)) 198 198 break; … … 201 201 202 202 if ([supportedImageTypes() containsObject:type]) { 203 if (RefPtr<SharedBuffer> buffer = strategy.readBufferFromPasteboard(i, type )) {203 if (RefPtr<SharedBuffer> buffer = strategy.readBufferFromPasteboard(i, type, m_pasteboardName)) { 204 204 if (reader.readImage(buffer.releaseNonNull(), type)) 205 205 break; … … 208 208 209 209 if ([type isEqualToString:(NSString *)kUTTypeURL]) { 210 URL url = strategy.readURLFromPasteboard(i, kUTTypeURL );210 URL url = strategy.readURLFromPasteboard(i, kUTTypeURL, m_pasteboardName); 211 211 if (!url.isNull() && reader.readURL(url, String())) 212 212 break; … … 214 214 215 215 if ([type isEqualToString:(NSString *)kUTTypeText]) { 216 String string = strategy.readStringFromPasteboard(i, kUTTypeText );216 String string = strategy.readStringFromPasteboard(i, kUTTypeText, m_pasteboardName); 217 217 if (!string.isNull() && reader.readPlainText(string)) 218 218 break; … … 230 230 bool Pasteboard::hasData() 231 231 { 232 return platformStrategies()->pasteboardStrategy()->getPasteboardItemsCount() != 0;232 return !!platformStrategies()->pasteboardStrategy()->getPasteboardItemsCount(m_pasteboardName); 233 233 } 234 234 … … 274 274 return; 275 275 276 platformStrategies()->pasteboardStrategy()->writeToPasteboard(cocoaType.get(), String() );276 platformStrategies()->pasteboardStrategy()->writeToPasteboard(cocoaType.get(), String(), m_pasteboardName); 277 277 } 278 278 279 279 void Pasteboard::clear() 280 280 { 281 platformStrategies()->pasteboardStrategy()->writeToPasteboard(String(), String() );281 platformStrategies()->pasteboardStrategy()->writeToPasteboard(String(), String(), m_pasteboardName); 282 282 } 283 283 … … 286 286 PasteboardStrategy& strategy = *platformStrategies()->pasteboardStrategy(); 287 287 288 int numberOfItems = strategy.getPasteboardItemsCount( );288 int numberOfItems = strategy.getPasteboardItemsCount(m_pasteboardName); 289 289 290 290 if (!numberOfItems) … … 297 297 298 298 if ([cocoaType isEqualToString:(NSString *)kUTTypeURL]) { 299 URL url = strategy.readURLFromPasteboard(0, kUTTypeURL );299 URL url = strategy.readURLFromPasteboard(0, kUTTypeURL, m_pasteboardName); 300 300 if (!url.isNull()) 301 301 cocoaValue = [(NSURL *)url absoluteString]; 302 302 } else if ([cocoaType isEqualToString:(NSString *)kUTTypeText]) { 303 String value = strategy.readStringFromPasteboard(0, kUTTypeText );303 String value = strategy.readStringFromPasteboard(0, kUTTypeText, m_pasteboardName); 304 304 if (!value.isNull()) 305 305 cocoaValue = [(NSString *)value precomposedStringWithCanonicalMapping]; 306 306 } else if (cocoaType) { 307 if (RefPtr<SharedBuffer> buffer = strategy.readBufferFromPasteboard(0, cocoaType.get() ))307 if (RefPtr<SharedBuffer> buffer = strategy.readBufferFromPasteboard(0, cocoaType.get(), m_pasteboardName)) 308 308 cocoaValue = [[[NSString alloc] initWithData:buffer->createNSData().get() encoding:NSUTF8StringEncoding] autorelease]; 309 309 } … … 311 311 // Enforce changeCount ourselves for security. We check after reading instead of before to be 312 312 // sure it doesn't change between our testing the change count and accessing the data. 313 if (cocoaValue && m_changeCount == platformStrategies()->pasteboardStrategy()->changeCount( ))313 if (cocoaValue && m_changeCount == platformStrategies()->pasteboardStrategy()->changeCount(m_pasteboardName)) 314 314 return cocoaValue; 315 315 … … 343 343 return; 344 344 345 platformStrategies()->pasteboardStrategy()->writeToPasteboard(type, data );345 platformStrategies()->pasteboardStrategy()->writeToPasteboard(type, data, m_pasteboardName); 346 346 } 347 347 … … 352 352 // Enforce changeCount ourselves for security. We check after reading instead of before to be 353 353 // sure it doesn't change between our testing the change count and accessing the data. 354 if (m_changeCount != platformStrategies()->pasteboardStrategy()->changeCount( ))354 if (m_changeCount != platformStrategies()->pasteboardStrategy()->changeCount(m_pasteboardName)) 355 355 return Vector<String>(); 356 356 -
trunk/Source/WebKit/mac/ChangeLog
r211156 r211158 1 2017-01-25 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Add support for named pasteboards, pasteboard strategies and platform pasteboards 4 https://bugs.webkit.org/show_bug.cgi?id=167404 5 6 Reviewed by Enrica Casucci. 7 8 Adds pasteboard name as an argument to pasteboard-related WebPlatformStrategy methods. 9 10 * WebCoreSupport/WebPlatformStrategies.h: 11 * WebCoreSupport/WebPlatformStrategies.mm: 12 (WebPlatformStrategies::writeToPasteboard): 13 (WebPlatformStrategies::getPasteboardItemsCount): 14 (WebPlatformStrategies::readBufferFromPasteboard): 15 (WebPlatformStrategies::readURLFromPasteboard): 16 (WebPlatformStrategies::readStringFromPasteboard): 17 1 18 2017-01-25 Aakash Jain <aakash_jain@apple.com> 2 19 -
trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h
r204287 r211158 60 60 // WebCore::PasteboardStrategy 61 61 #if PLATFORM(IOS) 62 void writeToPasteboard(const WebCore::PasteboardWebContent&) override; 63 void writeToPasteboard(const WebCore::PasteboardImage&) override; 64 void writeToPasteboard(const String& pasteboardType, const String&) override; 65 int getPasteboardItemsCount() override; 66 String readStringFromPasteboard(int index, const String& pasteboardType) override; 67 RefPtr<WebCore::SharedBuffer> readBufferFromPasteboard(int index, const String& pasteboardType) override; 68 WebCore::URL readURLFromPasteboard(int index, const String& pasteboardType) override; 69 long changeCount() override; 62 void writeToPasteboard(const WebCore::PasteboardWebContent&, const String& pasteboardName) override; 63 void writeToPasteboard(const WebCore::PasteboardImage&, const String& pasteboardName) override; 64 void writeToPasteboard(const String& pasteboardType, const String&, const String& pasteboardName) override; 65 int getPasteboardItemsCount(const String& pasteboardName) override; 66 String readStringFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) override; 67 RefPtr<WebCore::SharedBuffer> readBufferFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) override; 68 WebCore::URL readURLFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) override; 70 69 #endif 71 70 void getTypes(Vector<String>& types, const String& pasteboardName) override; -
trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm
r210697 r211158 187 187 188 188 #if PLATFORM(IOS) 189 void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardWebContent& content) 190 { 191 PlatformPasteboard().write(content); 192 } 193 194 void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardImage& image) 195 { 196 PlatformPasteboard().write(image); 197 } 198 199 void WebPlatformStrategies::writeToPasteboard(const String& pasteboardType, const String& text) 200 { 201 PlatformPasteboard().write(pasteboardType, text); 202 } 203 204 int WebPlatformStrategies::getPasteboardItemsCount() 205 { 206 return PlatformPasteboard().count(); 207 } 208 209 RefPtr<WebCore::SharedBuffer> WebPlatformStrategies::readBufferFromPasteboard(int index, const String& type) 210 { 211 return PlatformPasteboard().readBuffer(index, type); 212 } 213 214 WebCore::URL WebPlatformStrategies::readURLFromPasteboard(int index, const String& type) 215 { 216 return PlatformPasteboard().readURL(index, type); 217 } 218 219 String WebPlatformStrategies::readStringFromPasteboard(int index, const String& type) 220 { 221 return PlatformPasteboard().readString(index, type); 222 } 223 224 long WebPlatformStrategies::changeCount() 225 { 226 return PlatformPasteboard().changeCount(); 189 void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardWebContent& content, const String& pasteboardName) 190 { 191 PlatformPasteboard(pasteboardName).write(content); 192 } 193 194 void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardImage& image, const String& pasteboardName) 195 { 196 PlatformPasteboard(pasteboardName).write(image); 197 } 198 199 void WebPlatformStrategies::writeToPasteboard(const String& pasteboardType, const String& text, const String& pasteboardName) 200 { 201 PlatformPasteboard(pasteboardName).write(pasteboardType, text); 202 } 203 204 int WebPlatformStrategies::getPasteboardItemsCount(const String& pasteboardName) 205 { 206 return PlatformPasteboard(pasteboardName).count(); 207 } 208 209 RefPtr<WebCore::SharedBuffer> WebPlatformStrategies::readBufferFromPasteboard(int index, const String& type, const String& pasteboardName) 210 { 211 return PlatformPasteboard(pasteboardName).readBuffer(index, type); 212 } 213 214 WebCore::URL WebPlatformStrategies::readURLFromPasteboard(int index, const String& type, const String& pasteboardName) 215 { 216 return PlatformPasteboard(pasteboardName).readURL(index, type); 217 } 218 219 String WebPlatformStrategies::readStringFromPasteboard(int index, const String& type, const String& pasteboardName) 220 { 221 return PlatformPasteboard(pasteboardName).readString(index, type); 227 222 } 228 223 #endif // PLATFORM(IOS) -
trunk/Source/WebKit2/ChangeLog
r211147 r211158 1 2017-01-25 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Add support for named pasteboards, pasteboard strategies and platform pasteboards 4 https://bugs.webkit.org/show_bug.cgi?id=167404 5 6 Reviewed by Enrica Casucci. 7 8 Adds support for delivering the pasteboard name to the UI process when writing to or reading from the pasteboard. 9 10 * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: 11 (WebKit::WebPasteboardProxy::writeWebContentToPasteboard): 12 (WebKit::WebPasteboardProxy::writeImageToPasteboard): 13 (WebKit::WebPasteboardProxy::writeStringToPasteboard): 14 (WebKit::WebPasteboardProxy::readStringFromPasteboard): 15 (WebKit::WebPasteboardProxy::readURLFromPasteboard): 16 (WebKit::WebPasteboardProxy::readBufferFromPasteboard): 17 (WebKit::WebPasteboardProxy::getPasteboardItemsCount): 18 * UIProcess/WebPasteboardProxy.h: 19 * UIProcess/WebPasteboardProxy.messages.in: 20 * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: 21 (WebKit::WebPlatformStrategies::writeToPasteboard): 22 (WebKit::WebPlatformStrategies::getPasteboardItemsCount): 23 (WebKit::WebPlatformStrategies::readBufferFromPasteboard): 24 (WebKit::WebPlatformStrategies::readURLFromPasteboard): 25 (WebKit::WebPlatformStrategies::readStringFromPasteboard): 26 * WebProcess/WebCoreSupport/WebPlatformStrategies.h: 27 1 28 2017-01-25 Carlos Garcia Campos <cgarcia@igalia.com> 2 29 -
trunk/Source/WebKit2/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm
r210861 r211158 136 136 137 137 #if PLATFORM(IOS) 138 void WebPasteboardProxy::writeWebContentToPasteboard(const WebCore::PasteboardWebContent& content )138 void WebPasteboardProxy::writeWebContentToPasteboard(const WebCore::PasteboardWebContent& content, const String& pasteboardName) 139 139 { 140 PlatformPasteboard( ).write(content);140 PlatformPasteboard(pasteboardName).write(content); 141 141 } 142 142 143 void WebPasteboardProxy::writeImageToPasteboard(const WebCore::PasteboardImage& pasteboardImage )143 void WebPasteboardProxy::writeImageToPasteboard(const WebCore::PasteboardImage& pasteboardImage, const String& pasteboardName) 144 144 { 145 PlatformPasteboard( ).write(pasteboardImage);145 PlatformPasteboard(pasteboardName).write(pasteboardImage); 146 146 } 147 147 148 void WebPasteboardProxy::writeStringToPasteboard(const String& pasteboardType, const String& text )148 void WebPasteboardProxy::writeStringToPasteboard(const String& pasteboardType, const String& text, const String& pasteboardName) 149 149 { 150 PlatformPasteboard( ).write(pasteboardType, text);150 PlatformPasteboard(pasteboardName).write(pasteboardType, text); 151 151 } 152 152 153 void WebPasteboardProxy::readStringFromPasteboard(uint64_t index, const String& pasteboardType, WTF::String& value)153 void WebPasteboardProxy::readStringFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, WTF::String& value) 154 154 { 155 value = PlatformPasteboard( ).readString(index, pasteboardType);155 value = PlatformPasteboard(pasteboardName).readString(index, pasteboardType); 156 156 } 157 157 158 void WebPasteboardProxy::readURLFromPasteboard(uint64_t index, const String& pasteboardType, String& url)158 void WebPasteboardProxy::readURLFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, String& url) 159 159 { 160 url = PlatformPasteboard( ).readURL(index, pasteboardType);160 url = PlatformPasteboard(pasteboardName).readURL(index, pasteboardType); 161 161 } 162 162 163 void WebPasteboardProxy::readBufferFromPasteboard(uint64_t index, const String& pasteboardType, SharedMemory::Handle& handle, uint64_t& size)163 void WebPasteboardProxy::readBufferFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, SharedMemory::Handle& handle, uint64_t& size) 164 164 { 165 RefPtr<SharedBuffer> buffer = PlatformPasteboard( ).readBuffer(index, pasteboardType);165 RefPtr<SharedBuffer> buffer = PlatformPasteboard(pasteboardName).readBuffer(index, pasteboardType); 166 166 if (!buffer) 167 167 return; … … 174 174 } 175 175 176 void WebPasteboardProxy::getPasteboardItemsCount( uint64_t& itemsCount)176 void WebPasteboardProxy::getPasteboardItemsCount(const String& pasteboardName, uint64_t& itemsCount) 177 177 { 178 itemsCount = PlatformPasteboard( ).count();178 itemsCount = PlatformPasteboard(pasteboardName).count(); 179 179 } 180 180 -
trunk/Source/WebKit2/UIProcess/WebPasteboardProxy.h
r210683 r211158 69 69 70 70 #if PLATFORM(IOS) 71 void writeWebContentToPasteboard(const WebCore::PasteboardWebContent& );72 void writeImageToPasteboard(const WebCore::PasteboardImage& );73 void writeStringToPasteboard(const String& pasteboardType, const String& );74 void readStringFromPasteboard(uint64_t index, const String& pasteboardType, WTF::String&);75 void readURLFromPasteboard(uint64_t index, const String& pasteboardType, String&);76 void readBufferFromPasteboard(uint64_t index, const String& pasteboardType, SharedMemory::Handle&, uint64_t& size);77 void getPasteboardItemsCount( uint64_t& itemsCount);71 void writeWebContentToPasteboard(const WebCore::PasteboardWebContent&, const String& pasteboardName); 72 void writeImageToPasteboard(const WebCore::PasteboardImage&, const String& pasteboardName); 73 void writeStringToPasteboard(const String& pasteboardType, const String&, const String& pasteboardName); 74 void readStringFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, WTF::String&); 75 void readURLFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, String&); 76 void readBufferFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, SharedMemory::Handle&, uint64_t& size); 77 void getPasteboardItemsCount(const String& pasteboardName, uint64_t& itemsCount); 78 78 #endif 79 79 #if PLATFORM(COCOA) -
trunk/Source/WebKit2/UIProcess/WebPasteboardProxy.messages.in
r210683 r211158 23 23 messages -> WebPasteboardProxy { 24 24 #if PLATFORM(IOS) 25 WriteWebContentToPasteboard(struct WebCore::PasteboardWebContent content )26 WriteImageToPasteboard(struct WebCore::PasteboardImage pasteboardImage )27 WriteStringToPasteboard(String pasteboardType, String text )28 ReadStringFromPasteboard(uint64_t index, String pasteboardType ) -> (String string)29 ReadURLFromPasteboard(uint64_t index, String pasteboardType ) -> (String string)30 ReadBufferFromPasteboard(uint64_t index, String pasteboardType ) -> (WebKit::SharedMemory::Handle handle, uint64_t size)31 GetPasteboardItemsCount( ) -> (uint64_t itemsCount)25 WriteWebContentToPasteboard(struct WebCore::PasteboardWebContent content, String pasteboardName) 26 WriteImageToPasteboard(struct WebCore::PasteboardImage pasteboardImage, String pasteboardName) 27 WriteStringToPasteboard(String pasteboardType, String text, String pasteboardName) 28 ReadStringFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (String string) 29 ReadURLFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (String string) 30 ReadBufferFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (WebKit::SharedMemory::Handle handle, uint64_t size) 31 GetPasteboardItemsCount(String pasteboardName) -> (uint64_t itemsCount) 32 32 #endif 33 33 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
r206256 r211158 286 286 287 287 #if PLATFORM(IOS) 288 void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardWebContent& content )289 { 290 WebProcess::singleton().parentProcessConnection()->send(Messages::WebPasteboardProxy::WriteWebContentToPasteboard(content ), 0);291 } 292 293 void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardImage& image )294 { 295 WebProcess::singleton().parentProcessConnection()->send(Messages::WebPasteboardProxy::WriteImageToPasteboard(image ), 0);296 } 297 298 void WebPlatformStrategies::writeToPasteboard(const String& pasteboardType, const String& text )299 { 300 WebProcess::singleton().parentProcessConnection()->send(Messages::WebPasteboardProxy::WriteStringToPasteboard(pasteboardType, text ), 0);301 } 302 303 int WebPlatformStrategies::getPasteboardItemsCount( )288 void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardWebContent& content, const String& pasteboardName) 289 { 290 WebProcess::singleton().parentProcessConnection()->send(Messages::WebPasteboardProxy::WriteWebContentToPasteboard(content, pasteboardName), 0); 291 } 292 293 void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardImage& image, const String& pasteboardName) 294 { 295 WebProcess::singleton().parentProcessConnection()->send(Messages::WebPasteboardProxy::WriteImageToPasteboard(image, pasteboardName), 0); 296 } 297 298 void WebPlatformStrategies::writeToPasteboard(const String& pasteboardType, const String& text, const String& pasteboardName) 299 { 300 WebProcess::singleton().parentProcessConnection()->send(Messages::WebPasteboardProxy::WriteStringToPasteboard(pasteboardType, text, pasteboardName), 0); 301 } 302 303 int WebPlatformStrategies::getPasteboardItemsCount(const String& pasteboardName) 304 304 { 305 305 uint64_t itemsCount; 306 WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardItemsCount( ), Messages::WebPasteboardProxy::GetPasteboardItemsCount::Reply(itemsCount), 0);306 WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardItemsCount(pasteboardName), Messages::WebPasteboardProxy::GetPasteboardItemsCount::Reply(itemsCount), 0); 307 307 return itemsCount; 308 308 } 309 309 310 RefPtr<WebCore::SharedBuffer> WebPlatformStrategies::readBufferFromPasteboard(int index, const String& pasteboardType )310 RefPtr<WebCore::SharedBuffer> WebPlatformStrategies::readBufferFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) 311 311 { 312 312 SharedMemory::Handle handle; 313 313 uint64_t size = 0; 314 WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadBufferFromPasteboard(index, pasteboardType ), Messages::WebPasteboardProxy::ReadBufferFromPasteboard::Reply(handle, size), 0);314 WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadBufferFromPasteboard(index, pasteboardType, pasteboardName), Messages::WebPasteboardProxy::ReadBufferFromPasteboard::Reply(handle, size), 0); 315 315 if (handle.isNull()) 316 316 return nullptr; … … 319 319 } 320 320 321 WebCore::URL WebPlatformStrategies::readURLFromPasteboard(int index, const String& pasteboardType )321 WebCore::URL WebPlatformStrategies::readURLFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) 322 322 { 323 323 String urlString; 324 WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadURLFromPasteboard(index, pasteboardType ), Messages::WebPasteboardProxy::ReadURLFromPasteboard::Reply(urlString), 0);324 WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadURLFromPasteboard(index, pasteboardType, pasteboardName), Messages::WebPasteboardProxy::ReadURLFromPasteboard::Reply(urlString), 0); 325 325 return URL(ParsedURLString, urlString); 326 326 } 327 327 328 String WebPlatformStrategies::readStringFromPasteboard(int index, const String& pasteboardType )328 String WebPlatformStrategies::readStringFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) 329 329 { 330 330 String value; 331 WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadStringFromPasteboard(index, pasteboardType ), Messages::WebPasteboardProxy::ReadStringFromPasteboard::Reply(value), 0);331 WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadStringFromPasteboard(index, pasteboardType, pasteboardName), Messages::WebPasteboardProxy::ReadStringFromPasteboard::Reply(value), 0); 332 332 return value; 333 333 } 334 335 long WebPlatformStrategies::changeCount()336 {337 uint64_t changeCount;338 WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardChangeCount(String()), Messages::WebPasteboardProxy::GetPasteboardChangeCount::Reply(changeCount), 0);339 return changeCount;340 }341 342 334 #endif // PLATFORM(IOS) 343 335 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h
r206256 r211158 61 61 // WebCore::PasteboardStrategy 62 62 #if PLATFORM(IOS) 63 void writeToPasteboard(const WebCore::PasteboardWebContent&) override; 64 void writeToPasteboard(const WebCore::PasteboardImage&) override; 65 void writeToPasteboard(const String& pasteboardType, const String&) override; 66 int getPasteboardItemsCount() override; 67 String readStringFromPasteboard(int index, const String& pasteboardType) override; 68 RefPtr<WebCore::SharedBuffer> readBufferFromPasteboard(int index, const String& pasteboardType) override; 69 WebCore::URL readURLFromPasteboard(int index, const String& pasteboardType) override; 70 long changeCount() override; 63 void writeToPasteboard(const WebCore::PasteboardWebContent&, const String& pasteboardName) override; 64 void writeToPasteboard(const WebCore::PasteboardImage&, const String& pasteboardName) override; 65 void writeToPasteboard(const String& pasteboardType, const String&, const String& pasteboardName) override; 66 int getPasteboardItemsCount(const String& pasteboardName) override; 67 String readStringFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) override; 68 RefPtr<WebCore::SharedBuffer> readBufferFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) override; 69 WebCore::URL readURLFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) override; 71 70 #endif 72 71 #if PLATFORM(COCOA)
Note: See TracChangeset
for help on using the changeset viewer.