-
enrica@apple.com authored
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. Source/WebCore: 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: * 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/WebKit2: * 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@107435 268f45cc-cd09-0410-ab3c-d52691b4dbfc
71941ebb