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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // Messages to send during the tracking of a drag, usually upon receiving | 119 // Messages to send during the tracking of a drag, usually upon receiving |
120 // calls from the view system. Communicates the drag messages to WebCore. | 120 // calls from the view system. Communicates the drag messages to WebCore. |
121 | 121 |
122 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info | 122 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info |
123 view:(NSView*)view { | 123 view:(NSView*)view { |
124 // Save off the RVH so we can tell if it changes during a drag. If it does, | 124 // Save off the RVH so we can tell if it changes during a drag. If it does, |
125 // we need to send a new enter message in draggingUpdated:. | 125 // we need to send a new enter message in draggingUpdated:. |
126 currentRVH_ = webContents_->GetRenderViewHost(); | 126 currentRVH_ = webContents_->GetRenderViewHost(); |
127 | 127 |
128 // Fill out a DropData from pasteboard. | 128 // Fill out a DropData from pasteboard. |
129 scoped_ptr<DropData> dropData; | 129 std::unique_ptr<DropData> dropData; |
130 dropData.reset(new DropData()); | 130 dropData.reset(new DropData()); |
131 [self populateDropData:dropData.get() | 131 [self populateDropData:dropData.get() |
132 fromPasteboard:[info draggingPasteboard]]; | 132 fromPasteboard:[info draggingPasteboard]]; |
133 | 133 |
134 NSDragOperation mask = [info draggingSourceOperationMask]; | 134 NSDragOperation mask = [info draggingSourceOperationMask]; |
135 | 135 |
136 // Give the delegate an opportunity to cancel the drag. | 136 // Give the delegate an opportunity to cancel the drag. |
137 canceled_ = !webContents_->GetDelegate()->CanDragEnter( | 137 canceled_ = !webContents_->GetDelegate()->CanDragEnter( |
138 webContents_, | 138 webContents_, |
139 *dropData, | 139 *dropData, |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 // Get custom MIME data. | 323 // Get custom MIME data. |
324 if ([types containsObject:ui::kWebCustomDataPboardType]) { | 324 if ([types containsObject:ui::kWebCustomDataPboardType]) { |
325 NSData* customData = [pboard dataForType:ui::kWebCustomDataPboardType]; | 325 NSData* customData = [pboard dataForType:ui::kWebCustomDataPboardType]; |
326 ui::ReadCustomDataIntoMap([customData bytes], | 326 ui::ReadCustomDataIntoMap([customData bytes], |
327 [customData length], | 327 [customData length], |
328 &data->custom_data); | 328 &data->custom_data); |
329 } | 329 } |
330 } | 330 } |
331 | 331 |
332 @end | 332 @end |
OLD | NEW |