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

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller.h

Issue 493143004: mac: Major fullscreen refactor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix 2 minor bugs, remove 2 unit tests that no longer test anything. Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/browser_window_controller.h
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.h b/chrome/browser/ui/cocoa/browser_window_controller.h
index d575bd89311487408028a5d74cc5cb8c0ef259e7..8086d0589ab52e29d45f2ed8eb2506f3e1e41dc0 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.h
+++ b/chrome/browser/ui/cocoa/browser_window_controller.h
@@ -57,6 +57,14 @@ namespace extensions {
class Command;
}
+namespace fullscreen_mac {
+enum SlidingStyle {
+ OMNIBOX_TABS_PRESENT = 0, // Tab strip and omnibox both visible.
+ OMNIBOX_PRESENT, // Tab strip hidden.
Robert Sesek 2014/08/27 22:04:30 When is this mode used?
erikchen 2014/08/28 00:50:28 Only for simplified fullscreen.
+ OMNIBOX_TABS_HIDDEN, // Tab strip and omnibox both hidden.
+};
+} // namespace fullscreen_mac
+
@interface BrowserWindowController :
TabWindowController<NSUserInterfaceValidations,
BookmarkBarControllerDelegate,
@@ -81,7 +89,6 @@ class Command;
base::scoped_nsobject<OverlayableContentsController>
overlayableContentsController_;
base::scoped_nsobject<PresentationModeController> presentationModeController_;
- base::scoped_nsobject<FullscreenModeController> fullscreenModeController_;
base::scoped_nsobject<FullscreenExitBubbleController>
fullscreenExitBubbleController_;
@@ -133,6 +140,9 @@ class Command;
// True between |-windowWillEnterFullScreen:| and |-windowDidEnterFullScreen:|
// to indicate that the window is in the process of transitioning into
// fullscreen mode.
+ //
+ // TODO(erikchen): This flag is used when entering AppKit Fullscreen and
+ // immersive fullscreen. This is confusing.
BOOL enteringFullscreen_;
// True between |-setPresentationMode:url:bubbleType:| and
@@ -148,6 +158,9 @@ class Command;
// The proportion of the floating bar which is shown (in presentation mode).
CGFloat floatingBarShownFraction_;
+ // Whether the omnibox is hidden in fullscreen.
+ fullscreen_mac::SlidingStyle fullscreenStyle_;
+
// Various UI elements/events may want to ensure that the floating bar is
// visible (in presentation mode), e.g., because of where the mouse is or
// where keyboard focus is. Whenever an object requires bar visibility, it has
@@ -401,6 +414,71 @@ class Command;
@end // @interface BrowserWindowController(WindowType)
+// Fullscreen terminology:
+//
+// ----------------------------------------------------------------------------
+// There are 2 APIs that cause the window to get resized, and possibly move
+// spaces.
+//
+// + AppKitFullscreen API: AppKit touts a feature known as "fullscreen". This
+// involves moving the current window to a different space, and resizing the
+// window to take up the entire size of the screen.
+//
+// + Immersive fullscreen: An alternative to AppKitFullscreen API. Uses on 10.6
+// (before AppKitFullscreen API was available), and on certain HTML/Flash
+// content. This is a method defined by Chrome.
+//
+// The Immersive fullscreen API can be called after the AppKitFullscreen API.
+// Calling the AppKitFullscreen API while immersive fullscreen API has been
+// invoked causes all fullscreen modes to exit.
+//
+// ----------------------------------------------------------------------------
+// There are 3 "styles" of omnibox sliding.
+// + OMNIBOX_TABS_PRESENT: Both the omnibox and the tabstrip are present.
+// Moving the cursor to the top causes the menubar to appear, and everything
+// else to slide down.
+// + OMNIBOX_PRESENT: The tabstrip is hidden. Moving the cursor to the top
+// shows the tabstrip and menubar, sliding everything else down.
+// + OMNIBOX_TABS_HIDDEN: Both tabstrip and omnibox are hidden. Moving cursor
+// to top shows tabstrip, omnibox, and menu bar.
+//
+// The omnibox sliding styles are used in conjunction with the fullscreen APIs.
+// There is exactly 1 sliding style active at a time. The sliding is mangaged
+// by the presentationModeController_. (poorly named).
+//
+// ----------------------------------------------------------------------------
+// There are several "fullscreen modes" bantered around. Technically, any
+// fullscreen API can be combined with any sliding style.
+//
+// + System fullscreen***deprecated***: This term is confusing. Don't use it.
+// I've tried to remove all references to it. It either refers to the
Robert Sesek 2014/08/27 22:04:30 Please only use the third person in comments.
erikchen 2014/08/28 00:50:28 Done. I went through the whole CL and removed all
+// AppKitFullscreen API, or the behavior that users expect to see when they
+// click the fullscreen button, or some Chrome specific implementation that
+// uses the AppKitFullscreen API.
+//
+// + Canonical Fullscreen: When a user clicks on the fullscreen button, they
Robert Sesek 2014/08/27 22:04:30 This is as system fullscreen.
erikchen 2014/08/28 00:50:28 What do you mean by your comment? Is that a questi
+// expect a fullscreen behavior similar to other AppKit apps.
+// - AppKitFullscreen API + OMNIBOX_TABS_PRESENT.
+// - The button click directly invokes the AppKitFullscreen API. We get a
+// callback, and call adjustUIForOmniboxFullscreen.
+// - We have a menu item that is intended to invoke the same behavior. When
+// they click the menu item, or use its hotkey, we manually invoke the
+// AppKitFullscreen API.
+//
+// + Presentation Mode:
+// - OMNIBOX_TABS_HIDDEN, typically with AppKitFullscreen API, but can
+// also be with Immersive fullscreen API.
+// - We set a flag, indicating that we want Presentation Mode instead of
+// Canonical Fullscreen. Then we invoke the AppKitFullscreen API.
+//
+// + HTML5 fullscreen. <-- Currently uses AppKitFullscreen API. We want
+// this to change.
+//
+// + Simplified fullscreen. Hidden by default. Some users have manually
Robert Sesek 2014/08/27 22:04:30 Just kill this.
erikchen 2014/08/28 00:50:28 Okay. I will do so in a separate CL.
+// enabled it.
+// - OMNIBOX_PRESENT. Can be with either fullscreen API.
+//
+// + Flash fullscreen.
// Methods having to do with fullscreen and presentation mode.
@interface BrowserWindowController(Fullscreen)
@@ -409,43 +487,41 @@ class Command;
// or exit Lion fullscreen mode. Must not be called on Snow Leopard or earlier.
- (void)handleLionToggleFullscreen;
-// Enters (or exits) fullscreen mode. This method is safe to call on all OS
-// versions.
-- (void)enterFullscreen;
-- (void)exitFullscreen;
+// Enters Canonical Fullscreen.
+- (void)enterFullscreenWithChrome;
// Updates the contents of the fullscreen exit bubble with |url| and
// |bubbleType|.
- (void)updateFullscreenExitBubbleURL:(const GURL&)url
bubbleType:(FullscreenExitBubbleType)bubbleType;
-// Returns fullscreen state: YES when the window is in fullscreen or is
-// animating into fullscreen.
-- (BOOL)isFullscreen;
+// Returns YES if the code is in or entering any fullscreen mode.
+- (BOOL)isInOrEnteringAnyFullscreenMode;
Robert Sesek 2014/08/27 22:04:30 Not sure how helpful the "OrEntering" naming is an
erikchen 2014/08/28 00:50:28 Updated method names to remove "OrEntering".
// Returns YES if the browser window is currently in fullscreen via the built-in
// immersive mechanism.
- (BOOL)isInImmersiveFullscreen;
-// Returns YES if the browser window is currently in fullscreen via the Cocoa
-// System Fullscreen API.
-- (BOOL)isInSystemFullscreen;
+// Returns YES if the browser window is currently in fullscreen via the AppKit
+// Fullscreen API.
+- (BOOL)isInOrEnteringAppKitFullscreen;
+
+// Returns YES if the PresentationModeController exists and hence the omnibox
+// and other UI is expected to slide.
+- (BOOL)isInFullscreenWithOmniboxSliding;
-// Enters (or exits) presentation mode. Also enters fullscreen mode if this
-// window is not already fullscreen. This method is safe to call on all OS
-// versions.
+// Enters (or exits) presentation mode.
- (void)enterPresentationModeForURL:(const GURL&)url
bubbleType:(FullscreenExitBubbleType)bubbleType;
-- (void)exitPresentationMode;
-// For simplified fullscreen: Enters fullscreen for a tab at a URL. The |url|
-// is guaranteed to be non-empty; see -enterFullscreen for the user-initiated
-// fullscreen mode. Called on Snow Leopard and Lion+.
-- (void)enterFullscreenForURL:(const GURL&)url
- bubbleType:(FullscreenExitBubbleType)bubbleType;
+// Tries to enter presentation mode. Falls back to simplified fullscreen.
+- (void)enterGenericFullscreenForURL:(const GURL&)url
Robert Sesek 2014/08/27 22:04:30 Why is this generic? Fullscreen for a URL is a spe
erikchen 2014/08/28 00:50:28 Renamed the method to enterHTML5FullscreenForURL
+ bubbleType:(FullscreenExitBubbleType)bubbleType;
+// Exits the current fullscreen mode.
+- (void)exitGenericFullscreen;
-// Returns presentation mode state. This method is safe to call on all OS
-// versions.
+// Whether the system is in the very specific fullscreen mode: Presentation
+// Mode.
- (BOOL)inPresentationMode;
// Resizes the fullscreen window to fit the screen it's currently on. Called by

Powered by Google App Engine
This is Rietveld 408576698