Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: chrome/browser/ui/cocoa/presentation_mode_controller.h

Issue 523723002: mac, fullscreen: Several bug fixes after major refactor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new_fullscreen2
Patch Set: More comments from rsesek. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 fraction of the AppKit Menubar that is showing. Ranges from 0 to 1.
91 // Only used in AppKit Fullscreen.
92 CGFloat menubarFraction_;
93
94 // The fraction of the omnibox/tabstrip that is showing. Ranges from 0 to 1.
95 // Used in both AppKit and Immersive Fullscreen.
96 CGFloat toolbarFraction_;
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;
103 @property(nonatomic, assign) fullscreen_mac::SlidingStyle slidingStyle;
104 @property(nonatomic, assign) CGFloat toolbarFraction;
80 105
81 // Designated initializer. 106 // Designated initializer.
82 - (id)initWithBrowserController:(BrowserWindowController*)controller; 107 - (id)initWithBrowserController:(BrowserWindowController*)controller
108 style:(fullscreen_mac::SlidingStyle)style;
83 109
84 // Informs the controller that the browser has entered or exited presentation 110 // Informs the controller that the browser has entered or exited presentation
85 // mode. |-enterPresentationModeForContentView:showDropdown:| should be called 111 // mode. |-enterPresentationModeForContentView:showDropdown:| should be called
86 // after the window is setup, just before it is shown. |-exitPresentationMode| 112 // 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 113 // should be called before any views are moved back to the non-fullscreen
88 // window. If |-enterPresentationModeForContentView:showDropdown:| is called, 114 // window. If |-enterPresentationModeForContentView:showDropdown:| is called,
89 // it must be balanced with a call to |-exitPresentationMode| before the 115 // it must be balanced with a call to |-exitPresentationMode| before the
90 // controller is released. 116 // controller is released.
91 - (void)enterPresentationModeForContentView:(NSView*)contentView 117 - (void)enterPresentationModeForContentView:(NSView*)contentView
92 showDropdown:(BOOL)showDropdown; 118 showDropdown:(BOOL)showDropdown;
(...skipping 10 matching lines...) Expand all
103 - (void)overlayFrameChanged:(NSRect)frame; 129 - (void)overlayFrameChanged:(NSRect)frame;
104 130
105 // Informs the controller that the overlay should be shown/hidden, possibly with 131 // Informs the controller that the overlay should be shown/hidden, possibly with
106 // animation, possibly after a delay (only applicable for the animated case). 132 // animation, possibly after a delay (only applicable for the animated case).
107 - (void)ensureOverlayShownWithAnimation:(BOOL)animate delay:(BOOL)delay; 133 - (void)ensureOverlayShownWithAnimation:(BOOL)animate delay:(BOOL)delay;
108 - (void)ensureOverlayHiddenWithAnimation:(BOOL)animate delay:(BOOL)delay; 134 - (void)ensureOverlayHiddenWithAnimation:(BOOL)animate delay:(BOOL)delay;
109 135
110 // Cancels any running animation and timers. 136 // Cancels any running animation and timers.
111 - (void)cancelAnimationAndTimers; 137 - (void)cancelAnimationAndTimers;
112 138
113 // Gets the current floating bar shown fraction. 139 // In any fullscreen mode, the y offset to use for the content at the top of
114 - (CGFloat)floatingBarShownFraction; 140 // the screen (tab strip, omnibox, bookmark bar, etc).
115 141 // Ranges from 0 to -22.
116 // Sets a new current floating bar shown fraction. NOTE: This function has side 142 - (CGFloat)menubarOffset;
117 // effects, such as modifying the system fullscreen mode (menu bar shown state).
118 - (void)changeFloatingBarShownFraction:(CGFloat)fraction;
119 143
120 @end 144 @end
121 145
122 // Notification posted when we're about to enter or leave fullscreen. 146 // Notification posted when we're about to enter or leave fullscreen.
123 extern NSString* const kWillEnterFullscreenNotification; 147 extern NSString* const kWillEnterFullscreenNotification;
124 extern NSString* const kWillLeaveFullscreenNotification; 148 extern NSString* const kWillLeaveFullscreenNotification;
125 149
126 #endif // CHROME_BROWSER_UI_COCOA_PRESENTATION_MODE_CONTROLLER_H_ 150 #endif // CHROME_BROWSER_UI_COCOA_PRESENTATION_MODE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller_private.mm ('k') | chrome/browser/ui/cocoa/presentation_mode_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698