summaryrefslogtreecommitdiffstats
path: root/base/clipboard_mac.mm
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-10 22:01:15 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-10 22:01:15 +0000
commitc033cbe94c504d2346c5e99c1ac12fda41f3f46a (patch)
tree85e1dae7db66e8cf0cc56edb64d15d4a59a70010 /base/clipboard_mac.mm
parent75d52ac5b9e0c0531b17095a5750918c281a7f0d (diff)
downloadchromium_src-c033cbe94c504d2346c5e99c1ac12fda41f3f46a.zip
chromium_src-c033cbe94c504d2346c5e99c1ac12fda41f3f46a.tar.gz
chromium_src-c033cbe94c504d2346c5e99c1ac12fda41f3f46a.tar.bz2
This changes the base clipboard class, as accomplishing paste requires that Clipboard::FormatType be IPC-able. The lowest-common denominator of unsigned int, NSString*, and GdkAtom is string, so string it is. (Linux changes by estade.)
Review URL: http://codereview.chromium.org/41012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11383 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/clipboard_mac.mm')
-rw-r--r--base/clipboard_mac.mm38
1 files changed, 26 insertions, 12 deletions
diff --git a/base/clipboard_mac.mm b/base/clipboard_mac.mm
index f2b6294..8363ffb 100644
--- a/base/clipboard_mac.mm
+++ b/base/clipboard_mac.mm
@@ -129,15 +129,18 @@ void Clipboard::WriteFiles(const char* file_data, size_t file_len) {
// pasteboard. This flavor has no data.
void Clipboard::WriteWebSmartPaste() {
NSPasteboard* pb = GetPasteboard();
- [pb addTypes:[NSArray arrayWithObject:GetWebKitSmartPasteFormatType()] owner:nil];
- [pb setData:nil forType:GetWebKitSmartPasteFormatType()];
+ NSString* format = base::SysUTF8ToNSString(GetWebKitSmartPasteFormatType());
+ [pb addTypes:[NSArray arrayWithObject:format] owner:nil];
+ [pb setData:nil forType:format];
}
-bool Clipboard::IsFormatAvailable(NSString* format) const {
+bool Clipboard::IsFormatAvailable(const Clipboard::FormatType& format) const {
+ NSString* format_ns = base::SysUTF8ToNSString(format);
+
NSPasteboard* pb = GetPasteboard();
NSArray* types = [pb types];
- return [types containsObject:format];
+ return [types containsObject:format_ns];
}
void Clipboard::ReadText(string16* result) const {
@@ -230,40 +233,51 @@ void Clipboard::ReadFiles(std::vector<FilePath>* files) const {
// static
Clipboard::FormatType Clipboard::GetUrlFormatType() {
- return NSURLPboardType;
+ static const std::string type = base::SysNSStringToUTF8(NSURLPboardType);
+ return type;
}
// static
Clipboard::FormatType Clipboard::GetUrlWFormatType() {
- return NSURLPboardType;
+ static const std::string type = base::SysNSStringToUTF8(NSURLPboardType);
+ return type;
}
// static
Clipboard::FormatType Clipboard::GetPlainTextFormatType() {
- return NSStringPboardType;
+ static const std::string type = base::SysNSStringToUTF8(NSStringPboardType);
+ return type;
}
// static
Clipboard::FormatType Clipboard::GetPlainTextWFormatType() {
- return NSStringPboardType;
+ static const std::string type = base::SysNSStringToUTF8(NSStringPboardType);
+ return type;
}
// static
Clipboard::FormatType Clipboard::GetFilenameFormatType() {
- return NSFilenamesPboardType;
+ static const std::string type =
+ base::SysNSStringToUTF8(NSFilenamesPboardType);
+ return type;
}
// static
Clipboard::FormatType Clipboard::GetFilenameWFormatType() {
- return NSFilenamesPboardType;
+ static const std::string type =
+ base::SysNSStringToUTF8(NSFilenamesPboardType);
+ return type;
}
// static
Clipboard::FormatType Clipboard::GetHtmlFormatType() {
- return NSHTMLPboardType;
+ static const std::string type = base::SysNSStringToUTF8(NSHTMLPboardType);
+ return type;
}
// static
Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() {
- return kWebSmartPastePboardType;
+ static const std::string type =
+ base::SysNSStringToUTF8(kWebSmartPastePboardType);
+ return type;
}