summaryrefslogtreecommitdiff
path: root/Source/WebKit/mac/WebCoreSupport
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/mac/WebCoreSupport')
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebChromeClient.h1
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebDragClient.h2
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebDragClient.mm10
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebEditorClient.h4
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm12
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebGeolocationClient.mm4
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm2
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebNotificationClient.h20
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm182
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h20
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm67
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm7
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h3
13 files changed, 296 insertions, 38 deletions
diff --git a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h
index 48ff09bba..66fa060b5 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h
@@ -189,6 +189,7 @@ public:
#endif
virtual void numWheelEventHandlersChanged(unsigned) OVERRIDE { }
+ virtual void numTouchEventHandlersChanged(unsigned) OVERRIDE { }
virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const OVERRIDE { return false; }
private:
WebView *m_webView;
diff --git a/Source/WebKit/mac/WebCoreSupport/WebDragClient.h b/Source/WebKit/mac/WebCoreSupport/WebDragClient.h
index e472fb7ce..9d96b82c5 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebDragClient.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebDragClient.h
@@ -36,7 +36,7 @@ public:
virtual void dragControllerDestroyed() OVERRIDE;
virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint& windowPoint) OVERRIDE;
virtual void startDrag(WebCore::DragImageRef, const WebCore::IntPoint& dragPos, const WebCore::IntPoint& eventPos, WebCore::Clipboard*, WebCore::Frame*, bool linkDrag) OVERRIDE;
- virtual void declareAndWriteDragImage(NSPasteboard*, DOMElement*, NSURL*, NSString*, WebCore::Frame*) OVERRIDE;
+ virtual void declareAndWriteDragImage(const String& pasteboardName, DOMElement*, NSURL*, NSString*, WebCore::Frame*) OVERRIDE;
private:
WebView* m_webView;
};
diff --git a/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm b/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm
index 9ba4b05dc..aff7ec2cf 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm
@@ -83,7 +83,7 @@ WebCore::DragSourceAction WebDragClient::dragSourceActionMaskForPoint(const IntP
void WebDragClient::willPerformDragSourceAction(WebCore::DragSourceAction action, const WebCore::IntPoint& mouseDownPoint, WebCore::Clipboard* clipboard)
{
ASSERT(clipboard);
- [[m_webView _UIDelegateForwarder] webView:m_webView willPerformDragSourceAction:(WebDragSourceAction)action fromPoint:mouseDownPoint withPasteboard:static_cast<WebCore::ClipboardMac*>(clipboard)->pasteboard()];
+ [[m_webView _UIDelegateForwarder] webView:m_webView willPerformDragSourceAction:(WebDragSourceAction)action fromPoint:mouseDownPoint withPasteboard:[NSPasteboard pasteboardWithName:static_cast<WebCore::ClipboardMac*>(clipboard)->pasteboardName()]];
}
void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& at, const IntPoint& eventPos, Clipboard* clipboard, Frame* frame, bool linkDrag)
@@ -100,7 +100,7 @@ void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& at, const
RetainPtr<WebHTMLView> topViewProtector = topHTMLView;
[topHTMLView _stopAutoscrollTimer];
- NSPasteboard *pasteboard = static_cast<ClipboardMac*>(clipboard)->pasteboard();
+ NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName:static_cast<ClipboardMac*>(clipboard)->pasteboardName()];
NSImage *dragNSImage = dragImage.get();
WebHTMLView *sourceHTMLView = htmlView.get();
@@ -120,14 +120,14 @@ void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& at, const
[topHTMLView dragImage:dragNSImage at:at offset:NSZeroSize event:event pasteboard:pasteboard source:sourceHTMLView slideBack:YES];
}
-void WebDragClient::declareAndWriteDragImage(NSPasteboard* pasteboard, DOMElement* element, NSURL* URL, NSString* title, WebCore::Frame* frame)
+void WebDragClient::declareAndWriteDragImage(const String& pasteboardName, DOMElement* element, NSURL* URL, NSString* title, WebCore::Frame* frame)
{
- ASSERT(pasteboard);
+ ASSERT(pasteboardName);
ASSERT(element);
WebHTMLView *source = getTopHTMLView(frame);
WebArchive *archive = [element webArchive];
- [pasteboard _web_declareAndWriteDragImageForElement:element URL:URL title:title archive:archive source:source];
+ [[NSPasteboard pasteboardWithName:pasteboardName] _web_declareAndWriteDragImageForElement:element URL:URL title:title archive:archive source:source];
}
void WebDragClient::dragControllerDestroyed()
diff --git a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h
index c70d6089d..c75fee09f 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h
@@ -61,7 +61,7 @@ public:
virtual bool shouldInsertText(const WTF::String&, WebCore::Range*, WebCore::EditorInsertAction) OVERRIDE;
virtual bool shouldChangeSelectedRange(WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity, bool stillSelecting) OVERRIDE;
- virtual bool shouldApplyStyle(WebCore::CSSStyleDeclaration*, WebCore::Range*) OVERRIDE;
+ virtual bool shouldApplyStyle(WebCore::StylePropertySet*, WebCore::Range*) OVERRIDE;
virtual bool shouldMoveRangeAfterDelete(WebCore::Range*, WebCore::Range* rangeToBeReplaced) OVERRIDE;
@@ -135,7 +135,7 @@ public:
virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses) OVERRIDE;
virtual void willSetInputMethodState() OVERRIDE;
virtual void setInputMethodState(bool enabled) OVERRIDE;
- virtual void requestCheckingOfString(WebCore::SpellChecker*, int, WebCore::TextCheckingTypeMask, const WTF::String&) OVERRIDE;
+ virtual void requestCheckingOfString(WebCore::SpellChecker*, const WebCore::TextCheckingRequest&) OVERRIDE;
#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
virtual void showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) OVERRIDE;
virtual void dismissCorrectionPanel(WebCore::ReasonForDismissingCorrectionPanel) OVERRIDE;
diff --git a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm
index fabdf6c6f..478553034 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm
@@ -241,10 +241,10 @@ bool WebEditorClient::isSelectTrailingWhitespaceEnabled()
return [m_webView isSelectTrailingWhitespaceEnabled];
}
-bool WebEditorClient::shouldApplyStyle(CSSStyleDeclaration* style, Range* range)
+bool WebEditorClient::shouldApplyStyle(StylePropertySet* style, Range* range)
{
return [[m_webView _editingDelegateForwarder] webView:m_webView
- shouldApplyStyle:kit(style) toElementsInDOMRange:kit(range)];
+ shouldApplyStyle:kit(style->ensureCSSStyleDeclaration()) toElementsInDOMRange:kit(range)];
}
bool WebEditorClient::shouldMoveRangeAfterDelete(Range* range, Range* rangeToBeReplaced)
@@ -972,15 +972,15 @@ void WebEditorClient::setInputMethodState(bool)
@end
#endif
-void WebEditorClient::requestCheckingOfString(WebCore::SpellChecker* sender, int sequence, WebCore::TextCheckingTypeMask checkingTypes, const String& text)
+void WebEditorClient::requestCheckingOfString(WebCore::SpellChecker* sender, const WebCore::TextCheckingRequest& request)
{
#ifndef BUILDING_ON_LEOPARD
- NSRange range = NSMakeRange(0, text.length());
+ NSRange range = NSMakeRange(0, request.text().length());
NSRunLoop* currentLoop = [NSRunLoop currentRunLoop];
- [[NSSpellChecker sharedSpellChecker] requestCheckingOfString:text range:range types:NSTextCheckingAllSystemTypes options:0 inSpellDocumentWithTag:0
+ [[NSSpellChecker sharedSpellChecker] requestCheckingOfString:request.text() range:range types:NSTextCheckingAllSystemTypes options:0 inSpellDocumentWithTag:0
completionHandler:^(NSInteger, NSArray* results, NSOrthography*, NSInteger) {
[currentLoop performSelector:@selector(perform)
- target:[[[WebEditorSpellCheckResponder alloc] initWithSender:sender sequence:sequence types:checkingTypes results:results] autorelease]
+ target:[[[WebEditorSpellCheckResponder alloc] initWithSender:sender sequence:request.sequence() types:request.mask() results:results] autorelease]
argument:nil order:0 modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];
}];
#endif
diff --git a/Source/WebKit/mac/WebCoreSupport/WebGeolocationClient.mm b/Source/WebKit/mac/WebCoreSupport/WebGeolocationClient.mm
index b52b7bc64..541f40ccd 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebGeolocationClient.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebGeolocationClient.mm
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -37,7 +37,7 @@
using namespace WebCore;
-@interface WebGeolocationPolicyListener : NSObject <WebGeolocationPolicyListener>
+@interface WebGeolocationPolicyListener : NSObject <WebAllowDenyPolicyListener>
{
RefPtr<Geolocation> _geolocation;
}
diff --git a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
index 14ebd1d65..2ae865951 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
@@ -240,7 +240,7 @@ void WebInspectorFrontendClient::updateWindowTitle() const
[preferences setMinimumFontSize:0];
[preferences setMinimumLogicalFontSize:9];
[preferences setPlugInsEnabled:NO];
- [preferences setSuppressIncrementalRendering:YES];
+ [preferences setSuppressesIncrementalRendering:YES];
[preferences setTabsToLinks:NO];
[preferences setUserStyleSheetEnabled:NO];
diff --git a/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.h b/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.h
index 82903ca59..a40ce81e5 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,11 +25,20 @@
#import <WebCore/NotificationPresenter.h>
+#if ENABLE(NOTIFICATIONS)
+#import <WebCore/Notification.h>
+#import <wtf/HashMap.h>
+#import <wtf/RefPtr.h>
+#import <wtf/RetainPtr.h>
+#endif
+
namespace WebCore {
+class Notification;
class ScriptExecutionContext;
class VoidCallback;
}
+@class WebNotification;
@class WebView;
class WebNotificationClient : public WebCore::NotificationPresenter {
@@ -40,11 +49,18 @@ public:
private:
virtual bool show(WebCore::Notification*) OVERRIDE;
virtual void cancel(WebCore::Notification*) OVERRIDE;
+ virtual void clearNotifications(WebCore::ScriptExecutionContext*) OVERRIDE;
virtual void notificationObjectDestroyed(WebCore::Notification*) OVERRIDE;
virtual void notificationControllerDestroyed() OVERRIDE;
virtual void requestPermission(WebCore::ScriptExecutionContext*, PassRefPtr<WebCore::VoidCallback>) OVERRIDE;
- virtual void cancelRequestsForPermission(WebCore::ScriptExecutionContext*) OVERRIDE;
+ virtual void cancelRequestsForPermission(WebCore::ScriptExecutionContext*) OVERRIDE { }
virtual WebCore::NotificationPresenter::Permission checkPermission(WebCore::ScriptExecutionContext*) OVERRIDE;
WebView *m_webView;
+#if ENABLE(NOTIFICATIONS)
+ HashMap<RefPtr<WebCore::Notification>, RetainPtr<WebNotification> > m_notificationMap;
+
+ typedef HashMap<RefPtr<WebCore::ScriptExecutionContext>, Vector<RetainPtr<WebNotification> > > NotificationContextMap;
+ NotificationContextMap m_notificationContextMap;
+#endif
};
diff --git a/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm b/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm
index 80138e313..2f7cd5411 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,49 +25,199 @@
#import "WebNotificationClient.h"
-#import <WebCore/NotImplemented.h>
-#import <WebCore/Notification.h>
+#if ENABLE(NOTIFICATIONS)
+#import "WebDelegateImplementationCaching.h"
+#import "WebNotificationInternal.h"
+#import "WebPreferencesPrivate.h"
+#import "WebSecurityOriginInternal.h"
+#import "WebUIDelegatePrivate.h"
+#import "WebViewInternal.h"
+#import <WebCore/BlockExceptions.h>
+#import <WebCore/Page.h>
+#import <WebCore/ScriptExecutionContext.h>
+#endif
using namespace WebCore;
+#if ENABLE(NOTIFICATIONS)
+@interface WebNotificationPolicyListener : NSObject <WebAllowDenyPolicyListener>
+{
+ RefPtr<VoidCallback> _callback;
+}
+- (id)initWithCallback:(PassRefPtr<VoidCallback>)callback;
+@end
+#endif
+
+#if ENABLE(NOTIFICATIONS)
+static uint64_t generateNotificationID()
+{
+ static uint64_t uniqueNotificationID = 1;
+ return uniqueNotificationID++;
+}
+#endif
+
WebNotificationClient::WebNotificationClient(WebView *webView)
: m_webView(webView)
{
}
-bool WebNotificationClient::show(Notification*)
+bool WebNotificationClient::show(Notification* notification)
{
- notImplemented();
+#if ENABLE(NOTIFICATIONS)
+ if (![m_webView _notificationProvider])
+ return false;
+
+ uint64_t notificationID = generateNotificationID();
+ RetainPtr<WebNotification> webNotification = adoptNS([[WebNotification alloc] initWithCoreNotification:notification notificationID:notificationID]);
+ m_notificationMap.set(notification, webNotification);
+
+ NotificationContextMap::iterator it = m_notificationContextMap.add(notification->scriptExecutionContext(), Vector<RetainPtr<WebNotification> >()).first;
+ it->second.append(webNotification);
+
+ [[m_webView _notificationProvider] showNotification:webNotification.get() fromWebView:m_webView];
+ return true;
+#else
+ UNUSED_PARAM(notification);
return false;
+#endif
+}
+
+void WebNotificationClient::cancel(Notification* notification)
+{
+#if ENABLE(NOTIFICATIONS)
+ WebNotification *webNotification = m_notificationMap.get(notification).get();
+ if (!webNotification)
+ return;
+
+ [[m_webView _notificationProvider] cancelNotification:webNotification];
+#else
+ UNUSED_PARAM(notification);
+#endif
}
-void WebNotificationClient::cancel(Notification*)
+void WebNotificationClient::clearNotifications(ScriptExecutionContext* context)
{
- notImplemented();
+#if ENABLE(NOTIFICATIONS)
+ NotificationContextMap::iterator it = m_notificationContextMap.find(context);
+ if (it == m_notificationContextMap.end())
+ return;
+
+ Vector<RetainPtr<WebNotification> >& webNotifications = it->second;
+ NSMutableArray *nsIDs = [NSMutableArray array];
+ size_t count = webNotifications.size();
+ for (size_t i = 0; i < count; ++i) {
+ WebNotification *webNotification = webNotifications[i].get();
+ [nsIDs addObject:[NSNumber numberWithUnsignedLongLong:[webNotification notificationID]]];
+ m_notificationMap.remove(core(webNotification));
+ }
+
+ [[m_webView _notificationProvider] clearNotifications:nsIDs];
+ m_notificationContextMap.remove(it);
+#else
+ UNUSED_PARAM(context);
+#endif
}
-void WebNotificationClient::notificationObjectDestroyed(WebCore::Notification*)
+void WebNotificationClient::notificationObjectDestroyed(Notification* notification)
{
- notImplemented();
+#if ENABLE(NOTIFICATIONS)
+ RetainPtr<WebNotification> webNotification = m_notificationMap.take(notification);
+ if (!webNotification)
+ return;
+
+ NotificationContextMap::iterator it = m_notificationContextMap.find(notification->scriptExecutionContext());
+ ASSERT(it != m_notificationContextMap.end());
+ size_t index = it->second.find(webNotification);
+ ASSERT(index != notFound);
+ it->second.remove(index);
+ if (it->second.isEmpty())
+ m_notificationContextMap.remove(it);
+
+ [[m_webView _notificationProvider] notificationDestroyed:webNotification.get()];
+#else
+ UNUSED_PARAM(notification);
+#endif
}
void WebNotificationClient::notificationControllerDestroyed()
{
+#if ENABLE(NOTIFICATIONS)
+ [m_webView _notificationControllerDestroyed];
+#endif
delete this;
}
-void WebNotificationClient::requestPermission(WebCore::ScriptExecutionContext*, PassRefPtr<WebCore::VoidCallback>)
+void WebNotificationClient::requestPermission(ScriptExecutionContext* context, PassRefPtr<VoidCallback> callback)
{
- notImplemented();
+#if ENABLE(NOTIFICATIONS)
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+ SEL selector = @selector(webView:decidePolicyForNotificationRequestFromOrigin:listener:);
+ if (![[m_webView UIDelegate] respondsToSelector:selector])
+ return;
+
+ WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:context->securityOrigin()];
+ WebNotificationPolicyListener* listener = [[WebNotificationPolicyListener alloc] initWithCallback:callback];
+
+ CallUIDelegate(m_webView, selector, webOrigin, listener);
+
+ [webOrigin release];
+ [listener release];
+
+ END_BLOCK_OBJC_EXCEPTIONS;
+#else
+ UNUSED_PARAM(context);
+ UNUSED_PARAM(callback);
+#endif
}
-void WebNotificationClient::cancelRequestsForPermission(WebCore::ScriptExecutionContext*)
+NotificationPresenter::Permission WebNotificationClient::checkPermission(ScriptExecutionContext* context)
{
- notImplemented();
+#if ENABLE(NOTIFICATIONS)
+ if (!context || !context->isDocument())
+ return NotificationPresenter::PermissionDenied;
+ if (![[m_webView preferences] notificationsEnabled])
+ return NotificationPresenter::PermissionDenied;
+ WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:context->securityOrigin()];
+ WebNotificationPermission permission = [[m_webView _notificationProvider] policyForOrigin:webOrigin];
+ [webOrigin release];
+ switch (permission) {
+ case WebNotificationPermissionAllowed:
+ return NotificationPresenter::PermissionAllowed;
+ case WebNotificationPermissionDenied:
+ return NotificationPresenter::PermissionDenied;
+ case WebNotificationPermissionNotAllowed:
+ return NotificationPresenter::PermissionNotAllowed;
+ default:
+ return NotificationPresenter::PermissionNotAllowed;
+ }
+#else
+ UNUSED_PARAM(context);
+ return NotificationPresenter::PermissionDenied;
+#endif
}
-NotificationPresenter::Permission WebNotificationClient::checkPermission(WebCore::ScriptExecutionContext*)
+#if ENABLE(NOTIFICATIONS)
+@implementation WebNotificationPolicyListener
+- (id)initWithCallback:(PassRefPtr<VoidCallback>)callback
{
- notImplemented();
- return NotificationPresenter::PermissionDenied;
+ if (!(self = [super init]))
+ return nil;
+
+ ASSERT(callback);
+ _callback = callback;
+ return self;
}
+
+- (void)allow
+{
+ _callback->handleEvent();
+}
+
+- (void)deny
+{
+ _callback->handleEvent();
+}
+
+@end
+#endif
diff --git a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h
index f1bd1a32c..4fde2b3b0 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h
@@ -27,11 +27,12 @@
#define WebPlatformStrategies_h
#include <WebCore/CookiesStrategy.h>
+#include <WebCore/PasteboardStrategy.h>
#include <WebCore/PlatformStrategies.h>
#include <WebCore/PluginStrategy.h>
#include <WebCore/VisitedLinkStrategy.h>
-class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::PluginStrategy, private WebCore::VisitedLinkStrategy {
+class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::PluginStrategy, private WebCore::VisitedLinkStrategy, private WebCore::PasteboardStrategy {
public:
static void initialize();
@@ -42,6 +43,7 @@ private:
virtual WebCore::CookiesStrategy* createCookiesStrategy() OVERRIDE;
virtual WebCore::PluginStrategy* createPluginStrategy() OVERRIDE;
virtual WebCore::VisitedLinkStrategy* createVisitedLinkStrategy() OVERRIDE;
+ virtual WebCore::PasteboardStrategy* createPasteboardStrategy() OVERRIDE;
// WebCore::CookiesStrategy
virtual void notifyCookiesChanged() OVERRIDE;
@@ -53,6 +55,22 @@ private:
// WebCore::VisitedLinkStrategy
virtual bool isLinkVisited(WebCore::Page*, WebCore::LinkHash, const WebCore::KURL& baseURL, const WTF::AtomicString& attributeURL) OVERRIDE;
virtual void addVisitedLink(WebCore::Page*, WebCore::LinkHash) OVERRIDE;
+
+ // WebCore::PasteboardStrategy
+ virtual void getTypes(Vector<String>& types, const String& pasteboardName) OVERRIDE;
+ virtual PassRefPtr<WebCore::SharedBuffer> bufferForType(const String& pasteboardType, const String& pasteboardName) OVERRIDE;
+ virtual void getPathnamesForType(Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName) OVERRIDE;
+ virtual String stringForType(const String& pasteboardType, const String& pasteboardName) OVERRIDE;
+ virtual int changeCount(const String& pasteboardName) OVERRIDE;
+ virtual String uniqueName() OVERRIDE;
+ virtual WebCore::Color color(const String& pasteboardName) OVERRIDE;
+
+ virtual void copy(const String& fromPasteboard, const String& toPasteboard) OVERRIDE;
+ virtual void setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) OVERRIDE;
+ virtual void setBufferForType(PassRefPtr<WebCore::SharedBuffer>, const String& pasteboardType, const String& pasteboardName) OVERRIDE;
+ virtual void setPathnamesForType(const Vector<String>&, const String& pasteboardType, const String& pasteboardName) OVERRIDE;
+ virtual void setStringForType(const String&, const String& pasteboardType, const String& pasteboardName) OVERRIDE;
+
};
#endif // WebPlatformStrategies_h
diff --git a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm
index d1a4d9560..fc3035048 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm
@@ -28,8 +28,10 @@
#import "WebPluginDatabase.h"
#import "WebPluginPackage.h"
#import <WebCore/BlockExceptions.h>
+#import <WebCore/Color.h>
#import <WebCore/Page.h>
#import <WebCore/PageGroup.h>
+#import <WebCore/PlatformPasteboard.h>
using namespace WebCore;
@@ -58,6 +60,11 @@ VisitedLinkStrategy* WebPlatformStrategies::createVisitedLinkStrategy()
return this;
}
+PasteboardStrategy* WebPlatformStrategies::createPasteboardStrategy()
+{
+ return this;
+}
+
void WebPlatformStrategies::notifyCookiesChanged()
{
}
@@ -90,3 +97,63 @@ void WebPlatformStrategies::addVisitedLink(Page* page, LinkHash hash)
{
return page->group().addVisitedLinkHash(hash);
}
+
+void WebPlatformStrategies::getTypes(Vector<String>& types, const String& pasteboardName)
+{
+ PlatformPasteboard(pasteboardName).getTypes(types);
+}
+
+PassRefPtr<WebCore::SharedBuffer> WebPlatformStrategies::bufferForType(const String& pasteboardType, const String& pasteboardName)
+{
+ return PlatformPasteboard(pasteboardName).bufferForType(pasteboardType);
+}
+
+void WebPlatformStrategies::getPathnamesForType(Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName)
+{
+ PlatformPasteboard(pasteboardName).getPathnamesForType(pathnames, pasteboardType);
+}
+
+String WebPlatformStrategies::stringForType(const String& pasteboardType, const String& pasteboardName)
+{
+ return PlatformPasteboard(pasteboardName).stringForType(pasteboardType);
+}
+
+void WebPlatformStrategies::copy(const String& fromPasteboard, const String& toPasteboard)
+{
+ PlatformPasteboard(toPasteboard).copy(fromPasteboard);
+}
+
+int WebPlatformStrategies::changeCount(const String &pasteboardName)
+{
+ return PlatformPasteboard(pasteboardName).changeCount();
+}
+
+String WebPlatformStrategies::uniqueName()
+{
+ return PlatformPasteboard::uniqueName();
+}
+
+Color WebPlatformStrategies::color(const String& pasteboardName)
+{
+ return PlatformPasteboard(pasteboardName).color();
+}
+
+void WebPlatformStrategies::setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName)
+{
+ PlatformPasteboard(pasteboardName).setTypes(pasteboardTypes);
+}
+
+void WebPlatformStrategies::setBufferForType(PassRefPtr<SharedBuffer> buffer, const String& pasteboardType, const String& pasteboardName)
+{
+ PlatformPasteboard(pasteboardName).setBufferForType(buffer, pasteboardType);
+}
+
+void WebPlatformStrategies::setPathnamesForType(const Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName)
+{
+ PlatformPasteboard(pasteboardName).setPathnamesForType(pathnames, pasteboardType);
+}
+
+void WebPlatformStrategies::setStringForType(const String& string, const String& pasteboardType, const String& pasteboardName)
+{
+ PlatformPasteboard(pasteboardName).setStringForType(string, pasteboardType);
+}
diff --git a/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm b/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm
index 2373f8464..8f38fed43 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2010, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -66,6 +66,11 @@ using namespace WebCore;
return reinterpret_cast<SecurityOrigin*>(_private)->databaseIdentifier();
}
+- (NSString *)stringValue
+{
+ return reinterpret_cast<SecurityOrigin*>(_private)->toString();
+}
+
// Deprecated. Use host instead. This needs to stay here until we ship a new Safari.
- (NSString *)domain
{
diff --git a/Source/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h b/Source/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h
index a784aba67..fae4c3382 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2010, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -41,6 +41,7 @@
- (NSString *)host;
- (NSString *)databaseIdentifier;
+- (NSString *)stringValue;
// Returns zero if the port is the default port for the protocol, non-zero otherwise.
- (unsigned short)port;