Chromium Code Reviews| Index: content/browser/web_contents/web_drag_dest_win.cc |
| diff --git a/content/browser/web_contents/web_drag_dest_win.cc b/content/browser/web_contents/web_drag_dest_win.cc |
| index 8a3142d388caf1865150217fde715e6cbfd0c4dd..0bb4ea66a25607debef5e8319a5b5d0d890cee7d 100644 |
| --- a/content/browser/web_contents/web_drag_dest_win.cc |
| +++ b/content/browser/web_contents/web_drag_dest_win.cc |
| @@ -13,6 +13,7 @@ |
| #include "content/public/browser/web_drag_dest_delegate.h" |
| #include "googleurl/src/gurl.h" |
| #include "net/base/net_util.h" |
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| #include "ui/base/clipboard/clipboard_util_win.h" |
| #include "ui/base/dragdrop/os_exchange_data.h" |
| #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
| @@ -42,6 +43,21 @@ DWORD GetPreferredDropEffect(DWORD effect) { |
| return DROPEFFECT_NONE; |
| } |
| +int GetModifierFlags() { |
| + int modifier_state = 0; |
| + if (::GetKeyState(VK_SHIFT) & HIGH_BIT_MASK_SHORT) |
|
tony
2012/05/15 23:17:05
Nit: Can you use the HIBYTE macro?
varunjain
2012/05/16 01:30:23
HIBYTE returns the whole byte afaik while we just
|
| + modifier_state |= WebKit::WebInputEvent::ShiftKey; |
| + if (::GetKeyState(VK_CONTROL) & HIGH_BIT_MASK_SHORT) |
| + modifier_state |= WebKit::WebInputEvent::ControlKey; |
| + if (::GetKeyState(VK_MENU) & HIGH_BIT_MASK_SHORT) |
| + modifier_state |= WebKit::WebInputEvent::AltKey; |
| + if (::GetKeyState(VK_LWIN) & HIGH_BIT_MASK_SHORT) |
| + modifier_state |= WebKit::WebInputEvent::MetaKey; |
| + if (::GetKeyState(VK_RWIN) & HIGH_BIT_MASK_SHORT) |
| + modifier_state |= WebKit::WebInputEvent::MetaKey; |
| + return modifier_state; |
| +} |
| + |
| } // namespace |
| // InterstitialDropTarget is like a ui::DropTarget implementation that |
| @@ -129,7 +145,8 @@ DWORD WebDragDest::OnDragEnter(IDataObject* data_object, |
| web_contents_->GetRenderViewHost()->DragTargetDragEnter(*drop_data_, |
| gfx::Point(client_pt.x, client_pt.y), |
| gfx::Point(cursor_position.x, cursor_position.y), |
| - web_drag_utils_win::WinDragOpMaskToWebDragOpMask(effects)); |
| + web_drag_utils_win::WinDragOpMaskToWebDragOpMask(effects), |
| + GetModifierFlags()); |
| if (delegate_) |
| delegate_->OnDragEnter(data_object); |
| @@ -155,7 +172,8 @@ DWORD WebDragDest::OnDragOver(IDataObject* data_object, |
| web_contents_->GetRenderViewHost()->DragTargetDragOver( |
| gfx::Point(client_pt.x, client_pt.y), |
| gfx::Point(cursor_position.x, cursor_position.y), |
| - web_drag_utils_win::WinDragOpMaskToWebDragOpMask(effects)); |
| + web_drag_utils_win::WinDragOpMaskToWebDragOpMask(effects), |
| + GetModifierFlags()); |
| if (delegate_) |
| delegate_->OnDragOver(data_object); |
| @@ -198,7 +216,8 @@ DWORD WebDragDest::OnDrop(IDataObject* data_object, |
| ScreenToClient(GetHWND(), &client_pt); |
| web_contents_->GetRenderViewHost()->DragTargetDrop( |
| gfx::Point(client_pt.x, client_pt.y), |
| - gfx::Point(cursor_position.x, cursor_position.y)); |
| + gfx::Point(cursor_position.x, cursor_position.y), |
| + GetModifierFlags()); |
| if (delegate_) |
| delegate_->OnDrop(data_object); |