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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 delegate_->OnDrop(); | 247 delegate_->OnDrop(); |
248 | 248 |
249 currentRVH_ = NULL; | 249 currentRVH_ = NULL; |
250 | 250 |
251 // Create the appropriate mouse locations for WebCore. The draggingLocation | 251 // Create the appropriate mouse locations for WebCore. The draggingLocation |
252 // is in window coordinates. Both need to be flipped. | 252 // is in window coordinates. Both need to be flipped. |
253 NSPoint windowPoint = [info draggingLocation]; | 253 NSPoint windowPoint = [info draggingLocation]; |
254 NSPoint viewPoint = [self flipWindowPointToView:windowPoint view:view]; | 254 NSPoint viewPoint = [self flipWindowPointToView:windowPoint view:view]; |
255 NSPoint screenPoint = [self flipWindowPointToScreen:windowPoint view:view]; | 255 NSPoint screenPoint = [self flipWindowPointToScreen:windowPoint view:view]; |
256 webContents_->GetRenderViewHost()->DragTargetDrop( | 256 webContents_->GetRenderViewHost()->DragTargetDrop( |
257 gfx::Point(viewPoint.x, viewPoint.y), | 257 *dropData_, gfx::Point(viewPoint.x, viewPoint.y), |
258 gfx::Point(screenPoint.x, screenPoint.y), | 258 gfx::Point(screenPoint.x, screenPoint.y), GetModifierFlags()); |
259 GetModifierFlags()); | |
260 | 259 |
261 dropData_.reset(); | 260 dropData_.reset(); |
262 | 261 |
263 return YES; | 262 return YES; |
264 } | 263 } |
265 | 264 |
266 // Given |data|, which should not be nil, fill it in using the contents of the | 265 // Given |data|, which should not be nil, fill it in using the contents of the |
267 // given pasteboard. The types handled by this method should be kept in sync | 266 // given pasteboard. The types handled by this method should be kept in sync |
268 // with [WebContentsViewCocoa registerDragTypes]. | 267 // with [WebContentsViewCocoa registerDragTypes]. |
269 - (void)populateDropData:(DropData*)data | 268 - (void)populateDropData:(DropData*)data |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 // Get custom MIME data. | 322 // Get custom MIME data. |
324 if ([types containsObject:ui::kWebCustomDataPboardType]) { | 323 if ([types containsObject:ui::kWebCustomDataPboardType]) { |
325 NSData* customData = [pboard dataForType:ui::kWebCustomDataPboardType]; | 324 NSData* customData = [pboard dataForType:ui::kWebCustomDataPboardType]; |
326 ui::ReadCustomDataIntoMap([customData bytes], | 325 ui::ReadCustomDataIntoMap([customData bytes], |
327 [customData length], | 326 [customData length], |
328 &data->custom_data); | 327 &data->custom_data); |
329 } | 328 } |
330 } | 329 } |
331 | 330 |
332 @end | 331 @end |
OLD | NEW |