Chromium Code Reviews| Index: content/browser/web_contents/web_drag_dest_mac.mm |
| diff --git a/content/browser/web_contents/web_drag_dest_mac.mm b/content/browser/web_contents/web_drag_dest_mac.mm |
| index dd945fcaf7187b7dc49b88c9339bc071029915fb..c1173c725b5c9d8c8e465e5e89268aaa9eca20eb 100644 |
| --- a/content/browser/web_contents/web_drag_dest_mac.mm |
| +++ b/content/browser/web_contents/web_drag_dest_mac.mm |
| @@ -4,10 +4,13 @@ |
| #import "content/browser/web_contents/web_drag_dest_mac.h" |
| +#import <Carbon/Carbon.h> |
| + |
| #include "base/sys_string_conversions.h" |
| #include "content/browser/renderer_host/render_view_host_impl.h" |
| #include "content/browser/web_contents/web_contents_impl.h" |
| #include "content/public/browser/web_drag_dest_delegate.h" |
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| #import "third_party/mozilla/NSPasteboard+Utils.h" |
| #include "ui/base/clipboard/custom_data_helper.h" |
| #import "ui/base/dragdrop/cocoa_dnd_util.h" |
| @@ -18,6 +21,20 @@ using WebKit::WebDragOperationsMask; |
| using content::OpenURLParams; |
| using content::Referrer; |
| +- (int)GetModifierFlags { |
|
dcheng
2012/05/16 00:13:28
This should just be a regular C method declaration
varunjain
2012/05/16 01:30:23
Done.
|
| + int modifier_state = 0; |
| + UInt32 currentModifiers = GetCurrentKeyModifiers(); |
| + if (currentModifiers & ::shiftKey) |
| + modifier_state |= WebKit::WebInputEvent::ShiftKey; |
| + if (currentModifiers & ::controlKey) |
| + modifier_state |= WebKit::WebInputEvent::ControlKey; |
| + if (currentModifiers & ::optionKey) |
| + modifier_state |= WebKit::WebInputEvent::AltKey; |
| + if (currentModifiers & ::cmdKey) |
| + modifier_state |= WebKit::WebInputEvent::MetaKey; |
| + return modifier_state; |
| +} |
| + |
| @implementation WebDragDest |
| // |contents| is the WebContentsImpl representing this tab, used to communicate |
| @@ -111,7 +128,8 @@ using content::Referrer; |
| *dropData_, |
| gfx::Point(viewPoint.x, viewPoint.y), |
| gfx::Point(screenPoint.x, screenPoint.y), |
| - static_cast<WebDragOperationsMask>(mask)); |
| + static_cast<WebDragOperationsMask>(mask), |
| + GetModifierFlags()); |
| // We won't know the true operation (whether the drag is allowed) until we |
| // hear back from the renderer. For now, be optimistic: |
| @@ -154,7 +172,8 @@ using content::Referrer; |
| webContents_->GetRenderViewHost()->DragTargetDragOver( |
| gfx::Point(viewPoint.x, viewPoint.y), |
| gfx::Point(screenPoint.x, screenPoint.y), |
| - static_cast<WebDragOperationsMask>(mask)); |
| + static_cast<WebDragOperationsMask>(mask), |
| + GetModifierFlags()); |
| if (delegate_) |
| delegate_->OnDragOver(); |
| @@ -194,7 +213,8 @@ using content::Referrer; |
| NSPoint screenPoint = [self flipWindowPointToScreen:windowPoint view:view]; |
| webContents_->GetRenderViewHost()->DragTargetDrop( |
| gfx::Point(viewPoint.x, viewPoint.y), |
| - gfx::Point(screenPoint.x, screenPoint.y)); |
| + gfx::Point(screenPoint.x, screenPoint.y), |
| + GetModifierFlags()); |
| dropData_.reset(); |