[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / framed_browser_window.h
blob3c9a6ba0889d77b3b23e912850c5b6df7a90fac1
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 // Cocoa class representing a framed browser window.
23 // We need to override NSWindow with our own class since we need access to all
24 // unhandled keyboard events and subclassing NSWindow is the only method to do
25 // this. We also handle our own window controls and custom window frame drawing.
26 @interface FramedBrowserWindow : ChromeBrowserWindow {
27 @private
28 BOOL shouldHideTitle_;
29 BOOL hasTabStrip_;
30 NSButton* closeButton_;
31 NSButton* miniaturizeButton_;
32 NSButton* zoomButton_;
34 CGFloat windowButtonsInterButtonSpacing_;
37 // Designated initializer.
38 - (id)initWithContentRect:(NSRect)contentRect
39 hasTabStrip:(BOOL)hasTabStrip;
41 // Tells the window to suppress title drawing.
42 - (void)setShouldHideTitle:(BOOL)flag;
44 // Returns the desired spacing between window control views.
45 - (CGFloat)windowButtonsInterButtonSpacing;
47 // Calls the superclass's implementation of |-toggleFullScreen:|.
48 - (void)toggleSystemFullScreen;
50 // Called by CustomFrameView to determine a custom location for the Lion
51 // fullscreen button. Returns NSZeroPoint to use the Lion default.
52 - (NSPoint)fullScreenButtonOriginAdjustment;
54 // Draws the window theme into the specified rect. Returns whether a theme was
55 // drawn (whether incognito or full pattern theme; an overlay image doesn't
56 // count).
57 + (BOOL)drawWindowThemeInDirtyRect:(NSRect)dirtyRect
58 forView:(NSView*)view
59 bounds:(NSRect)bounds
60 forceBlackBackground:(BOOL)forceBlackBackground;
62 // Gets the color to draw title text.
63 - (NSColor*)titleColor;
65 @end
67 @interface NSWindow (UndocumentedAPI)
69 // Undocumented Cocoa API to suppress drawing of the window's title.
70 // -setTitle: still works, but the title set only applies to the
71 // miniwindow and menus (and, importantly, Expose). Overridden to
72 // return |shouldHideTitle_|.
73 -(BOOL)_isTitleHidden;
75 @end
77 #endif // CHROME_BROWSER_UI_COCOA_FRAMED_BROWSER_WINDOW_H_