Changeset 211158 in webkit


Ignore:
Timestamp:
Jan 25, 2017 12:16:17 PM (7 years ago)
Author:
Wenson Hsieh
Message:

Add support for named pasteboards, pasteboard strategies and platform pasteboards
https://bugs.webkit.org/show_bug.cgi?id=167404

Reviewed by Enrica Casucci.

Source/WebCore:

Refactors some pasteboard-related code to plumb the name of the pasteboard across from WebCore to the client
layer. No new tests, because there should be no change in behavior.

  • platform/DragData.h:
  • platform/Pasteboard.h:
  • platform/PasteboardStrategy.h:
  • platform/PlatformPasteboard.h:
  • platform/ios/PasteboardIOS.mm:

(WebCore::Pasteboard::Pasteboard):
(WebCore::Pasteboard::write):
(WebCore::Pasteboard::writePlainText):
(WebCore::Pasteboard::read):
(WebCore::Pasteboard::hasData):
(WebCore::Pasteboard::clear):
(WebCore::Pasteboard::readString):
(WebCore::Pasteboard::writeString):
(WebCore::Pasteboard::types):

Source/WebKit/mac:

Adds pasteboard name as an argument to pasteboard-related WebPlatformStrategy methods.

  • WebCoreSupport/WebPlatformStrategies.h:
  • WebCoreSupport/WebPlatformStrategies.mm:

(WebPlatformStrategies::writeToPasteboard):
(WebPlatformStrategies::getPasteboardItemsCount):
(WebPlatformStrategies::readBufferFromPasteboard):
(WebPlatformStrategies::readURLFromPasteboard):
(WebPlatformStrategies::readStringFromPasteboard):

Source/WebKit2:

Adds support for delivering the pasteboard name to the UI process when writing to or reading from the pasteboard.

  • UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:

(WebKit::WebPasteboardProxy::writeWebContentToPasteboard):
(WebKit::WebPasteboardProxy::writeImageToPasteboard):
(WebKit::WebPasteboardProxy::writeStringToPasteboard):
(WebKit::WebPasteboardProxy::readStringFromPasteboard):
(WebKit::WebPasteboardProxy::readURLFromPasteboard):
(WebKit::WebPasteboardProxy::readBufferFromPasteboard):
(WebKit::WebPasteboardProxy::getPasteboardItemsCount):

  • UIProcess/WebPasteboardProxy.h:
  • UIProcess/WebPasteboardProxy.messages.in:
  • WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:

(WebKit::WebPlatformStrategies::writeToPasteboard):
(WebKit::WebPlatformStrategies::getPasteboardItemsCount):
(WebKit::WebPlatformStrategies::readBufferFromPasteboard):
(WebKit::WebPlatformStrategies::readURLFromPasteboard):
(WebKit::WebPlatformStrategies::readStringFromPasteboard):

  • WebProcess/WebCoreSupport/WebPlatformStrategies.h:
