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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 246 |
247 // Given |data|, which should not be nil, fill it in using the contents of the | 247 // Given |data|, which should not be nil, fill it in using the contents of the |
248 // given pasteboard. The types handled by this method should be kept in sync | 248 // given pasteboard. The types handled by this method should be kept in sync |
249 // with [WebContentsViewCocoa registerDragTypes]. | 249 // with [WebContentsViewCocoa registerDragTypes]. |
250 - (void)populateDropData:(DropData*)data | 250 - (void)populateDropData:(DropData*)data |
251 fromPasteboard:(NSPasteboard*)pboard { | 251 fromPasteboard:(NSPasteboard*)pboard { |
252 DCHECK(data); | 252 DCHECK(data); |
253 DCHECK(pboard); | 253 DCHECK(pboard); |
254 NSArray* types = [pboard types]; | 254 NSArray* types = [pboard types]; |
255 | 255 |
| 256 data->did_originate_from_renderer = |
| 257 [types containsObject:ui::kChromeDragDummyPboardType]; |
| 258 |
256 // Get URL if possible. To avoid exposing file system paths to web content, | 259 // Get URL if possible. To avoid exposing file system paths to web content, |
257 // filenames in the drag are not converted to file URLs. | 260 // filenames in the drag are not converted to file URLs. |
258 ui::PopulateURLAndTitleFromPasteboard(&data->url, | 261 ui::PopulateURLAndTitleFromPasteboard(&data->url, |
259 &data->url_title, | 262 &data->url_title, |
260 pboard, | 263 pboard, |
261 NO); | 264 NO); |
262 | 265 |
263 // Get plain text. | 266 // Get plain text. |
264 if ([types containsObject:NSStringPboardType]) { | 267 if ([types containsObject:NSStringPboardType]) { |
265 data->text = base::NullableString16( | 268 data->text = base::NullableString16( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 // Get custom MIME data. | 304 // Get custom MIME data. |
302 if ([types containsObject:ui::kWebCustomDataPboardType]) { | 305 if ([types containsObject:ui::kWebCustomDataPboardType]) { |
303 NSData* customData = [pboard dataForType:ui::kWebCustomDataPboardType]; | 306 NSData* customData = [pboard dataForType:ui::kWebCustomDataPboardType]; |
304 ui::ReadCustomDataIntoMap([customData bytes], | 307 ui::ReadCustomDataIntoMap([customData bytes], |
305 [customData length], | 308 [customData length], |
306 &data->custom_data); | 309 &data->custom_data); |
307 } | 310 } |
308 } | 311 } |
309 | 312 |
310 @end | 313 @end |
OLD | NEW |