File: browser_window_utils.h

package info (click to toggle)
chromium-browser 57.0.2987.98-1~deb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 2,637,852 kB
  • ctags: 2,544,394
  • sloc: cpp: 12,815,961; ansic: 3,676,222; python: 1,147,112; asm: 526,608; java: 523,212; xml: 286,794; perl: 92,654; sh: 86,408; objc: 73,271; makefile: 27,698; cs: 18,487; yacc: 13,031; tcl: 12,957; pascal: 4,875; ml: 4,716; lex: 3,904; sql: 3,862; ruby: 1,982; lisp: 1,508; php: 1,368; exp: 404; awk: 325; csh: 117; jsp: 39; sed: 37
file content (60 lines) | stat: -rw-r--r-- 2,614 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_UTILS_H_
#define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_UTILS_H_

#import <Cocoa/Cocoa.h>

#include "chrome/browser/ui/cocoa/themed_window.h"

namespace content {
struct NativeWebKeyboardEvent;
}

@interface BrowserWindowUtils : NSObject

// Returns YES if keyboard event should be handled.
+ (BOOL)shouldHandleKeyboardEvent:(const content::NativeWebKeyboardEvent&)event;

// Returns YES if keyboard event is a text editing command such as Copy or Paste
+ (BOOL)isTextEditingEvent:(const content::NativeWebKeyboardEvent&)event;

// Determines the command associated with the keyboard event.
// Returns -1 if no command found.
+ (int)getCommandId:(const content::NativeWebKeyboardEvent&)event;

// NSWindow must be a ChromeEventProcessingWindow.
+ (BOOL)handleKeyboardEvent:(NSEvent*)event
                   inWindow:(NSWindow*)window;

// Schedule a window title change in the next run loop iteration. This works
// around a Cocoa bug: if a window changes title during the tracking of the
// Window menu it doesn't display well and the constant re-sorting of the list
// makes it difficult for the user to pick the desired window.
// Passing in a non-nil oldTitle will also cancel any pending title changes with
// a matching window and title. This function returns a NSString* that can be
// passed in future calls as oldTitle.
+ (NSString*)scheduleReplaceOldTitle:(NSString*)oldTitle
                        withNewTitle:(NSString*)newTitle
                           forWindow:(NSWindow*)window;

// Returns the position in the coordinates of |windowView| that the top left of
// a theme image should be painted at. See
// [BrowserWindowController themeImagePositionForAlignment:] for more details.
+ (NSPoint)themeImagePositionFor:(NSView*)windowView
                    withTabStrip:(NSView*)tabStripView
                       alignment:(ThemeImageAlignment)alignment;

// Returns the position in the coordinates of |tabStripView| that the top left
// of a theme image should be painted at. This method exists so that the
// position can be queried by the new tab button before the tab strip is layed
// out.
+ (NSPoint)themeImagePositionInTabStripCoords:(NSView*)tabStripView
                                    alignment:(ThemeImageAlignment)alignment;

+ (void)activateWindowForController:(NSWindowController*)controller;
@end

#endif  // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_UTILS_H_