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_BROWSER_WINDOW_UTILS_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_UTILS_H_ |
6 #define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_UTILS_H_ | 6 #define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_UTILS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
10 | 10 |
11 class Browser; | 11 class Browser; |
| 12 |
| 13 namespace content { |
12 struct NativeWebKeyboardEvent; | 14 struct NativeWebKeyboardEvent; |
| 15 } |
13 | 16 |
14 @interface BrowserWindowUtils : NSObject | 17 @interface BrowserWindowUtils : NSObject |
15 | 18 |
16 // Returns YES if keyboard event should be handled. | 19 // Returns YES if keyboard event should be handled. |
17 + (BOOL)shouldHandleKeyboardEvent:(const NativeWebKeyboardEvent&)event; | 20 + (BOOL)shouldHandleKeyboardEvent:(const content::NativeWebKeyboardEvent&)event; |
18 | 21 |
19 // Determines the command associated with the keyboard event. | 22 // Determines the command associated with the keyboard event. |
20 // Returns -1 if no command found. | 23 // Returns -1 if no command found. |
21 + (int)getCommandId:(const NativeWebKeyboardEvent&)event; | 24 + (int)getCommandId:(const content::NativeWebKeyboardEvent&)event; |
22 | 25 |
23 // NSWindow must be a ChromeEventProcessingWindow. | 26 // NSWindow must be a ChromeEventProcessingWindow. |
24 + (BOOL)handleKeyboardEvent:(NSEvent*)event | 27 + (BOOL)handleKeyboardEvent:(NSEvent*)event |
25 inWindow:(NSWindow*)window; | 28 inWindow:(NSWindow*)window; |
26 | 29 |
27 // Schedule a window title change in the next run loop iteration. This works | 30 // Schedule a window title change in the next run loop iteration. This works |
28 // around a Cocoa bug: if a window changes title during the tracking of the | 31 // around a Cocoa bug: if a window changes title during the tracking of the |
29 // Window menu it doesn't display well and the constant re-sorting of the list | 32 // Window menu it doesn't display well and the constant re-sorting of the list |
30 // makes it difficult for the user to pick the desired window. | 33 // makes it difficult for the user to pick the desired window. |
31 // Passing in a non-nil oldTitle will also cancel any pending title changes with | 34 // Passing in a non-nil oldTitle will also cancel any pending title changes with |
32 // a matching window and title. This function returns a NSString* that can be | 35 // a matching window and title. This function returns a NSString* that can be |
33 // passed in future calls as oldTitle. | 36 // passed in future calls as oldTitle. |
34 + (NSString*)scheduleReplaceOldTitle:(NSString*)oldTitle | 37 + (NSString*)scheduleReplaceOldTitle:(NSString*)oldTitle |
35 withNewTitle:(NSString*)newTitle | 38 withNewTitle:(NSString*)newTitle |
36 forWindow:(NSWindow*)window; | 39 forWindow:(NSWindow*)window; |
37 | 40 |
38 + (NSPoint)themePatternPhaseFor:(NSView*)windowView | 41 + (NSPoint)themePatternPhaseFor:(NSView*)windowView |
39 withTabStrip:(NSView*)tabStripView; | 42 withTabStrip:(NSView*)tabStripView; |
40 | 43 |
41 + (void)activateWindowForController:(NSWindowController*)controller; | 44 + (void)activateWindowForController:(NSWindowController*)controller; |
42 @end | 45 @end |
43 | 46 |
44 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_UTILS_H_ | 47 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_UTILS_H_ |
OLD | NEW |