OLD | NEW |
| (Empty) |
1 // Copyright 2013 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_FULLSCREEN_MODE_CONTROLLER_H_ | |
6 #define CHROME_BROWSER_UI_COCOA_FULLSCREEN_MODE_CONTROLLER_H_ | |
7 | |
8 #include <Carbon/Carbon.h> | |
9 #import <Cocoa/Cocoa.h> | |
10 | |
11 #import "base/mac/scoped_nsobject.h" | |
12 #import "ui/base/cocoa/tracking_area.h" | |
13 | |
14 @class BrowserWindowController; | |
15 | |
16 // This class is responsible for managing the menu bar and tabstrip animation | |
17 // when in --enable-simplified-fullscreen. By default, in fullscreen, only the | |
18 // toolbar and not the tabstrip are visible. When the user mouses near the top | |
19 // of the screen, then the full tabstrip becomes available. If the user mouses | |
20 // to the very top of the screen, the menubar also becomes visible. | |
21 // | |
22 // There is one instance of this class per BrowserWindowController, and it is | |
23 // created when fullscreen is being entered and is destroyed when fullscreen | |
24 // is exited. | |
25 @interface FullscreenModeController : NSObject<NSAnimationDelegate> { | |
26 @private | |
27 enum FullscreenToolbarState { | |
28 kFullscreenToolbarOnly, | |
29 kFullscreenToolbarAndTabstrip, | |
30 }; | |
31 | |
32 // The browser for which this is managing fullscreen. Weak, owns self. | |
33 BrowserWindowController* controller_; | |
34 | |
35 // The tracking area used to observe the top region of the fullscren window, | |
36 // to initiate the animations to bring down the tabstrip. | |
37 ui::ScopedCrTrackingArea trackingArea_; | |
38 | |
39 // The animation that is either showing or hiding the tabstrip. Nil when no | |
40 // animation is running. | |
41 base::scoped_nsobject<NSAnimation> animation_; | |
42 | |
43 // The current and destination states of |animation_|. When no animation is | |
44 // running, these values are equal. | |
45 FullscreenToolbarState destinationState_; | |
46 FullscreenToolbarState currentState_; | |
47 | |
48 // A Carbon event handler that tracks the revealed fraction of the menu bar. | |
49 EventHandlerRef menuBarTrackingHandler_; | |
50 | |
51 // A fraction in the range [0.0, 1.0] that indicates how much of the | |
52 // menu bar is visible. Updated via |menuBarTrackingHandler_|. | |
53 CGFloat menuBarRevealFraction_; | |
54 } | |
55 | |
56 // Designated initializer. Must be called after making the window fullscreen. | |
57 - (id)initWithBrowserWindowController:(BrowserWindowController*)bwc; | |
58 | |
59 // Returns the pixel height of the menu bar, adjusted for fractional visibility. | |
60 - (CGFloat)menuBarHeight; | |
61 | |
62 @end | |
63 | |
64 #endif // CHROME_BROWSER_UI_COCOA_FULLSCREEN_MODE_CONTROLLER_H_ | |
OLD | NEW |