summaryrefslogtreecommitdiffstats
path: root/base/clipboard_mac.mm
diff options
context:
space:
mode:
authorpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-17 14:45:48 +0000
committerpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-17 14:45:48 +0000
commitc3fac8bf704df395a6359e9da9edeca28ff34de0 (patch)
tree165cec5b2e3e50c2666d8205bbc661d17242cd21 /base/clipboard_mac.mm
parent0c4bfbd9655bc99c0fd92f6476c3c2915cca0004 (diff)
downloadchromium_src-c3fac8bf704df395a6359e9da9edeca28ff34de0.zip
chromium_src-c3fac8bf704df395a6359e9da9edeca28ff34de0.tar.gz
chromium_src-c3fac8bf704df395a6359e9da9edeca28ff34de0.tar.bz2
Implement the WebSmartPaste pasteboard type on Mac, stub it out on Linux, remove the platform ifdefs in common code.
Review URL: http://codereview.chromium.org/10955 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5559 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/clipboard_mac.mm')
-rw-r--r--base/clipboard_mac.mm17
1 files changed, 17 insertions, 0 deletions
diff --git a/base/clipboard_mac.mm b/base/clipboard_mac.mm
index 10fd91a..e16a795 100644
--- a/base/clipboard_mac.mm
+++ b/base/clipboard_mac.mm
@@ -15,6 +15,10 @@ namespace {
// Would be nice if this were in UTCoreTypes.h, but it isn't
const NSString* kUTTypeURLName = @"public.url-name";
+// Tells us if WebKit was the last to write to the pasteboard. There's no
+// actual data associated with this type.
+const NSString *kWebSmartPastePboardType = @"NeXT smart paste pasteboard type";
+
NSPasteboard* GetPasteboard() {
// The pasteboard should not be nil in a UI session, but this handy DCHECK
// can help track down problems if someone tries using clipboard code outside
@@ -121,6 +125,14 @@ void Clipboard::WriteFiles(const char* file_data, size_t file_len) {
[pb setPropertyList:fileList forType:NSFilenamesPboardType];
}
+// Write an extra flavor that signifies WebKit was the last to modify the
+// pasteboard. This flavor has no data.
+void Clipboard::WriteWebSmartPaste() {
+ NSPasteboard* pb = GetPasteboard();
+ [pb addTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];
+ [pb setData:nil forType:GetWebKitSmartPasteFormatType()];
+}
+
bool Clipboard::IsFormatAvailable(NSString* format) const {
NSPasteboard* pb = GetPasteboard();
NSArray* types = [pb types];
@@ -250,3 +262,8 @@ Clipboard::FormatType Clipboard::GetFilenameWFormatType() {
Clipboard::FormatType Clipboard::GetHtmlFormatType() {
return NSHTMLPboardType;
}
+
+// static
+Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() {
+ return kWebSmartPastePboardType;
+}