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

Side by Side Diff: content/browser/web_contents/web_drag_dest_mac.mm

Issue 10532168: Allow empty strings to be written to the clipboard (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment fix Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/web_contents/web_drag_dest_mac.h" 5 #import "content/browser/web_contents/web_drag_dest_mac.h"
6 6
7 #import <Carbon/Carbon.h> 7 #import <Carbon/Carbon.h>
8 8
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #include "content/browser/renderer_host/render_view_host_impl.h" 10 #include "content/browser/renderer_host/render_view_host_impl.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 232
233 // Get URL if possible. To avoid exposing file system paths to web content, 233 // Get URL if possible. To avoid exposing file system paths to web content,
234 // filenames in the drag are not converted to file URLs. 234 // filenames in the drag are not converted to file URLs.
235 ui::PopulateURLAndTitleFromPasteboard(&data->url, 235 ui::PopulateURLAndTitleFromPasteboard(&data->url,
236 &data->url_title, 236 &data->url_title,
237 pboard, 237 pboard,
238 NO); 238 NO);
239 239
240 // Get plain text. 240 // Get plain text.
241 if ([types containsObject:NSStringPboardType]) { 241 if ([types containsObject:NSStringPboardType]) {
242 data->plain_text = 242 data->text = NullableString16(
243 base::SysNSStringToUTF16([pboard stringForType:NSStringPboardType]); 243 base::SysNSStringToUTF16([pboard stringForType:NSStringPboardType]),
244 false);
244 } 245 }
245 246
246 // Get HTML. If there's no HTML, try RTF. 247 // Get HTML. If there's no HTML, try RTF.
247 if ([types containsObject:NSHTMLPboardType]) { 248 if ([types containsObject:NSHTMLPboardType]) {
248 data->text_html = 249 data->html = NullableString16(
249 base::SysNSStringToUTF16([pboard stringForType:NSHTMLPboardType]); 250 base::SysNSStringToUTF16([pboard stringForType:NSHTMLPboardType]),
251 false);
250 } else if ([types containsObject:NSRTFPboardType]) { 252 } else if ([types containsObject:NSRTFPboardType]) {
251 NSString* html = [pboard htmlFromRtf]; 253 NSString* html = [pboard htmlFromRtf];
252 data->text_html = base::SysNSStringToUTF16(html); 254 data->html = NullableString16(base::SysNSStringToUTF16(html), false);
253 } 255 }
254 256
255 // Get files. 257 // Get files.
256 if ([types containsObject:NSFilenamesPboardType]) { 258 if ([types containsObject:NSFilenamesPboardType]) {
257 NSArray* files = [pboard propertyListForType:NSFilenamesPboardType]; 259 NSArray* files = [pboard propertyListForType:NSFilenamesPboardType];
258 if ([files isKindOfClass:[NSArray class]] && [files count]) { 260 if ([files isKindOfClass:[NSArray class]] && [files count]) {
259 for (NSUInteger i = 0; i < [files count]; i++) { 261 for (NSUInteger i = 0; i < [files count]; i++) {
260 NSString* filename = [files objectAtIndex:i]; 262 NSString* filename = [files objectAtIndex:i];
261 BOOL exists = [[NSFileManager defaultManager] 263 BOOL exists = [[NSFileManager defaultManager]
262 fileExistsAtPath:filename]; 264 fileExistsAtPath:filename];
(...skipping 11 matching lines...) Expand all
274 // Get custom MIME data. 276 // Get custom MIME data.
275 if ([types containsObject:ui::kWebCustomDataPboardType]) { 277 if ([types containsObject:ui::kWebCustomDataPboardType]) {
276 NSData* customData = [pboard dataForType:ui::kWebCustomDataPboardType]; 278 NSData* customData = [pboard dataForType:ui::kWebCustomDataPboardType];
277 ui::ReadCustomDataIntoMap([customData bytes], 279 ui::ReadCustomDataIntoMap([customData bytes],
278 [customData length], 280 [customData length],
279 &data->custom_data); 281 &data->custom_data);
280 } 282 }
281 } 283 }
282 284
283 @end 285 @end
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_drag_dest_gtk.cc ('k') | content/browser/web_contents/web_drag_dest_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698