Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: content/browser/web_contents/web_drag_dest_mac.mm

Issue 1723763002: Add WebDragData to blink::WebView::dragtargetDrop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/web_contents/web_contents_view_aura.cc ('k') | content/common/drag_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 std::unique_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 currentRVH_->FilterDropData(dropData.get());
133 134
134 NSDragOperation mask = [info draggingSourceOperationMask]; 135 NSDragOperation mask = [info draggingSourceOperationMask];
135 136
136 // Give the delegate an opportunity to cancel the drag. 137 // Give the delegate an opportunity to cancel the drag.
137 canceled_ = !webContents_->GetDelegate()->CanDragEnter( 138 canceled_ = !webContents_->GetDelegate()->CanDragEnter(
138 webContents_, 139 webContents_,
139 *dropData, 140 *dropData,
140 static_cast<WebDragOperationsMask>(mask)); 141 static_cast<WebDragOperationsMask>(mask));
141 if (canceled_) 142 if (canceled_)
142 return NSDragOperationNone; 143 return NSDragOperationNone;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 delegate_->OnDrop(); 248 delegate_->OnDrop();
248 249
249 currentRVH_ = NULL; 250 currentRVH_ = NULL;
250 251
251 // Create the appropriate mouse locations for WebCore. The draggingLocation 252 // Create the appropriate mouse locations for WebCore. The draggingLocation
252 // is in window coordinates. Both need to be flipped. 253 // is in window coordinates. Both need to be flipped.
253 NSPoint windowPoint = [info draggingLocation]; 254 NSPoint windowPoint = [info draggingLocation];
254 NSPoint viewPoint = [self flipWindowPointToView:windowPoint view:view]; 255 NSPoint viewPoint = [self flipWindowPointToView:windowPoint view:view];
255 NSPoint screenPoint = [self flipWindowPointToScreen:windowPoint view:view]; 256 NSPoint screenPoint = [self flipWindowPointToScreen:windowPoint view:view];
256 webContents_->GetRenderViewHost()->DragTargetDrop( 257 webContents_->GetRenderViewHost()->DragTargetDrop(
257 gfx::Point(viewPoint.x, viewPoint.y), 258 *dropData_, gfx::Point(viewPoint.x, viewPoint.y),
258 gfx::Point(screenPoint.x, screenPoint.y), 259 gfx::Point(screenPoint.x, screenPoint.y), GetModifierFlags());
259 GetModifierFlags());
260 260
261 dropData_.reset(); 261 dropData_.reset();
262 262
263 return YES; 263 return YES;
264 } 264 }
265 265
266 // Given |data|, which should not be nil, fill it in using the contents of the 266 // 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 267 // given pasteboard. The types handled by this method should be kept in sync
268 // with [WebContentsViewCocoa registerDragTypes]. 268 // with [WebContentsViewCocoa registerDragTypes].
269 - (void)populateDropData:(DropData*)data 269 - (void)populateDropData:(DropData*)data
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_aura.cc ('k') | content/common/drag_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698