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 0e57d4fffdee46ca083f189ca7a90f08e91da6ae..bc41d43a49a36578be349304795d999316f74ecd 100644 |
--- a/content/browser/web_contents/web_drag_dest_mac.mm |
+++ b/content/browser/web_contents/web_drag_dest_mac.mm |
@@ -24,6 +24,8 @@ using content::OpenURLParams; |
using content::Referrer; |
using content::WebContentsImpl; |
+namespace { |
+ |
int GetModifierFlags() { |
int modifier_state = 0; |
UInt32 currentModifiers = GetCurrentKeyModifiers(); |
@@ -35,9 +37,24 @@ int GetModifierFlags() { |
modifier_state |= blink::WebInputEvent::AltKey; |
if (currentModifiers & ::cmdKey) |
modifier_state |= blink::WebInputEvent::MetaKey; |
+ |
+ // The return value of 1 << 0 corresponds to the left mouse button, |
+ // 1 << 1 corresponds to the right mouse button, |
+ // 1 << n, n >= 2 correspond to other mouse buttons. |
+ NSUInteger pressedButtons = [NSEvent pressedMouseButtons]; |
+ |
+ if (pressedButtons & (1 << 0)) |
+ modifier_state |= blink::WebInputEvent::LeftButtonDown; |
+ if (pressedButtons & (1 << 1)) |
+ modifier_state |= blink::WebInputEvent::RightButtonDown; |
+ if (pressedButtons & (1 << 2)) |
+ modifier_state |= blink::WebInputEvent::MiddleButtonDown; |
+ |
return modifier_state; |
} |
+} // namespace |
+ |
@implementation WebDragDest |
// |contents| is the WebContentsImpl representing this tab, used to communicate |