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 | |
59 } | 58 } |
60 | 59 |
61 void Clipboard::WriteText(const char* text_data, size_t text_len) { | 60 void Clipboard::WriteText(const char* text_data, size_t text_len) { |
62 std::string text_str(text_data, text_len); | 61 std::string text_str(text_data, text_len); |
63 NSString *text = base::SysUTF8ToNSString(text_str); | 62 NSString *text = base::SysUTF8ToNSString(text_str); |
64 NSPasteboard* pb = GetPasteboard(); | 63 NSPasteboard* pb = GetPasteboard(); |
65 [pb addTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil]; | 64 [pb addTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil]; |
66 [pb setString:text forType:NSStringPboardType]; | 65 [pb setString:text forType:NSStringPboardType]; |
67 } | 66 } |
68 | 67 |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 Clipboard::FormatType Clipboard::GetBitmapFormatType() { | 374 Clipboard::FormatType Clipboard::GetBitmapFormatType() { |
376 return base::SysNSStringToUTF8(NSTIFFPboardType); | 375 return base::SysNSStringToUTF8(NSTIFFPboardType); |
377 } | 376 } |
378 | 377 |
379 // static | 378 // static |
380 Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() { | 379 Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() { |
381 return base::SysNSStringToUTF8(kWebSmartPastePboardType); | 380 return base::SysNSStringToUTF8(kWebSmartPastePboardType); |
382 } | 381 } |
383 | 382 |
384 } // namespace ui | 383 } // namespace ui |
OLD | NEW |