Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.mm

Issue 1855783002: mac: More pasteboard fixes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp23_dnd
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "chrome/browser/profiles/profile_manager.h" 9 #include "chrome/browser/profiles/profile_manager.h"
10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h" 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h"
11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" 11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h"
12 #include "components/bookmarks/browser/bookmark_model.h" 12 #include "components/bookmarks/browser/bookmark_model.h"
13 #include "components/bookmarks/browser/bookmark_node_data.h" 13 #include "components/bookmarks/browser/bookmark_node_data.h"
14 #include "components/bookmarks/browser/bookmark_pasteboard_helper_mac.h" 14 #include "components/bookmarks/browser/bookmark_pasteboard_helper_mac.h"
15 #include "ui/base/clipboard/clipboard_util_mac.h"
15 #import "ui/base/cocoa/cocoa_base_utils.h" 16 #import "ui/base/cocoa/cocoa_base_utils.h"
16 17
17 using bookmarks::BookmarkNode; 18 using bookmarks::BookmarkNode;
18 using bookmarks::BookmarkNodeData; 19 using bookmarks::BookmarkNodeData;
19 20
20 NSString* kBookmarkButtonDragType = @"com.google.chrome.BookmarkButtonDrag"; 21 NSString* kBookmarkButtonDragType = @"com.google.chrome.BookmarkButtonDrag";
21 22
22 @interface BookmarkFolderTarget() 23 @interface BookmarkFolderTarget()
23 // Copies the given bookmark node to the given pasteboard, declaring appropriate 24 // Copies the given bookmark node to the given pasteboard, declaring appropriate
24 // types (to paste a URL with a title). 25 // types (to paste a URL with a title).
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 BookmarkNodeData data(node); 108 BookmarkNodeData data(node);
108 data.SetOriginatingProfilePath(profile_->GetPath()); 109 data.SetOriginatingProfilePath(profile_->GetPath());
109 data.WriteToClipboard(ui::CLIPBOARD_TYPE_DRAG); 110 data.WriteToClipboard(ui::CLIPBOARD_TYPE_DRAG);
110 } 111 }
111 } 112 }
112 113
113 - (void)fillPasteboard:(NSPasteboard*)pboard 114 - (void)fillPasteboard:(NSPasteboard*)pboard
114 forDragOfButton:(BookmarkButton*)button { 115 forDragOfButton:(BookmarkButton*)button {
115 if (const BookmarkNode* node = [button bookmarkNode]) { 116 if (const BookmarkNode* node = [button bookmarkNode]) {
116 // Put the bookmark information into the pasteboard, and then write our own 117 // Put the bookmark information into the pasteboard, and then write our own
117 // data for |kBookmarkButtonDragType|. 118 // data for
119 // |ui::ClipboardUtil::UTIForPasteboardType(kBookmarkButtonDragType)|.
118 [self copyBookmarkNode:node toDragPasteboard:pboard]; 120 [self copyBookmarkNode:node toDragPasteboard:pboard];
119 [pboard addTypes:[NSArray arrayWithObject:kBookmarkButtonDragType] 121 [pboard addTypes:@[ ui::ClipboardUtil::UTIForPasteboardType(
122 kBookmarkButtonDragType) ]
120 owner:nil]; 123 owner:nil];
121 [pboard setData:[NSData dataWithBytes:&button length:sizeof(button)] 124 [pboard setData:[NSData dataWithBytes:&button length:sizeof(button)]
122 forType:kBookmarkButtonDragType]; 125 forType:ui::ClipboardUtil::UTIForPasteboardType(
126 kBookmarkButtonDragType)];
123 } else { 127 } else {
124 NOTREACHED(); 128 NOTREACHED();
125 } 129 }
126 } 130 }
127 131
128 @end 132 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698