Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / framed_browser_window.h
blob8c31ba8cf116177b67003a7bc17f87d5ef2191d6
1 // Copyright (c) 2012 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.
5 #ifndef CHROME_BROWSER_UI_COCOA_FRAMED_BROWSER_WINDOW_H_
6 #define CHROME_BROWSER_UI_COCOA_FRAMED_BROWSER_WINDOW_H_
8 #import <Cocoa/Cocoa.h>
10 #include "chrome/browser/ui/cocoa/chrome_browser_window.h"
12 // Offsets from the top/left of the window frame to the top of the window
13 // controls (zoom, close, miniaturize) for a window with a tabstrip.
14 const NSInteger kFramedWindowButtonsWithTabStripOffsetFromTop = 11;
15 const NSInteger kFramedWindowButtonsWithTabStripOffsetFromLeft = 11;
17 // Offsets from the top/left of the window frame to the top of the window
18 // controls (zoom, close, miniaturize) for a window without a tabstrip.
19 const NSInteger kFramedWindowButtonsWithoutTabStripOffsetFromTop = 4;
20 const NSInteger kFramedWindowButtonsWithoutTabStripOffsetFromLeft = 8;
22 // The amount of window background image that is painted at the top of the
23 // window, so that it shows behind the tap strip area.
24 const CGFloat kBrowserFrameViewPaintHeight = 60.0;
26 // Cocoa class representing a framed browser window.
27 // We need to override NSWindow with our own class since we need access to all
28 // unhandled keyboard events and subclassing NSWindow is the only method to do
29 // this. We also handle our own window controls and custom window frame drawing.
30 @interface FramedBrowserWindow : ChromeBrowserWindow {
31 @private
32 BOOL shouldHideTitle_;
33 BOOL hasTabStrip_;
34 NSButton* closeButton_;
35 NSButton* miniaturizeButton_;
36 NSButton* zoomButton_;
38 // Locks the window's frame and style mask. If it's set to YES, then the
39 // frame and the style mask cannot be changed.
40 BOOL frameAndStyleMaskLock_;
42 CGFloat windowButtonsInterButtonSpacing_;
45 // Designated initializer.
46 - (id)initWithContentRect:(NSRect)contentRect
47 hasTabStrip:(BOOL)hasTabStrip;
49 // Tells the window to suppress title drawing.
50 - (void)setShouldHideTitle:(BOOL)flag;
52 // When the lock is set to YES, the frame and style mask of the Window cannot be
53 // changed. This is used to prevent AppKit from making these unwanted changes
54 // to the window during exit fullscreen transition. It is very important to
55 // release this lock after the transition is completed.
56 - (void)setFrameAndStyleMaskLock:(BOOL)lock;
58 // This method is overridden to prevent AppKit from setting the style mask
59 // when frameAndStyleMaskLock_ is set to true.
60 - (void)setStyleMask:(NSUInteger)styleMask;
62 // This method is overridden to prevent the AppKit from setting the frame when
63 // frameAndStyleMaskLock_ is set to true.
64 - (void)setFrame:(NSRect)windowFrame
65 display:(BOOL)displayViews
66 animate:(BOOL)performAnimation;
68 // Returns the desired spacing between window control views.
69 - (CGFloat)windowButtonsInterButtonSpacing;
71 // Calls the superclass's implementation of |-toggleFullScreen:|.
72 - (void)toggleSystemFullScreen;
74 // Called by CustomFrameView to determine a custom location for the Lion
75 // fullscreen button. Returns NSZeroPoint to use the Lion default.
76 - (NSPoint)fullScreenButtonOriginAdjustment;
78 // Draws the window theme into the specified rect. Returns whether a theme was
79 // drawn (whether incognito or full pattern theme; an overlay image doesn't
80 // count).
81 + (BOOL)drawWindowThemeInDirtyRect:(NSRect)dirtyRect
82 forView:(NSView*)view
83 bounds:(NSRect)bounds
84 forceBlackBackground:(BOOL)forceBlackBackground;
86 // Gets the color to draw title text.
87 - (NSColor*)titleColor;
89 @end
91 @interface NSWindow (UndocumentedAPI)
93 // Undocumented Cocoa API to suppress drawing of the window's title.
94 // -setTitle: still works, but the title set only applies to the
95 // miniwindow and menus (and, importantly, Expose). Overridden to
96 // return |shouldHideTitle_|.
97 -(BOOL)_isTitleHidden;
99 @end
101 #endif // CHROME_BROWSER_UI_COCOA_FRAMED_BROWSER_WINDOW_H_