1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #import "chrome/browser/ui/cocoa/event_utils.h" 6 7 #include "content/browser/disposition_utils.h" 8 9 namespace event_utils { 10 11 WindowOpenDisposition WindowOpenDispositionFromNSEvent(NSEvent* event) { 12 NSUInteger modifiers = [event modifierFlags]; 13 return WindowOpenDispositionFromNSEventWithFlags(event, modifiers); 14 } 15 16 WindowOpenDisposition WindowOpenDispositionFromNSEventWithFlags( 17 NSEvent* event, NSUInteger flags) { 18 return disposition_utils::DispositionFromClick( 19 [event buttonNumber] == 2, 20 flags & NSAlternateKeyMask, 21 flags & NSControlKeyMask, 22 flags & NSCommandKeyMask, 23 flags & NSShiftKeyMask); 24 } 25 26 } // namespace event_utils 27