OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.h" | 5 #include "chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 NSURL* url = [NSURL URLWithString:[urls objectAtIndex:0]]; | 217 NSURL* url = [NSURL URLWithString:[urls objectAtIndex:0]]; |
218 [url writeToPasteboard:pb]; | 218 [url writeToPasteboard:pb]; |
219 NSString* titleString = [titles objectAtIndex:0]; | 219 NSString* titleString = [titles objectAtIndex:0]; |
220 [pb setString:titleString forType:kNSURLTitlePboardType]; | 220 [pb setString:titleString forType:kNSURLTitlePboardType]; |
221 } | 221 } |
222 | 222 |
223 void WriteToClipboardPrivate( | 223 void WriteToClipboardPrivate( |
224 const std::vector<BookmarkNodeData::Element>& elements, | 224 const std::vector<BookmarkNodeData::Element>& elements, |
225 NSPasteboard* pb, | 225 NSPasteboard* pb, |
226 FilePath::StringType profile_path) { | 226 FilePath::StringType profile_path) { |
227 if (elements.empty()) { | 227 if (elements.empty()) |
228 return; | 228 return; |
229 } | 229 |
230 NSArray* types = [NSArray arrayWithObjects:kBookmarkDictionaryListPboardType, | 230 NSArray* types = [NSArray arrayWithObjects:kBookmarkDictionaryListPboardType, |
231 kWebURLsWithTitlesPboardType, | 231 kWebURLsWithTitlesPboardType, |
232 NSStringPboardType, | 232 NSStringPboardType, |
233 NSURLPboardType, | 233 NSURLPboardType, |
234 kNSURLTitlePboardType, | 234 kNSURLTitlePboardType, |
235 kChromiumProfilePathPboardType, | 235 kChromiumProfilePathPboardType, |
236 nil]; | 236 nil]; |
237 [pb declareTypes:types owner:nil]; | 237 [pb declareTypes:types owner:nil]; |
238 [pb setString:base::SysUTF8ToNSString(profile_path) | 238 [pb setString:base::SysUTF8ToNSString(profile_path) |
239 forType:kChromiumProfilePathPboardType]; | 239 forType:kChromiumProfilePathPboardType]; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 scoped_nsobject<BookmarkDragSource> source([[BookmarkDragSource alloc] | 315 scoped_nsobject<BookmarkDragSource> source([[BookmarkDragSource alloc] |
316 initWithContentsView:tabView | 316 initWithContentsView:tabView |
317 dropData:elements | 317 dropData:elements |
318 profile:profile | 318 profile:profile |
319 pasteboard:pb | 319 pasteboard:pb |
320 dragOperationMask:NSDragOperationEvery]); | 320 dragOperationMask:NSDragOperationEvery]); |
321 [source startDrag]; | 321 [source startDrag]; |
322 } | 322 } |
323 | 323 |
324 } // namespace bookmark_pasteboard_helper_mac | 324 } // namespace bookmark_pasteboard_helper_mac |
OLD | NEW |