| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_util_mac.h" | 5 #include "ui/base/clipboard/clipboard_util_mac.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/mac/scoped_cftyperef.h" | 8 #include "base/mac/scoped_cftyperef.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 [item setString:urlString forType:UTIFromPboardType(NSStringPboardType)]; | 70 [item setString:urlString forType:UTIFromPboardType(NSStringPboardType)]; |
| 71 | 71 |
| 72 [item setData:[urlString dataUsingEncoding:NSUTF8StringEncoding] | 72 [item setData:[urlString dataUsingEncoding:NSUTF8StringEncoding] |
| 73 forType:UTIFromPboardType(kCorePasteboardFlavorType_url)]; | 73 forType:UTIFromPboardType(kCorePasteboardFlavorType_url)]; |
| 74 | 74 |
| 75 [item setData:[title dataUsingEncoding:NSUTF8StringEncoding] | 75 [item setData:[title dataUsingEncoding:NSUTF8StringEncoding] |
| 76 forType:UTIFromPboardType(kCorePasteboardFlavorType_urln)]; | 76 forType:UTIFromPboardType(kCorePasteboardFlavorType_urln)]; |
| 77 return item; | 77 return item; |
| 78 } | 78 } |
| 79 | 79 |
| 80 // static |
| 81 base::scoped_nsobject<NSPasteboardItem> ClipboardUtil::PasteboardItemFromString( |
| 82 NSString* string) { |
| 83 base::scoped_nsobject<NSPasteboardItem> item([[NSPasteboardItem alloc] init]); |
| 84 [item setString:string forType:UTIFromPboardType(NSStringPboardType)]; |
| 85 return item; |
| 86 } |
| 87 |
| 88 //static |
| 89 NSString* ClipboardUtil::GetTitleFromPasteboardURL(NSPasteboard* pboard) { |
| 90 return |
| 91 [pboard stringForType:UTIFromPboardType(kCorePasteboardFlavorType_urln)]; |
| 92 } |
| 93 |
| 94 //static |
| 95 NSString* ClipboardUtil::GetURLFromPasteboardURL(NSPasteboard* pboard) { |
| 96 return |
| 97 [pboard stringForType:UTIFromPboardType(kCorePasteboardFlavorType_url)]; |
| 98 } |
| 99 |
| 80 } // namespace ui | 100 } // namespace ui |
| OLD | NEW |