OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/clipboard.h" | 5 #include "base/clipboard.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 NSPasteboard* pb = GetPasteboard(); | 123 NSPasteboard* pb = GetPasteboard(); |
124 [pb addTypes:[NSArray arrayWithObject:NSFilenamesPboardType] owner:nil]; | 124 [pb addTypes:[NSArray arrayWithObject:NSFilenamesPboardType] owner:nil]; |
125 [pb setPropertyList:fileList forType:NSFilenamesPboardType]; | 125 [pb setPropertyList:fileList forType:NSFilenamesPboardType]; |
126 } | 126 } |
127 | 127 |
128 // Write an extra flavor that signifies WebKit was the last to modify the | 128 // Write an extra flavor that signifies WebKit was the last to modify the |
129 // pasteboard. This flavor has no data. | 129 // pasteboard. This flavor has no data. |
130 void Clipboard::WriteWebSmartPaste() { | 130 void Clipboard::WriteWebSmartPaste() { |
131 NSPasteboard* pb = GetPasteboard(); | 131 NSPasteboard* pb = GetPasteboard(); |
132 [pb addTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil]; | 132 [pb addTypes:[NSArray arrayWithObject:GetWebKitSmartPasteFormatType()] owner:n
il]; |
133 [pb setData:nil forType:GetWebKitSmartPasteFormatType()]; | 133 [pb setData:nil forType:GetWebKitSmartPasteFormatType()]; |
134 } | 134 } |
135 | 135 |
136 bool Clipboard::IsFormatAvailable(NSString* format) const { | 136 bool Clipboard::IsFormatAvailable(NSString* format) const { |
137 NSPasteboard* pb = GetPasteboard(); | 137 NSPasteboard* pb = GetPasteboard(); |
138 NSArray* types = [pb types]; | 138 NSArray* types = [pb types]; |
139 | 139 |
140 return [types containsObject:format]; | 140 return [types containsObject:format]; |
141 } | 141 } |
142 | 142 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 260 |
261 // static | 261 // static |
262 Clipboard::FormatType Clipboard::GetHtmlFormatType() { | 262 Clipboard::FormatType Clipboard::GetHtmlFormatType() { |
263 return NSHTMLPboardType; | 263 return NSHTMLPboardType; |
264 } | 264 } |
265 | 265 |
266 // static | 266 // static |
267 Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() { | 267 Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() { |
268 return kWebSmartPastePboardType; | 268 return kWebSmartPastePboardType; |
269 } | 269 } |
OLD | NEW |