Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_COCOA_PRESENTATION_MODE_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_PRESENTATION_MODE_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_PRESENTATION_MODE_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_PRESENTATION_MODE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <Carbon/Carbon.h> | |
| 8 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
| 9 | 10 |
| 10 #include "base/mac/mac_util.h" | 11 #include "base/mac/mac_util.h" |
| 11 #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 12 #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
| 12 | 13 |
| 13 @class BrowserWindowController; | 14 @class BrowserWindowController; |
| 14 @class DropdownAnimation; | 15 @class DropdownAnimation; |
| 15 | 16 |
| 17 namespace fullscreen_mac { | |
| 18 enum SlidingStyle { | |
| 19 OMNIBOX_TABS_PRESENT = 0, // Tab strip and omnibox both visible. | |
| 20 OMNIBOX_PRESENT, // Tab strip hidden. | |
| 21 OMNIBOX_TABS_HIDDEN, // Tab strip and omnibox both hidden. | |
| 22 }; | |
| 23 } // namespace fullscreen_mac | |
| 24 | |
| 16 // TODO(erikchen): This controller is misnamed. It manages the sliding tab | 25 // TODO(erikchen): This controller is misnamed. It manages the sliding tab |
| 17 // strip and omnibox in all fullscreen modes. | 26 // strip and omnibox in all fullscreen modes. |
| 18 | 27 |
| 19 // Provides a controller to manage presentation mode for a single browser | 28 // Provides a controller to manage presentation mode for a single browser |
| 20 // window. This class handles running animations, showing and hiding the | 29 // window. This class handles running animations, showing and hiding the |
| 21 // floating dropdown bar, and managing the tracking area associated with the | 30 // floating dropdown bar, and managing the tracking area associated with the |
| 22 // dropdown. This class does not directly manage any views -- the | 31 // dropdown. This class does not directly manage any views -- the |
| 23 // BrowserWindowController is responsible for positioning and z-ordering views. | 32 // BrowserWindowController is responsible for positioning and z-ordering views. |
| 24 // | 33 // |
| 25 // Tracking areas are disabled while animations are running. If | 34 // Tracking areas are disabled while animations are running. If |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 // Tracks the currently requested system fullscreen mode, used to show or hide | 76 // Tracks the currently requested system fullscreen mode, used to show or hide |
| 68 // the menubar. This should be |kFullScreenModeNormal| when the window is not | 77 // the menubar. This should be |kFullScreenModeNormal| when the window is not |
| 69 // main or not fullscreen, |kFullScreenModeHideAll| while the overlay is | 78 // main or not fullscreen, |kFullScreenModeHideAll| while the overlay is |
| 70 // hidden, and |kFullScreenModeHideDock| while the overlay is shown. If the | 79 // hidden, and |kFullScreenModeHideDock| while the overlay is shown. If the |
| 71 // window is not on the primary screen, this should always be | 80 // window is not on the primary screen, this should always be |
| 72 // |kFullScreenModeNormal|. This value can get out of sync with the correct | 81 // |kFullScreenModeNormal|. This value can get out of sync with the correct |
| 73 // state if we miss a notification (which can happen when a window is closed). | 82 // state if we miss a notification (which can happen when a window is closed). |
| 74 // Used to track the current state and make sure we properly restore the menu | 83 // Used to track the current state and make sure we properly restore the menu |
| 75 // bar when this controller is destroyed. | 84 // bar when this controller is destroyed. |
| 76 base::mac::FullScreenMode systemFullscreenMode_; | 85 base::mac::FullScreenMode systemFullscreenMode_; |
| 86 | |
| 87 // Whether the omnibox is hidden in fullscreen. | |
| 88 fullscreen_mac::SlidingStyle slidingStyle_; | |
| 89 | |
| 90 // The percentage of the AppKit Menubar that is showing. Ranges from 0 to 1. | |
|
Robert Sesek
2014/09/02 19:59:48
I think it's a bit unclear to call this a percenta
erikchen
2014/09/02 20:43:21
changed names to menubarFraction_ and toolbarFract
| |
| 91 // Only used in AppKit Fullscreen. | |
| 92 CGFloat menubarPercentage_; | |
| 93 | |
| 94 // The percentage of the omnibox/tabstrip that is showing. Ranges from 0 to | |
| 95 // 1. Used in both AppKit and Immersive Fullscreen. | |
| 96 CGFloat toolbarPercentage_; | |
| 97 | |
| 98 // A Carbon event handler that tracks the revealed fraction of the menu bar. | |
| 99 EventHandlerRef menuBarTrackingHandler_; | |
| 77 } | 100 } |
| 78 | 101 |
| 79 @property(readonly, nonatomic) BOOL inPresentationMode; | 102 @property(readonly, nonatomic) BOOL inPresentationMode; |
| 80 | 103 |
| 104 @property(nonatomic, assign) fullscreen_mac::SlidingStyle slidingStyle; | |
| 105 @property(nonatomic, assign) CGFloat toolbarPercentage; | |
| 106 | |
| 81 // Designated initializer. | 107 // Designated initializer. |
| 82 - (id)initWithBrowserController:(BrowserWindowController*)controller; | 108 - (id)initWithBrowserController:(BrowserWindowController*)controller |
| 109 style:(fullscreen_mac::SlidingStyle)style; | |
| 83 | 110 |
| 84 // Informs the controller that the browser has entered or exited presentation | 111 // Informs the controller that the browser has entered or exited presentation |
| 85 // mode. |-enterPresentationModeForContentView:showDropdown:| should be called | 112 // mode. |-enterPresentationModeForContentView:showDropdown:| should be called |
| 86 // after the window is setup, just before it is shown. |-exitPresentationMode| | 113 // after the window is setup, just before it is shown. |-exitPresentationMode| |
| 87 // should be called before any views are moved back to the non-fullscreen | 114 // should be called before any views are moved back to the non-fullscreen |
| 88 // window. If |-enterPresentationModeForContentView:showDropdown:| is called, | 115 // window. If |-enterPresentationModeForContentView:showDropdown:| is called, |
| 89 // it must be balanced with a call to |-exitPresentationMode| before the | 116 // it must be balanced with a call to |-exitPresentationMode| before the |
| 90 // controller is released. | 117 // controller is released. |
| 91 - (void)enterPresentationModeForContentView:(NSView*)contentView | 118 - (void)enterPresentationModeForContentView:(NSView*)contentView |
| 92 showDropdown:(BOOL)showDropdown; | 119 showDropdown:(BOOL)showDropdown; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 103 - (void)overlayFrameChanged:(NSRect)frame; | 130 - (void)overlayFrameChanged:(NSRect)frame; |
| 104 | 131 |
| 105 // Informs the controller that the overlay should be shown/hidden, possibly with | 132 // Informs the controller that the overlay should be shown/hidden, possibly with |
| 106 // animation, possibly after a delay (only applicable for the animated case). | 133 // animation, possibly after a delay (only applicable for the animated case). |
| 107 - (void)ensureOverlayShownWithAnimation:(BOOL)animate delay:(BOOL)delay; | 134 - (void)ensureOverlayShownWithAnimation:(BOOL)animate delay:(BOOL)delay; |
| 108 - (void)ensureOverlayHiddenWithAnimation:(BOOL)animate delay:(BOOL)delay; | 135 - (void)ensureOverlayHiddenWithAnimation:(BOOL)animate delay:(BOOL)delay; |
| 109 | 136 |
| 110 // Cancels any running animation and timers. | 137 // Cancels any running animation and timers. |
| 111 - (void)cancelAnimationAndTimers; | 138 - (void)cancelAnimationAndTimers; |
| 112 | 139 |
| 113 // Gets the current floating bar shown fraction. | 140 // In any fullscreen mode, the y offset to use for the content at the top of |
| 114 - (CGFloat)floatingBarShownFraction; | 141 // the screen (tab strip, omnibox, bookmark bar, etc). |
| 142 // Ranges from 0 to -22. | |
| 143 - (CGFloat)menubarOffset; | |
| 115 | 144 |
| 116 // Sets a new current floating bar shown fraction. NOTE: This function has side | 145 // Callback for menu bar animations. |
| 117 // effects, such as modifying the system fullscreen mode (menu bar shown state). | 146 - (void)setMenuBarRevealProgress:(CGFloat)progress; |
| 118 - (void)changeFloatingBarShownFraction:(CGFloat)fraction; | |
| 119 | 147 |
| 120 @end | 148 @end |
| 121 | 149 |
| 122 // Notification posted when we're about to enter or leave fullscreen. | 150 // Notification posted when we're about to enter or leave fullscreen. |
| 123 extern NSString* const kWillEnterFullscreenNotification; | 151 extern NSString* const kWillEnterFullscreenNotification; |
| 124 extern NSString* const kWillLeaveFullscreenNotification; | 152 extern NSString* const kWillLeaveFullscreenNotification; |
| 125 | 153 |
| 126 #endif // CHROME_BROWSER_UI_COCOA_PRESENTATION_MODE_CONTROLLER_H_ | 154 #endif // CHROME_BROWSER_UI_COCOA_PRESENTATION_MODE_CONTROLLER_H_ |
| OLD | NEW |