OLD | NEW |
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/strings/sys_string_conversions.h" | 9 #include "base/strings/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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 241 |
242 // Get plain text. | 242 // Get plain text. |
243 if ([types containsObject:NSStringPboardType]) { | 243 if ([types containsObject:NSStringPboardType]) { |
244 data->text = NullableString16( | 244 data->text = NullableString16( |
245 base::SysNSStringToUTF16([pboard stringForType:NSStringPboardType]), | 245 base::SysNSStringToUTF16([pboard stringForType:NSStringPboardType]), |
246 false); | 246 false); |
247 } | 247 } |
248 | 248 |
249 // Get HTML. If there's no HTML, try RTF. | 249 // Get HTML. If there's no HTML, try RTF. |
250 if ([types containsObject:NSHTMLPboardType]) { | 250 if ([types containsObject:NSHTMLPboardType]) { |
251 data->html = NullableString16( | 251 NSString* html = [pboard stringForType:NSHTMLPboardType]; |
252 base::SysNSStringToUTF16([pboard stringForType:NSHTMLPboardType]), | 252 data->html = NullableString16(base::SysNSStringToUTF16(html), false); |
253 false); | 253 } else if ([types containsObject:ui::kChromeDragImageHTMLPboardType]) { |
| 254 NSString* html = [pboard stringForType:ui::kChromeDragImageHTMLPboardType]; |
| 255 data->html = NullableString16(base::SysNSStringToUTF16(html), false); |
254 } else if ([types containsObject:NSRTFPboardType]) { | 256 } else if ([types containsObject:NSRTFPboardType]) { |
255 NSString* html = [pboard htmlFromRtf]; | 257 NSString* html = [pboard htmlFromRtf]; |
256 data->html = NullableString16(base::SysNSStringToUTF16(html), false); | 258 data->html = NullableString16(base::SysNSStringToUTF16(html), false); |
257 } | 259 } |
258 | 260 |
259 // Get files. | 261 // Get files. |
260 if ([types containsObject:NSFilenamesPboardType]) { | 262 if ([types containsObject:NSFilenamesPboardType]) { |
261 NSArray* files = [pboard propertyListForType:NSFilenamesPboardType]; | 263 NSArray* files = [pboard propertyListForType:NSFilenamesPboardType]; |
262 if ([files isKindOfClass:[NSArray class]] && [files count]) { | 264 if ([files isKindOfClass:[NSArray class]] && [files count]) { |
263 for (NSUInteger i = 0; i < [files count]; i++) { | 265 for (NSUInteger i = 0; i < [files count]; i++) { |
(...skipping 14 matching lines...) Expand all Loading... |
278 // Get custom MIME data. | 280 // Get custom MIME data. |
279 if ([types containsObject:ui::kWebCustomDataPboardType]) { | 281 if ([types containsObject:ui::kWebCustomDataPboardType]) { |
280 NSData* customData = [pboard dataForType:ui::kWebCustomDataPboardType]; | 282 NSData* customData = [pboard dataForType:ui::kWebCustomDataPboardType]; |
281 ui::ReadCustomDataIntoMap([customData bytes], | 283 ui::ReadCustomDataIntoMap([customData bytes], |
282 [customData length], | 284 [customData length], |
283 &data->custom_data); | 285 &data->custom_data); |
284 } | 286 } |
285 } | 287 } |
286 | 288 |
287 @end | 289 @end |
OLD | NEW |