| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/base/clipboard/clipboard.h" | 5 #include "ui/base/clipboard/clipboard.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 } | 48 } |
| 49 | 49 |
| 50 void Clipboard::WriteObjects(const ObjectMap& objects) { | 50 void Clipboard::WriteObjects(const ObjectMap& objects) { |
| 51 NSPasteboard* pb = GetPasteboard(); | 51 NSPasteboard* pb = GetPasteboard(); |
| 52 [pb declareTypes:[NSArray array] owner:nil]; | 52 [pb declareTypes:[NSArray array] owner:nil]; |
| 53 | 53 |
| 54 for (ObjectMap::const_iterator iter = objects.begin(); | 54 for (ObjectMap::const_iterator iter = objects.begin(); |
| 55 iter != objects.end(); ++iter) { | 55 iter != objects.end(); ++iter) { |
| 56 DispatchObject(static_cast<ObjectType>(iter->first), iter->second); | 56 DispatchObject(static_cast<ObjectType>(iter->first), iter->second); |
| 57 } | 57 } |
| 58 |
| 58 } | 59 } |
| 59 | 60 |
| 60 void Clipboard::WriteText(const char* text_data, size_t text_len) { | 61 void Clipboard::WriteText(const char* text_data, size_t text_len) { |
| 61 std::string text_str(text_data, text_len); | 62 std::string text_str(text_data, text_len); |
| 62 NSString *text = base::SysUTF8ToNSString(text_str); | 63 NSString *text = base::SysUTF8ToNSString(text_str); |
| 63 NSPasteboard* pb = GetPasteboard(); | 64 NSPasteboard* pb = GetPasteboard(); |
| 64 [pb addTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil]; | 65 [pb addTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil]; |
| 65 [pb setString:text forType:NSStringPboardType]; | 66 [pb setString:text forType:NSStringPboardType]; |
| 66 } | 67 } |
| 67 | 68 |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 Clipboard::FormatType Clipboard::GetBitmapFormatType() { | 375 Clipboard::FormatType Clipboard::GetBitmapFormatType() { |
| 375 return base::SysNSStringToUTF8(NSTIFFPboardType); | 376 return base::SysNSStringToUTF8(NSTIFFPboardType); |
| 376 } | 377 } |
| 377 | 378 |
| 378 // static | 379 // static |
| 379 Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() { | 380 Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() { |
| 380 return base::SysNSStringToUTF8(kWebSmartPastePboardType); | 381 return base::SysNSStringToUTF8(kWebSmartPastePboardType); |
| 381 } | 382 } |
| 382 | 383 |
| 383 } // namespace ui | 384 } // namespace ui |
| OLD | NEW |