-
enrica@apple.com authored
Source/WebCore: Refactor Mac platform implementation of the Pasteboard class to use Platform Strategies. https://bugs.webkit.org/show_bug.cgi?id=78282 This patch removes any accesss to the NSPasteboard object from the Pasteboard class which now makes use of a new pasteboardStrategy object that is implemented both in WebKit and WebKit2. The actual access to NSPasteboard is now performed inside the PlatformPasteboard class. Currently both WebKit and WebKit2 use the same implementation of the PasteboardStrategy interface but this one more step in the direction of removing access to NSPasteboard from the WebProcess. As part of the refactoring the I've reduced to a minimum the use of OBJ-C classes. Reviewed by Anders Carlsson. No new tests. No change in behavior, just code refactoring. * WebCore.exp.in: Added exported class PlatformPasteboard. * WebCore.xcodeproj/project.pbxproj: Added new files to the build. * editing/mac/EditorMac.mm: (WebCore::Editor::writeSelectionToPasteboard): New method signature that doesn't use OBJ-C types. * platform/Pasteboard.h: * platform/PasteboardStrategy.h: Added PasteboardStrategy abstract class. * platform/PlatformPasteboard.h: Added. This class implements access to NSPasteboard. * platform/PlatformStrategies.h: (WebCore::PlatformStrategies::pasteboardStrategy): Added. * platform/mac/DragDataMac.mm: (WebCore::DragData::canSmartReplace): (WebCore::insertablePasteboardTypes): (WebCore::DragData::asURL): * platform/mac/PasteboardMac.mm: (WebCore::selectionPasteboardTypes): Changed to use Vector<String> instead of NSArray. (WebCore::writableTypesForURL): Ditto. (WebCore::createWritableTypesForImage): Ditto. (WebCore::writableTypesForImage): Ditto. (WebCore::Pasteboard::Pasteboard): Removed access to NSPasteboard. (WebCore::Pasteboard::clear): Modified to use platformStrategies()->pasteboardStrategy(). (WebCore::Pasteboard::writeSelectionForTypes): Ditto. (WebCore::Pasteboard::writePlainText): Ditto. (WebCore::Pasteboard::writeSelection): Ditto. (WebCore::writeURLForTypes): Ditto. (WebCore::Pasteboard::writeURL): Ditto. (WebCore::writeFileWrapperAsRTFDAttachment): Ditto. (WebCore::Pasteboard::writeImage): Ditto. (WebCore::Pasteboard::writeClipboard): Ditto. (WebCore::Pasteboard::canSmartReplace): Ditto. (WebCore::Pasteboard::plainText): Ditto. (WebCore::documentFragmentWithRTF): Ditto. (WebCore::Pasteboard::documentFragment): Ditto. * platform/mac/PlatformPasteboardMac.mm: Added. (WebCore::PlatformPasteboard::PlatformPasteboard): (WebCore::PlatformPasteboard::getTypes): (WebCore::PlatformPasteboard::bufferForType): (WebCore::PlatformPasteboard::getPathnamesForType): (WebCore::PlatformPasteboard::stringForType): (WebCore::PlatformPasteboard::copy): (WebCore::PlatformPasteboard::setTypes): (WebCore::PlatformPasteboard::setBufferForType): (WebCore::PlatformPasteboard::setPathnamesForType): (WebCore::PlatformPasteboard::setStringForType): Source/WebKit/mac: Refactor Mac platform implementation of the Pasteboard class to use Platform Strategies. https://bugs.webkit.org/show_bug.cgi?id=78282 This patch removes any accesss to the NSPasteboard object from the Pasteboard class which now makes use of a new pasteboardStrategy object that is implemented both in WebKit and WebKit2. The actual access to NSPasteboard is now performed inside the PlatformPasteboard class. Currently both WebKit and WebKit2 use the same implementation of the PasteboardStrategy interface but this one more step in the direction of removing access to NSPasteboard from the WebProcess. As part of the refactoring the I've reduced to a minimum the use of OBJ-C classes. Reviewed by Anders Carlsson. * WebCoreSupport/WebPlatformStrategies.h: Added PasteboardStrategy. * WebCoreSupport/WebPlatformStrategies.mm: Added implementation of PasteboardStrategy interface. (WebPlatformStrategies::createPasteboardStrategy): (WebPlatformStrategies::getTypes): (WebPlatformStrategies::bufferForType): (WebPlatformStrategies::getPathnamesForType): (WebPlatformStrategies::stringForType): (WebPlatformStrategies::copy): (WebPlatformStrategies::setTypes): (WebPlatformStrategies::setBufferForType): (WebPlatformStrategies::setPathnamesForType): (WebPlatformStrategies::setStringForType): Source/WebKit/qt: Refactor Mac platform implementation of the Pasteboard class to use Platform Strategies. https://bugs.webkit.org/show_bug.cgi?id=78282 Build fix. Unreviewed. * WebCoreSupport/PlatformStrategiesQt.cpp: (WebPlatformStrategies::createPasteboardStrategy): * WebCoreSupport/PlatformStrategiesQt.h: (PlatformStrategiesQt): Source/WebKit2: Refactor Mac platform implementation of the Pasteboard class to use Platform Strategies. https://bugs.webkit.org/show_bug.cgi?id=78282 This patch removes any accesss to the NSPasteboard object from the Pasteboard class which now makes use of a new pasteboardStrategy object that is implemented both in WebKit and WebKit2. The actual access to NSPasteboard is now performed inside the PlatformPasteboard class. Currently both WebKit and WebKit2 use the same implementation of the PasteboardStrategy interface but this one more step in the direction of removing access to NSPasteboard from the WebProcess. As part of the refactoring the I've reduced to a minimum the use of OBJ-C classes. Reviewed by Anders Carlsson. * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: Added implementation of PasteboardStrategy interface. (WebKit::WebPlatformStrategies::createPasteboardStrategy): (WebKit::WebPlatformStrategies::getTypes): (WebKit::WebPlatformStrategies::bufferForType): (WebKit::WebPlatformStrategies::getPathnamesForType): (WebKit::WebPlatformStrategies::stringForType): (WebKit::WebPlatformStrategies::copy): (WebKit::WebPlatformStrategies::setTypes): (WebKit::WebPlatformStrategies::setBufferForType): (WebKit::WebPlatformStrategies::setPathnamesForType): (WebKit::WebPlatformStrategies::setStringForType): * WebProcess/WebCoreSupport/WebPlatformStrategies.h: Added PasteboardStrategy. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107606 268f45cc-cd09-0410-ab3c-d52691b4dbfc
58eb2d47