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