Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2415)

Unified Diff: base/clipboard_mac.mm

Issue 10955: Implement the WebSmartPaste pasteboard type on Mac, stub it out on Linux, rem... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/clipboard_linux.cc ('k') | base/scoped_clipboard_writer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/clipboard_mac.mm
===================================================================
--- base/clipboard_mac.mm (revision 5474)
+++ base/clipboard_mac.mm (working copy)
@@ -15,6 +15,10 @@
// 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 @@
[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::GetHtmlFormatType() {
return NSHTMLPboardType;
}
+
+// static
+Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() {
+ return kWebSmartPastePboardType;
+}
« no previous file with comments | « base/clipboard_linux.cc ('k') | base/scoped_clipboard_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698