Index: ui/views/widget/desktop_aura/desktop_drop_target_win.cc |
diff --git a/ui/views/widget/desktop_aura/desktop_drop_target_win.cc b/ui/views/widget/desktop_aura/desktop_drop_target_win.cc |
index f10fc1fc34b3b4e2573478c1710c62cb0ae84f91..6931bd5186338255f1c7d5476861b79c7a822f4f 100644 |
--- a/ui/views/widget/desktop_aura/desktop_drop_target_win.cc |
+++ b/ui/views/widget/desktop_aura/desktop_drop_target_win.cc |
@@ -20,6 +20,30 @@ using aura::client::DragDropDelegate; |
using ui::OSExchangeData; |
using ui::OSExchangeDataProviderWin; |
+namespace { |
+ |
+int ConvertKeyStateToAuraEventFlags(DWORD key_state) |
+{ |
+ int flags = 0; |
+ |
+ if (key_state & MK_CONTROL) |
+ flags |= ui::EF_CONTROL_DOWN; |
+ if (key_state & MK_ALT) |
+ flags |= ui::EF_ALT_DOWN; |
+ if (key_state & MK_SHIFT) |
+ flags |= ui::EF_SHIFT_DOWN; |
+ if (key_state & MK_LBUTTON) |
+ flags |= ui::EF_LEFT_MOUSE_BUTTON; |
+ if (key_state & MK_MBUTTON) |
+ flags |= ui::EF_MIDDLE_MOUSE_BUTTON; |
+ if (key_state & MK_RBUTTON) |
+ flags |= ui::EF_RIGHT_MOUSE_BUTTON; |
+ |
+ return flags; |
+} |
+ |
+} // namespace |
+ |
namespace views { |
DesktopDropTargetWin::DesktopDropTargetWin(aura::Window* root_window, |
@@ -132,11 +156,7 @@ void DesktopDropTargetWin::Translate( |
location, |
root_location, |
ui::DragDropTypes::DropEffectToDragOperation(effect))); |
- int flags = 0; |
- flags |= base::win::IsAltPressed() ? ui::EF_ALT_DOWN : ui::EF_NONE; |
- flags |= base::win::IsShiftPressed() ? ui::EF_SHIFT_DOWN : ui::EF_NONE; |
- flags |= base::win::IsCtrlPressed() ? ui::EF_CONTROL_DOWN : ui::EF_NONE; |
- (*event)->set_flags(flags); |
+ (*event)->set_flags(ConvertKeyStateToAuraEventFlags(key_state)); |
if (target_window_changed) |
(*delegate)->OnDragEntered(*event->get()); |
} |