| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/bookmarks/browser/bookmark_pasteboard_helper_mac.h" | 5 #include "components/bookmarks/browser/bookmark_pasteboard_helper_mac.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 if ([urls count] > 0) { | 221 if ([urls count] > 0) { |
| 222 if ([urls count] == 1) { | 222 if ([urls count] == 1) { |
| 223 item = ui::ClipboardUtil::PasteboardItemFromUrl([urls firstObject], | 223 item = ui::ClipboardUtil::PasteboardItemFromUrl([urls firstObject], |
| 224 [url_titles firstObject]); | 224 [url_titles firstObject]); |
| 225 } else { | 225 } else { |
| 226 item = ui::ClipboardUtil::PasteboardItemFromUrls(urls, url_titles); | 226 item = ui::ClipboardUtil::PasteboardItemFromUrls(urls, url_titles); |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 | 229 |
| 230 if (!item) { | 230 if (!item) { |
| 231 item = [[NSPasteboardItem alloc] init]; | 231 item.reset([[NSPasteboardItem alloc] init]); |
| 232 } | 232 } |
| 233 | 233 |
| 234 [item setString:[toplevel_string_data componentsJoinedByString:@"\n"] | 234 [item setString:[toplevel_string_data componentsJoinedByString:@"\n"] |
| 235 forType:NSPasteboardTypeString]; | 235 forType:NSPasteboardTypeString]; |
| 236 return item; | 236 return item; |
| 237 } | 237 } |
| 238 | 238 |
| 239 NSPasteboard* PasteboardFromType(ui::ClipboardType type) { | 239 NSPasteboard* PasteboardFromType(ui::ClipboardType type) { |
| 240 NSString* type_string = nil; | 240 NSString* type_string = nil; |
| 241 switch (type) { | 241 switch (type) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 NSPasteboard* pb = PasteboardFromType(type); | 301 NSPasteboard* pb = PasteboardFromType(type); |
| 302 | 302 |
| 303 NSArray* availableTypes = @[ | 303 NSArray* availableTypes = @[ |
| 304 ui::ClipboardUtil::UTIForWebURLsAndTitles(), | 304 ui::ClipboardUtil::UTIForWebURLsAndTitles(), |
| 305 ui::ClipboardUtil::UTIForPasteboardType(kBookmarkDictionaryListPboardType) | 305 ui::ClipboardUtil::UTIForPasteboardType(kBookmarkDictionaryListPboardType) |
| 306 ]; | 306 ]; |
| 307 return [pb availableTypeFromArray:availableTypes] != nil; | 307 return [pb availableTypeFromArray:availableTypes] != nil; |
| 308 } | 308 } |
| 309 | 309 |
| 310 } // namespace bookmarks | 310 } // namespace bookmarks |
| OLD | NEW |