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 0e57d4fffdee46ca083f189ca7a90f08e91da6ae..bc8823eec820e1f993a70232ad48302fa537c7ef 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 |
|
Avi (use Gerrit)
2015/03/11 02:08:15
two spaces between } and //
|
| + |
| @implementation WebDragDest |
| // |contents| is the WebContentsImpl representing this tab, used to communicate |