Location:
trunk/Source
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r211154 r211158  
     12017-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
    1262017-01-25  Antoine Quint  <graouts@apple.com>
    227
  • trunk/Source/WebCore/platform/DragData.h

    r210360 r211158  
    108108    void setFileNames(Vector<String>& fileNames) { m_fileNames = WTFMove(fileNames); }
    109109    const Vector<String>& fileNames() const { return m_fileNames; }
    110 #if PLATFORM(MAC)
     110#if PLATFORM(COCOA)
    111111    const String& pasteboardName() const { return m_pasteboardName; }
    112112    bool containsPromise() const;
     
    133133    DragApplicationFlags m_applicationFlags;
    134134    Vector<String> m_fileNames;
    135 #if PLATFORM(MAC)
     135#if PLATFORM(COCOA)
    136136    String m_pasteboardName;
    137137#endif
  • trunk/Source/WebCore/platform/Pasteboard.h

    r208576 r211158  
    202202#endif
    203203
    204 #if PLATFORM(MAC)
     204#if PLATFORM(COCOA)
    205205    explicit Pasteboard(const String& pasteboardName);
    206206
     
    232232#endif
    233233
    234 #if PLATFORM(IOS)
    235     long m_changeCount;
    236 #endif
    237 
    238 #if PLATFORM(MAC)
     234#if PLATFORM(COCOA)
    239235    String m_pasteboardName;
    240236    long m_changeCount;
  • trunk/Source/WebCore/platform/PasteboardStrategy.h

    r206256 r211158  
    4343public:
    4444#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;
    5452#endif // PLATFORM(IOS)
    5553#if PLATFORM(COCOA)
  • trunk/Source/WebCore/platform/PlatformPasteboard.h

    r206256 r211158  
    5252class PlatformPasteboard {
    5353public:
    54     // FIXME: probably we don't need a constructor that takes a pasteboard name for iOS.
    5554    WEBCORE_EXPORT explicit PlatformPasteboard(const String& pasteboardName);
    5655#if PLATFORM(IOS)
  • trunk/Source/WebCore/platform/ios/PasteboardIOS.mm

    r210828 r211158  
    8383
    8484Pasteboard::Pasteboard()
    85     : m_changeCount(platformStrategies()->pasteboardStrategy()->changeCount())
     85    : m_changeCount(platformStrategies()->pasteboardStrategy()->changeCount(m_pasteboardName))
    8686{
    8787}
     
    103103void Pasteboard::write(const PasteboardWebContent& content)
    104104{
    105     platformStrategies()->pasteboardStrategy()->writeToPasteboard(content);
     105    platformStrategies()->pasteboardStrategy()->writeToPasteboard(content, m_pasteboardName);
    106106}
    107107
     
    113113void Pasteboard::write(const PasteboardImage& pasteboardImage)
    114114{
    115     platformStrategies()->pasteboardStrategy()->writeToPasteboard(pasteboardImage);
     115    platformStrategies()->pasteboardStrategy()->writeToPasteboard(pasteboardImage, m_pasteboardName);
    116116}
    117117
    118118void Pasteboard::writePlainText(const String& text, SmartReplaceOption)
    119119{
    120     platformStrategies()->pasteboardStrategy()->writeToPasteboard(kUTTypeText, text);
     120    platformStrategies()->pasteboardStrategy()->writeToPasteboard(kUTTypeText, text, m_pasteboardName);
    121121}
    122122
    123123void Pasteboard::write(const PasteboardURL& pasteboardURL)
    124124{
    125     platformStrategies()->pasteboardStrategy()->writeToPasteboard(kUTTypeURL, pasteboardURL.url.string());
     125    platformStrategies()->pasteboardStrategy()->writeToPasteboard(kUTTypeURL, pasteboardURL.url.string(), m_pasteboardName);
    126126}
    127127
     
    147147{
    148148    PasteboardStrategy& strategy = *platformStrategies()->pasteboardStrategy();
    149     text.text = strategy.readStringFromPasteboard(0, kUTTypeText);
     149    text.text = strategy.readStringFromPasteboard(0, kUTTypeText, m_pasteboardName);
    150150    if (text.text.isEmpty())
    151         text.text = strategy.readStringFromPasteboard(0, kUTTypeURL);
     151        text.text = strategy.readStringFromPasteboard(0, kUTTypeURL, m_pasteboardName);
    152152}
    153153
     
    161161    PasteboardStrategy& strategy = *platformStrategies()->pasteboardStrategy();
    162162
    163     int numberOfItems = strategy.getPasteboardItemsCount();
     163    int numberOfItems = strategy.getPasteboardItemsCount(m_pasteboardName);
    164164
    165165    if (!numberOfItems)
     
    174174
    175175            if ([type isEqualToString:WebArchivePboardType]) {
    176                 if (RefPtr<SharedBuffer> buffer = strategy.readBufferFromPasteboard(i, WebArchivePboardType)) {
     176                if (RefPtr<SharedBuffer> buffer = strategy.readBufferFromPasteboard(i, WebArchivePboardType, m_pasteboardName)) {
    177177                    if (reader.readWebArchive(buffer.get()))
    178178                        break;
     
    181181
    182182            if ([type isEqualToString:(NSString *)kUTTypeHTML]) {
    183                 String htmlString = strategy.readStringFromPasteboard(i, kUTTypeHTML);
     183                String htmlString = strategy.readStringFromPasteboard(i, kUTTypeHTML, m_pasteboardName);
    184184                if (!htmlString.isNull() && reader.readHTML(htmlString))
    185185                    break;
     
    187187
    188188            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)) {
    190190                    if (reader.readRTFD(*buffer))
    191191                        break;
     
    194194
    195195            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)) {
    197197                    if (reader.readRTF(*buffer))
    198198                        break;
     
    201201
    202202            if ([supportedImageTypes() containsObject:type]) {
    203                 if (RefPtr<SharedBuffer> buffer = strategy.readBufferFromPasteboard(i, type)) {
     203                if (RefPtr<SharedBuffer> buffer = strategy.readBufferFromPasteboard(i, type, m_pasteboardName)) {
    204204                    if (reader.readImage(buffer.releaseNonNull(), type))
    205205                        break;
     
    208208
    209209            if ([type isEqualToString:(NSString *)kUTTypeURL]) {
    210                 URL url = strategy.readURLFromPasteboard(i, kUTTypeURL);
     210                URL url = strategy.readURLFromPasteboard(i, kUTTypeURL, m_pasteboardName);
    211211                if (!url.isNull() && reader.readURL(url, String()))
    212212                    break;
     
    214214           
    215215            if ([type isEqualToString:(NSString *)kUTTypeText]) {
    216                 String string = strategy.readStringFromPasteboard(i, kUTTypeText);
     216                String string = strategy.readStringFromPasteboard(i, kUTTypeText, m_pasteboardName);
    217217                if (!string.isNull() && reader.readPlainText(string))
    218218                    break;
     
    230230bool Pasteboard::hasData()
    231231{
    232     return platformStrategies()->pasteboardStrategy()->getPasteboardItemsCount() != 0;
     232    return !!platformStrategies()->pasteboardStrategy()->getPasteboardItemsCount(m_pasteboardName);
    233233}
    234234
     
    274274        return;
    275275
    276     platformStrategies()->pasteboardStrategy()->writeToPasteboard(cocoaType.get(), String());
     276    platformStrategies()->pasteboardStrategy()->writeToPasteboard(cocoaType.get(), String(), m_pasteboardName);
    277277}
    278278
    279279void Pasteboard::clear()
    280280{
    281     platformStrategies()->pasteboardStrategy()->writeToPasteboard(String(), String());
     281    platformStrategies()->pasteboardStrategy()->writeToPasteboard(String(), String(), m_pasteboardName);
    282282}
    283283
     
    286286    PasteboardStrategy& strategy = *platformStrategies()->pasteboardStrategy();
    287287
    288     int numberOfItems = strategy.getPasteboardItemsCount();
     288    int numberOfItems = strategy.getPasteboardItemsCount(m_pasteboardName);
    289289
    290290    if (!numberOfItems)
     
    297297
    298298    if ([cocoaType isEqualToString:(NSString *)kUTTypeURL]) {
    299         URL url = strategy.readURLFromPasteboard(0, kUTTypeURL);
     299        URL url = strategy.readURLFromPasteboard(0, kUTTypeURL, m_pasteboardName);
    300300        if (!url.isNull())
    301301            cocoaValue = [(NSURL *)url absoluteString];
    302302    } else if ([cocoaType isEqualToString:(NSString *)kUTTypeText]) {
    303         String value = strategy.readStringFromPasteboard(0, kUTTypeText);
     303        String value = strategy.readStringFromPasteboard(0, kUTTypeText, m_pasteboardName);
    304304        if (!value.isNull())
    305305            cocoaValue = [(NSString *)value precomposedStringWithCanonicalMapping];
    306306    } 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))
    308308            cocoaValue = [[[NSString alloc] initWithData:buffer->createNSData().get() encoding:NSUTF8StringEncoding] autorelease];
    309309    }
     
    311311    // Enforce changeCount ourselves for security. We check after reading instead of before to be
    312312    // 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))
    314314        return cocoaValue;
    315315
     
    343343        return;
    344344
    345     platformStrategies()->pasteboardStrategy()->writeToPasteboard(type, data);
     345    platformStrategies()->pasteboardStrategy()->writeToPasteboard(type, data, m_pasteboardName);
    346346}
    347347
     
    352352    // Enforce changeCount ourselves for security. We check after reading instead of before to be
    353353    // 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))
    355355        return Vector<String>();
    356356
  • trunk/Source/WebKit/mac/ChangeLog

    r211156 r211158  
     12017-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
    1182017-01-25  Aakash Jain  <aakash_jain@apple.com>
    219
  • trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h

    r204287 r211158  
    6060    // WebCore::PasteboardStrategy
    6161#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;
    7069#endif
    7170    void getTypes(Vector<String>& types, const String& pasteboardName) override;
  • trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm

    r210697 r211158  
    187187
    188188#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();
     189void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardWebContent& content, const String& pasteboardName)
     190{
     191    PlatformPasteboard(pasteboardName).write(content);
     192}
     193
     194void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardImage& image, const String& pasteboardName)
     195{
     196    PlatformPasteboard(pasteboardName).write(image);
     197}
     198
     199void WebPlatformStrategies::writeToPasteboard(const String& pasteboardType, const String& text, const String& pasteboardName)
     200{
     201    PlatformPasteboard(pasteboardName).write(pasteboardType, text);
     202}
     203
     204int WebPlatformStrategies::getPasteboardItemsCount(const String& pasteboardName)
     205{
     206    return PlatformPasteboard(pasteboardName).count();
     207}
     208
     209RefPtr<WebCore::SharedBuffer> WebPlatformStrategies::readBufferFromPasteboard(int index, const String& type, const String& pasteboardName)
     210{
     211    return PlatformPasteboard(pasteboardName).readBuffer(index, type);
     212}
     213
     214WebCore::URL WebPlatformStrategies::readURLFromPasteboard(int index, const String& type, const String& pasteboardName)
     215{
     216    return PlatformPasteboard(pasteboardName).readURL(index, type);
     217}
     218
     219String WebPlatformStrategies::readStringFromPasteboard(int index, const String& type, const String& pasteboardName)
     220{
     221    return PlatformPasteboard(pasteboardName).readString(index, type);
    227222}
    228223#endif // PLATFORM(IOS)
  • trunk/Source/WebKit2/ChangeLog

    r211147 r211158  
     12017-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
    1282017-01-25  Carlos Garcia Campos  <cgarcia@igalia.com>
    229
  • trunk/Source/WebKit2/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm

    r210861 r211158  
    136136
    137137#if PLATFORM(IOS)
    138 void WebPasteboardProxy::writeWebContentToPasteboard(const WebCore::PasteboardWebContent& content)
     138void WebPasteboardProxy::writeWebContentToPasteboard(const WebCore::PasteboardWebContent& content, const String& pasteboardName)
    139139{
    140     PlatformPasteboard().write(content);
     140    PlatformPasteboard(pasteboardName).write(content);
    141141}
    142142
    143 void WebPasteboardProxy::writeImageToPasteboard(const WebCore::PasteboardImage& pasteboardImage)
     143void WebPasteboardProxy::writeImageToPasteboard(const WebCore::PasteboardImage& pasteboardImage, const String& pasteboardName)
    144144{
    145     PlatformPasteboard().write(pasteboardImage);
     145    PlatformPasteboard(pasteboardName).write(pasteboardImage);
    146146}
    147147
    148 void WebPasteboardProxy::writeStringToPasteboard(const String& pasteboardType, const String& text)
     148void WebPasteboardProxy::writeStringToPasteboard(const String& pasteboardType, const String& text, const String& pasteboardName)
    149149{
    150     PlatformPasteboard().write(pasteboardType, text);
     150    PlatformPasteboard(pasteboardName).write(pasteboardType, text);
    151151}
    152152
    153 void WebPasteboardProxy::readStringFromPasteboard(uint64_t index, const String& pasteboardType, WTF::String& value)
     153void WebPasteboardProxy::readStringFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, WTF::String& value)
    154154{
    155     value = PlatformPasteboard().readString(index, pasteboardType);
     155    value = PlatformPasteboard(pasteboardName).readString(index, pasteboardType);
    156156}
    157157
    158 void WebPasteboardProxy::readURLFromPasteboard(uint64_t index, const String& pasteboardType, String& url)
     158void WebPasteboardProxy::readURLFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, String& url)
    159159{
    160     url = PlatformPasteboard().readURL(index, pasteboardType);
     160    url = PlatformPasteboard(pasteboardName).readURL(index, pasteboardType);
    161161}
    162162
    163 void WebPasteboardProxy::readBufferFromPasteboard(uint64_t index, const String& pasteboardType, SharedMemory::Handle& handle, uint64_t& size)
     163void WebPasteboardProxy::readBufferFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, SharedMemory::Handle& handle, uint64_t& size)
    164164{
    165     RefPtr<SharedBuffer> buffer = PlatformPasteboard().readBuffer(index, pasteboardType);
     165    RefPtr<SharedBuffer> buffer = PlatformPasteboard(pasteboardName).readBuffer(index, pasteboardType);
    166166    if (!buffer)
    167167        return;
     
    174174}
    175175
    176 void WebPasteboardProxy::getPasteboardItemsCount(uint64_t& itemsCount)
     176void WebPasteboardProxy::getPasteboardItemsCount(const String& pasteboardName, uint64_t& itemsCount)
    177177{
    178     itemsCount = PlatformPasteboard().count();
     178    itemsCount = PlatformPasteboard(pasteboardName).count();
    179179}
    180180
  • trunk/Source/WebKit2/UIProcess/WebPasteboardProxy.h

    r210683 r211158  
    6969
    7070#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);
    7878#endif
    7979#if PLATFORM(COCOA)
  • trunk/Source/WebKit2/UIProcess/WebPasteboardProxy.messages.in

    r210683 r211158  
    2323messages -> WebPasteboardProxy {
    2424#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)
    3232#endif
    3333
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp

    r206256 r211158  
    286286
    287287#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()
     288void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardWebContent& content, const String& pasteboardName)
     289{
     290    WebProcess::singleton().parentProcessConnection()->send(Messages::WebPasteboardProxy::WriteWebContentToPasteboard(content, pasteboardName), 0);
     291}
     292
     293void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardImage& image, const String& pasteboardName)
     294{
     295    WebProcess::singleton().parentProcessConnection()->send(Messages::WebPasteboardProxy::WriteImageToPasteboard(image, pasteboardName), 0);
     296}
     297
     298void 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
     303int WebPlatformStrategies::getPasteboardItemsCount(const String& pasteboardName)
    304304{
    305305    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);
    307307    return itemsCount;
    308308}
    309309
    310 RefPtr<WebCore::SharedBuffer> WebPlatformStrategies::readBufferFromPasteboard(int index, const String& pasteboardType)
     310RefPtr<WebCore::SharedBuffer> WebPlatformStrategies::readBufferFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName)
    311311{
    312312    SharedMemory::Handle handle;
    313313    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);
    315315    if (handle.isNull())
    316316        return nullptr;
     
    319319}
    320320
    321 WebCore::URL WebPlatformStrategies::readURLFromPasteboard(int index, const String& pasteboardType)
     321WebCore::URL WebPlatformStrategies::readURLFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName)
    322322{
    323323    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);
    325325    return URL(ParsedURLString, urlString);
    326326}
    327327
    328 String WebPlatformStrategies::readStringFromPasteboard(int index, const String& pasteboardType)
     328String WebPlatformStrategies::readStringFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName)
    329329{
    330330    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);
    332332    return value;
    333333}
    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 
    342334#endif // PLATFORM(IOS)
    343335
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h

    r206256 r211158  
    6161    // WebCore::PasteboardStrategy
    6262#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;
    7170#endif
    7271#if PLATFORM(COCOA)
Note: See TracChangeset for help on using the changeset viewer.