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

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

Issue 10377119: Plumb event flags (shift/alt/ctrl modifiers) for drag/drop events to WebKit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
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 #include "base/sys_string_conversions.h" 7 #include "base/sys_string_conversions.h"
8 #include "content/browser/renderer_host/render_view_host_impl.h" 8 #include "content/browser/renderer_host/render_view_host_impl.h"
9 #include "content/browser/web_contents/web_contents_impl.h" 9 #include "content/browser/web_contents/web_contents_impl.h"
10 #include "content/public/browser/web_drag_dest_delegate.h" 10 #include "content/public/browser/web_drag_dest_delegate.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // Create the appropriate mouse locations for WebCore. The draggingLocation 104 // Create the appropriate mouse locations for WebCore. The draggingLocation
105 // is in window coordinates. Both need to be flipped. 105 // is in window coordinates. Both need to be flipped.
106 NSPoint windowPoint = [info draggingLocation]; 106 NSPoint windowPoint = [info draggingLocation];
107 NSPoint viewPoint = [self flipWindowPointToView:windowPoint view:view]; 107 NSPoint viewPoint = [self flipWindowPointToView:windowPoint view:view];
108 NSPoint screenPoint = [self flipWindowPointToScreen:windowPoint view:view]; 108 NSPoint screenPoint = [self flipWindowPointToScreen:windowPoint view:view];
109 NSDragOperation mask = [info draggingSourceOperationMask]; 109 NSDragOperation mask = [info draggingSourceOperationMask];
110 webContents_->GetRenderViewHost()->DragTargetDragEnter( 110 webContents_->GetRenderViewHost()->DragTargetDragEnter(
111 *dropData_, 111 *dropData_,
112 gfx::Point(viewPoint.x, viewPoint.y), 112 gfx::Point(viewPoint.x, viewPoint.y),
113 gfx::Point(screenPoint.x, screenPoint.y), 113 gfx::Point(screenPoint.x, screenPoint.y),
114 static_cast<WebDragOperationsMask>(mask)); 114 static_cast<WebDragOperationsMask>(mask),
115 0 /* shift/ctrl/alt flags */);
jam 2012/05/15 16:57:53 nit: personally, I'm not a fan of adding comments
varunjain 2012/05/15 23:03:39 Done.
115 116
116 // We won't know the true operation (whether the drag is allowed) until we 117 // We won't know the true operation (whether the drag is allowed) until we
117 // hear back from the renderer. For now, be optimistic: 118 // hear back from the renderer. For now, be optimistic:
118 currentOperation_ = NSDragOperationCopy; 119 currentOperation_ = NSDragOperationCopy;
119 return currentOperation_; 120 return currentOperation_;
120 } 121 }
121 122
122 - (void)draggingExited:(id<NSDraggingInfo>)info { 123 - (void)draggingExited:(id<NSDraggingInfo>)info {
123 DCHECK(currentRVH_); 124 DCHECK(currentRVH_);
124 if (currentRVH_ != webContents_->GetRenderViewHost()) 125 if (currentRVH_ != webContents_->GetRenderViewHost())
(...skipping 22 matching lines...) Expand all
147 148
148 // Create the appropriate mouse locations for WebCore. The draggingLocation 149 // Create the appropriate mouse locations for WebCore. The draggingLocation
149 // is in window coordinates. 150 // is in window coordinates.
150 NSPoint windowPoint = [info draggingLocation]; 151 NSPoint windowPoint = [info draggingLocation];
151 NSPoint viewPoint = [self flipWindowPointToView:windowPoint view:view]; 152 NSPoint viewPoint = [self flipWindowPointToView:windowPoint view:view];
152 NSPoint screenPoint = [self flipWindowPointToScreen:windowPoint view:view]; 153 NSPoint screenPoint = [self flipWindowPointToScreen:windowPoint view:view];
153 NSDragOperation mask = [info draggingSourceOperationMask]; 154 NSDragOperation mask = [info draggingSourceOperationMask];
154 webContents_->GetRenderViewHost()->DragTargetDragOver( 155 webContents_->GetRenderViewHost()->DragTargetDragOver(
155 gfx::Point(viewPoint.x, viewPoint.y), 156 gfx::Point(viewPoint.x, viewPoint.y),
156 gfx::Point(screenPoint.x, screenPoint.y), 157 gfx::Point(screenPoint.x, screenPoint.y),
157 static_cast<WebDragOperationsMask>(mask)); 158 static_cast<WebDragOperationsMask>(mask),
159 0 /* shift/ctrl/alt flags */);
158 160
159 if (delegate_) 161 if (delegate_)
160 delegate_->OnDragOver(); 162 delegate_->OnDragOver();
161 163
162 return currentOperation_; 164 return currentOperation_;
163 } 165 }
164 166
165 - (BOOL)performDragOperation:(id<NSDraggingInfo>)info 167 - (BOOL)performDragOperation:(id<NSDraggingInfo>)info
166 view:(NSView*)view { 168 view:(NSView*)view {
167 if (currentRVH_ != webContents_->GetRenderViewHost()) 169 if (currentRVH_ != webContents_->GetRenderViewHost())
(...skipping 19 matching lines...) Expand all
187 189
188 currentRVH_ = NULL; 190 currentRVH_ = NULL;
189 191
190 // Create the appropriate mouse locations for WebCore. The draggingLocation 192 // Create the appropriate mouse locations for WebCore. The draggingLocation
191 // is in window coordinates. Both need to be flipped. 193 // is in window coordinates. Both need to be flipped.
192 NSPoint windowPoint = [info draggingLocation]; 194 NSPoint windowPoint = [info draggingLocation];
193 NSPoint viewPoint = [self flipWindowPointToView:windowPoint view:view]; 195 NSPoint viewPoint = [self flipWindowPointToView:windowPoint view:view];
194 NSPoint screenPoint = [self flipWindowPointToScreen:windowPoint view:view]; 196 NSPoint screenPoint = [self flipWindowPointToScreen:windowPoint view:view];
195 webContents_->GetRenderViewHost()->DragTargetDrop( 197 webContents_->GetRenderViewHost()->DragTargetDrop(
196 gfx::Point(viewPoint.x, viewPoint.y), 198 gfx::Point(viewPoint.x, viewPoint.y),
197 gfx::Point(screenPoint.x, screenPoint.y)); 199 gfx::Point(screenPoint.x, screenPoint.y),
200 0 /* shift/ctrl/alt flags */);
198 201
199 dropData_.reset(); 202 dropData_.reset();
200 203
201 return result; 204 return result;
202 } 205 }
203 206
204 // Given |data|, which should not be nil, fill it in using the contents of the 207 // Given |data|, which should not be nil, fill it in using the contents of the
205 // given pasteboard. 208 // given pasteboard.
206 - (void)populateWebDropData:(WebDropData*)data 209 - (void)populateWebDropData:(WebDropData*)data
207 fromPasteboard:(NSPasteboard*)pboard { 210 fromPasteboard:(NSPasteboard*)pboard {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // Get custom MIME data. 257 // Get custom MIME data.
255 if ([types containsObject:ui::kWebCustomDataPboardType]) { 258 if ([types containsObject:ui::kWebCustomDataPboardType]) {
256 NSData* customData = [pboard dataForType:ui::kWebCustomDataPboardType]; 259 NSData* customData = [pboard dataForType:ui::kWebCustomDataPboardType];
257 ui::ReadCustomDataIntoMap([customData bytes], 260 ui::ReadCustomDataIntoMap([customData bytes],
258 [customData length], 261 [customData length],
259 &data->custom_data); 262 &data->custom_data);
260 } 263 }
261 } 264 }
262 265
263 @end 266 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698