OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_COCOA_EVENT_UTILS_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_EVENT_UTILS_H_ |
6 #define CHROME_BROWSER_UI_COCOA_EVENT_UTILS_H_ | 6 #define CHROME_BROWSER_UI_COCOA_EVENT_UTILS_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "webkit/glue/window_open_disposition.h" | 10 #include "ui/base/window_open_disposition.h" |
11 | 11 |
12 namespace event_utils { | 12 namespace event_utils { |
13 | 13 |
14 // Retrieves a bitsum of ui::EventFlags represented by |event|, | 14 // Retrieves a bitsum of ui::EventFlags represented by |event|, |
15 int EventFlagsFromNSEvent(NSEvent* event); | 15 int EventFlagsFromNSEvent(NSEvent* event); |
16 | 16 |
17 // Retrieves a bitsum of ui::EventFlags represented by |event|, | 17 // Retrieves a bitsum of ui::EventFlags represented by |event|, |
18 // but instead use the modifier flags given by |modifiers|, | 18 // but instead use the modifier flags given by |modifiers|, |
19 // which is the same format as |-NSEvent modifierFlags|. This allows | 19 // which is the same format as |-NSEvent modifierFlags|. This allows |
20 // substitution of the modifiers without having to create a new event from | 20 // substitution of the modifiers without having to create a new event from |
21 // scratch. | 21 // scratch. |
22 int EventFlagsFromNSEventWithModifiers(NSEvent* event, NSUInteger modifiers); | 22 int EventFlagsFromNSEventWithModifiers(NSEvent* event, NSUInteger modifiers); |
23 | 23 |
24 // Retrieves the WindowOpenDisposition used to open a link from a user gesture | 24 // Retrieves the WindowOpenDisposition used to open a link from a user gesture |
25 // represented by |event|. For example, a Cmd+Click would mean open the | 25 // represented by |event|. For example, a Cmd+Click would mean open the |
26 // associated link in a background tab. | 26 // associated link in a background tab. |
27 WindowOpenDisposition WindowOpenDispositionFromNSEvent(NSEvent* event); | 27 WindowOpenDisposition WindowOpenDispositionFromNSEvent(NSEvent* event); |
28 | 28 |
29 // Retrieves the WindowOpenDisposition used to open a link from a user gesture | 29 // Retrieves the WindowOpenDisposition used to open a link from a user gesture |
30 // represented by |event|, but instead use the modifier flags given by |flags|, | 30 // represented by |event|, but instead use the modifier flags given by |flags|, |
31 // which is the same format as |-NSEvent modifierFlags|. This allows | 31 // which is the same format as |-NSEvent modifierFlags|. This allows |
32 // substitution of the modifiers without having to create a new event from | 32 // substitution of the modifiers without having to create a new event from |
33 // scratch. | 33 // scratch. |
34 WindowOpenDisposition WindowOpenDispositionFromNSEventWithFlags( | 34 WindowOpenDisposition WindowOpenDispositionFromNSEventWithFlags( |
35 NSEvent* event, NSUInteger flags); | 35 NSEvent* event, NSUInteger flags); |
36 | 36 |
37 } // namespace event_utils | 37 } // namespace event_utils |
38 | 38 |
39 #endif // CHROME_BROWSER_UI_COCOA_EVENT_UTILS_H_ | 39 #endif // CHROME_BROWSER_UI_COCOA_EVENT_UTILS_H_ |
OLD | NEW |