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 #ifndef CHROME_BROWSER_UI_COCOA_EVENT_UTILS_H_ 6 #define CHROME_BROWSER_UI_COCOA_EVENT_UTILS_H_ 7 #pragma once 8 9 #import <Cocoa/Cocoa.h> 10 11 #include "webkit/glue/window_open_disposition.h" 12 13 namespace event_utils { 14 15 // Retrieves the WindowOpenDisposition used to open a link from a user gesture 16 // represented by |event|. For example, a Cmd+Click would mean open the 17 // associated link in a background tab. 18 WindowOpenDisposition WindowOpenDispositionFromNSEvent(NSEvent* event); 19 20 // Retrieves the WindowOpenDisposition used to open a link from a user gesture 21 // represented by |event|, but instead use the modifier flags given by |flags|, 22 // which is the same format as |-NSEvent modifierFlags|. This allows 23 // substitution of the modifiers without having to create a new event from 24 // scratch. 25 WindowOpenDisposition WindowOpenDispositionFromNSEventWithFlags( 26 NSEvent* event, NSUInteger flags); 27 28 } // namespace event_utils 29 30 #endif // CHROME_BROWSER_UI_COCOA_EVENT_UTILS_H_ 31