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