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

Side by Side 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: Respond to rsesek comments. 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 | Annotate | Revision Log
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_BROWSER_WINDOW_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_
7 7
8 // A class acting as the Objective-C controller for the Browser 8 // A class acting as the Objective-C controller for the Browser
9 // object. Handles interactions between Cocoa and the cross-platform 9 // object. Handles interactions between Cocoa and the cross-platform
10 // code. Each window has a single toolbar and, by virtue of being a 10 // code. Each window has a single toolbar and, by virtue of being a
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 @class TranslateBubbleController; 50 @class TranslateBubbleController;
51 51
52 namespace content { 52 namespace content {
53 class WebContents; 53 class WebContents;
54 } 54 }
55 55
56 namespace extensions { 56 namespace extensions {
57 class Command; 57 class Command;
58 } 58 }
59 59
60 namespace fullscreen_mac {
61 enum SlidingStyle {
62 OMNIBOX_TABS_PRESENT = 0, // Tab strip and omnibox both visible.
63 OMNIBOX_PRESENT, // Tab strip hidden.
64 OMNIBOX_TABS_HIDDEN, // Tab strip and omnibox both hidden.
65 };
66 } // namespace fullscreen_mac
67
60 @interface BrowserWindowController : 68 @interface BrowserWindowController :
61 TabWindowController<NSUserInterfaceValidations, 69 TabWindowController<NSUserInterfaceValidations,
62 BookmarkBarControllerDelegate, 70 BookmarkBarControllerDelegate,
63 BrowserCommandExecutor, 71 BrowserCommandExecutor,
64 ViewResizer, 72 ViewResizer,
65 TabStripControllerDelegate> { 73 TabStripControllerDelegate> {
66 @private 74 @private
67 // The ordering of these members is important as it determines the order in 75 // The ordering of these members is important as it determines the order in
68 // which they are destroyed. |browser_| needs to be destroyed last as most of 76 // which they are destroyed. |browser_| needs to be destroyed last as most of
69 // the other objects hold weak references to it or things it owns 77 // the other objects hold weak references to it or things it owns
70 // (tab/toolbar/bookmark models, profiles, etc). 78 // (tab/toolbar/bookmark models, profiles, etc).
71 scoped_ptr<Browser> browser_; 79 scoped_ptr<Browser> browser_;
72 NSWindow* savedRegularWindow_; 80 NSWindow* savedRegularWindow_;
73 scoped_ptr<BrowserWindowCocoa> windowShim_; 81 scoped_ptr<BrowserWindowCocoa> windowShim_;
74 base::scoped_nsobject<ToolbarController> toolbarController_; 82 base::scoped_nsobject<ToolbarController> toolbarController_;
75 base::scoped_nsobject<TabStripController> tabStripController_; 83 base::scoped_nsobject<TabStripController> tabStripController_;
76 base::scoped_nsobject<FindBarCocoaController> findBarCocoaController_; 84 base::scoped_nsobject<FindBarCocoaController> findBarCocoaController_;
77 base::scoped_nsobject<InfoBarContainerController> infoBarContainerController_; 85 base::scoped_nsobject<InfoBarContainerController> infoBarContainerController_;
78 base::scoped_nsobject<DownloadShelfController> downloadShelfController_; 86 base::scoped_nsobject<DownloadShelfController> downloadShelfController_;
79 base::scoped_nsobject<BookmarkBarController> bookmarkBarController_; 87 base::scoped_nsobject<BookmarkBarController> bookmarkBarController_;
80 base::scoped_nsobject<DevToolsController> devToolsController_; 88 base::scoped_nsobject<DevToolsController> devToolsController_;
81 base::scoped_nsobject<OverlayableContentsController> 89 base::scoped_nsobject<OverlayableContentsController>
82 overlayableContentsController_; 90 overlayableContentsController_;
83 base::scoped_nsobject<PresentationModeController> presentationModeController_; 91 base::scoped_nsobject<PresentationModeController> presentationModeController_;
84 base::scoped_nsobject<FullscreenModeController> fullscreenModeController_;
85 base::scoped_nsobject<FullscreenExitBubbleController> 92 base::scoped_nsobject<FullscreenExitBubbleController>
86 fullscreenExitBubbleController_; 93 fullscreenExitBubbleController_;
87 94
88 // Strong. StatusBubble is a special case of a strong reference that 95 // Strong. StatusBubble is a special case of a strong reference that
89 // we don't wrap in a scoped_ptr because it is acting the same 96 // we don't wrap in a scoped_ptr because it is acting the same
90 // as an NSWindowController in that it wraps a window that must 97 // as an NSWindowController in that it wraps a window that must
91 // be shut down before our destructors are called. 98 // be shut down before our destructors are called.
92 StatusBubbleMac* statusBubble_; 99 StatusBubbleMac* statusBubble_;
93 100
94 BookmarkBubbleController* bookmarkBubbleController_; // Weak. 101 BookmarkBubbleController* bookmarkBubbleController_; // Weak.
(...skipping 30 matching lines...) Expand all
125 132
126 // The borderless window used in fullscreen mode when Cocoa's System 133 // The borderless window used in fullscreen mode when Cocoa's System
127 // Fullscreen API is not being used (or not available, before OS 10.7). 134 // Fullscreen API is not being used (or not available, before OS 10.7).
128 base::scoped_nsobject<NSWindow> fullscreenWindow_; 135 base::scoped_nsobject<NSWindow> fullscreenWindow_;
129 136
130 // The Cocoa implementation of the PermissionBubbleView. 137 // The Cocoa implementation of the PermissionBubbleView.
131 scoped_ptr<PermissionBubbleCocoa> permissionBubbleCocoa_; 138 scoped_ptr<PermissionBubbleCocoa> permissionBubbleCocoa_;
132 139
133 // True between |-windowWillEnterFullScreen:| and |-windowDidEnterFullScreen:| 140 // True between |-windowWillEnterFullScreen:| and |-windowDidEnterFullScreen:|
134 // to indicate that the window is in the process of transitioning into 141 // to indicate that the window is in the process of transitioning into
135 // fullscreen mode. 142 // AppKit fullscreen mode.
136 BOOL enteringFullscreen_; 143 BOOL enteringAppKitFullscreen_;
144
145 // True between |enterImmersiveFullscreen| and |-windowDidEnterFullScreen:|
146 // to indicate that the window is in the process of transitioning into
147 // AppKit fullscreen mode.
148 BOOL enteringImmersiveFullscreen_;
137 149
138 // True between |-setPresentationMode:url:bubbleType:| and 150 // True between |-setPresentationMode:url:bubbleType:| and
139 // |-windowDidEnterFullScreen:| to indicate that the window is in the process 151 // |-windowDidEnterFullScreen:| to indicate that the window is in the process
140 // of transitioning into fullscreen presentation mode. 152 // of transitioning into fullscreen presentation mode.
141 BOOL enteringPresentationMode_; 153 BOOL enteringPresentationMode_;
142 154
143 // The size of the original (non-fullscreen) window. This is saved just 155 // The size of the original (non-fullscreen) window. This is saved just
144 // before entering fullscreen mode and is only valid when |-isFullscreen| 156 // before entering fullscreen mode and is only valid when |-isFullscreen|
145 // returns YES. 157 // returns YES.
146 NSRect savedRegularWindowFrame_; 158 NSRect savedRegularWindowFrame_;
147 159
148 // The proportion of the floating bar which is shown (in presentation mode). 160 // The proportion of the floating bar which is shown (in presentation mode).
149 CGFloat floatingBarShownFraction_; 161 CGFloat floatingBarShownFraction_;
150 162
163 // Whether the omnibox is hidden in fullscreen.
164 fullscreen_mac::SlidingStyle fullscreenStyle_;
165
151 // Various UI elements/events may want to ensure that the floating bar is 166 // Various UI elements/events may want to ensure that the floating bar is
152 // visible (in presentation mode), e.g., because of where the mouse is or 167 // visible (in presentation mode), e.g., because of where the mouse is or
153 // where keyboard focus is. Whenever an object requires bar visibility, it has 168 // where keyboard focus is. Whenever an object requires bar visibility, it has
154 // itself added to |barVisibilityLocks_|. When it no longer requires bar 169 // itself added to |barVisibilityLocks_|. When it no longer requires bar
155 // visibility, it has itself removed. 170 // visibility, it has itself removed.
156 base::scoped_nsobject<NSMutableSet> barVisibilityLocks_; 171 base::scoped_nsobject<NSMutableSet> barVisibilityLocks_;
157 172
158 // Bar visibility locks and releases only result (when appropriate) in changes 173 // Bar visibility locks and releases only result (when appropriate) in changes
159 // in visible state when the following is |YES|. 174 // in visible state when the following is |YES|.
160 BOOL barVisibilityUpdatesEnabled_; 175 BOOL barVisibilityUpdatesEnabled_;
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 - (BOOL)supportsBookmarkBar; 409 - (BOOL)supportsBookmarkBar;
395 410
396 // Called to check if this controller's window is a tabbed window (e.g., not a 411 // Called to check if this controller's window is a tabbed window (e.g., not a
397 // pop-up window). Returns YES if it is, NO otherwise. 412 // pop-up window). Returns YES if it is, NO otherwise.
398 // Note: The |-has...| methods are usually preferred, so this method is largely 413 // Note: The |-has...| methods are usually preferred, so this method is largely
399 // deprecated. 414 // deprecated.
400 - (BOOL)isTabbedWindow; 415 - (BOOL)isTabbedWindow;
401 416
402 @end // @interface BrowserWindowController(WindowType) 417 @end // @interface BrowserWindowController(WindowType)
403 418
419 // Fullscreen terminology:
420 //
421 // ----------------------------------------------------------------------------
422 // There are 2 APIs that cause the window to get resized, and possibly move
423 // spaces.
424 //
425 // + AppKitFullscreen API: AppKit touts a feature known as "fullscreen". This
426 // involves moving the current window to a different space, and resizing the
427 // window to take up the entire size of the screen.
428 //
429 // + Immersive fullscreen: An alternative to AppKitFullscreen API. Uses on 10.6
430 // (before AppKitFullscreen API was available), and on certain HTML/Flash
431 // content. This is a method defined by Chrome.
432 //
433 // The Immersive fullscreen API can be called after the AppKitFullscreen API.
434 // Calling the AppKitFullscreen API while immersive fullscreen API has been
435 // invoked causes all fullscreen modes to exit.
436 //
437 // ----------------------------------------------------------------------------
438 // There are 3 "styles" of omnibox sliding.
439 // + OMNIBOX_TABS_PRESENT: Both the omnibox and the tabstrip are present.
440 // Moving the cursor to the top causes the menubar to appear, and everything
441 // else to slide down.
442 // + OMNIBOX_PRESENT: The tabstrip is hidden. Moving the cursor to the top
443 // shows the tabstrip and menubar, sliding everything else down.
444 // + OMNIBOX_TABS_HIDDEN: Both tabstrip and omnibox are hidden. Moving cursor
445 // to top shows tabstrip, omnibox, and menu bar.
446 //
447 // The omnibox sliding styles are used in conjunction with the fullscreen APIs.
448 // There is exactly 1 sliding style active at a time. The sliding is mangaged
449 // by the presentationModeController_. (poorly named).
450 //
451 // ----------------------------------------------------------------------------
452 // There are several "fullscreen modes" bantered around. Technically, any
453 // fullscreen API can be combined with any sliding style.
454 //
455 // + System fullscreen***deprecated***: This term is confusing. Don't use it.
456 // It either refers to the AppKitFullscreen API, or the behavior that users
457 // expect to see when they click the fullscreen button, or some Chrome specific
458 // implementation that uses the AppKitFullscreen API.
459 //
460 // + Canonical Fullscreen: When a user clicks on the fullscreen button, they
461 // expect a fullscreen behavior similar to other AppKit apps.
462 // - AppKitFullscreen API + OMNIBOX_TABS_PRESENT.
463 // - The button click directly invokes the AppKitFullscreen API. This class
464 // get a callback, and calls adjustUIForOmniboxFullscreen.
465 // - There is a menu item that is intended to invoke the same behavior. When
466 // the user clicks the menu item, or use its hotkey, this class invokes the
467 // AppKitFullscreen API.
468 //
469 // + Presentation Mode:
470 // - OMNIBOX_TABS_HIDDEN, typically with AppKitFullscreen API, but can
471 // also be with Immersive fullscreen API.
472 // - This class sets a flag, indicating that it wants Presentation Mode
473 // instead of Canonical Fullscreen. Then it invokes the AppKitFullscreen API.
474 //
475 // + HTML5 fullscreen. <-- Currently uses AppKitFullscreen API. This should
476 // eventually migrate to the Immersive Fullscreen API.
477 //
478 // + Simplified fullscreen. Hidden by default. Some users have manually
479 // enabled it.
480 // - OMNIBOX_PRESENT. Can be with either fullscreen API.
Robert Sesek 2014/08/29 20:22:42 TODO(erikchen): Remove this.
erikchen 2014/08/29 20:50:38 Done.
481 //
482 // + Flash fullscreen.
Robert Sesek 2014/08/29 20:22:42 Isn't this the same as HTML5?
erikchen 2014/08/29 20:50:38 Yeah, removed it.
404 483
405 // Methods having to do with fullscreen and presentation mode. 484 // Methods having to do with fullscreen and presentation mode.
406 @interface BrowserWindowController(Fullscreen) 485 @interface BrowserWindowController(Fullscreen)
407 486
408 // Toggles fullscreen mode. Meant to be called by Lion windows when they enter 487 // Toggles fullscreen mode. Meant to be called by Lion windows when they enter
409 // or exit Lion fullscreen mode. Must not be called on Snow Leopard or earlier. 488 // or exit Lion fullscreen mode. Must not be called on Snow Leopard or earlier.
410 - (void)handleLionToggleFullscreen; 489 - (void)handleLionToggleFullscreen;
411 490
412 // Enters (or exits) fullscreen mode. This method is safe to call on all OS 491 // Enters Canonical Fullscreen.
413 // versions. 492 - (void)enterFullscreenWithChrome;
414 - (void)enterFullscreen;
415 - (void)exitFullscreen;
416 493
417 // Updates the contents of the fullscreen exit bubble with |url| and 494 // Updates the contents of the fullscreen exit bubble with |url| and
418 // |bubbleType|. 495 // |bubbleType|.
419 - (void)updateFullscreenExitBubbleURL:(const GURL&)url 496 - (void)updateFullscreenExitBubbleURL:(const GURL&)url
420 bubbleType:(FullscreenExitBubbleType)bubbleType; 497 bubbleType:(FullscreenExitBubbleType)bubbleType;
421 498
422 // Returns fullscreen state: YES when the window is in fullscreen or is 499 // Returns YES if the code is in or entering any fullscreen mode.
Robert Sesek 2014/08/29 20:22:42 nit: Code doesn't enter. Window does.
erikchen 2014/08/29 20:50:38 Done.
423 // animating into fullscreen. 500 - (BOOL)isInAnyFullscreenMode;
424 - (BOOL)isFullscreen;
425 501
426 // Returns YES if the browser window is currently in fullscreen via the built-in 502 // Returns YES if the browser window is currently in or entering fullscreen via
427 // immersive mechanism. 503 // the built-in immersive mechanism.
428 - (BOOL)isInImmersiveFullscreen; 504 - (BOOL)isInImmersiveFullscreen;
429 505
430 // Returns YES if the browser window is currently in fullscreen via the Cocoa 506 // Returns YES if the browser window is currently in or entering fullscreen via
431 // System Fullscreen API. 507 // the AppKit Fullscreen API.
432 - (BOOL)isInSystemFullscreen; 508 - (BOOL)isInAppKitFullscreen;
433 509
434 // Enters (or exits) presentation mode. Also enters fullscreen mode if this 510 // Returns YES if the PresentationModeController exists and hence the omnibox
435 // window is not already fullscreen. This method is safe to call on all OS 511 // and other UI is expected to slide.
436 // versions. 512 - (BOOL)isInFullscreenWithOmniboxSliding;
513
514 // Enters (or exits) presentation mode.
437 - (void)enterPresentationModeForURL:(const GURL&)url 515 - (void)enterPresentationModeForURL:(const GURL&)url
438 bubbleType:(FullscreenExitBubbleType)bubbleType; 516 bubbleType:(FullscreenExitBubbleType)bubbleType;
439 - (void)exitPresentationMode;
440 517
441 // For simplified fullscreen: Enters fullscreen for a tab at a URL. The |url| 518 // Tries to enter presentation mode. Falls back to simplified fullscreen.
442 // is guaranteed to be non-empty; see -enterFullscreen for the user-initiated 519 - (void)enterHTML5FullscreenForURL:(const GURL&)url
443 // fullscreen mode. Called on Snow Leopard and Lion+. 520 bubbleType:(FullscreenExitBubbleType)bubbleType;
444 - (void)enterFullscreenForURL:(const GURL&)url
445 bubbleType:(FullscreenExitBubbleType)bubbleType;
446 521
447 // Returns presentation mode state. This method is safe to call on all OS 522 // Exits the current fullscreen mode.
448 // versions. 523 - (void)exitGenericFullscreen;
Robert Sesek 2014/08/29 20:22:42 -exitAnyFullscreen or -exitCurrentFullscreen ? Gen
erikchen 2014/08/29 20:50:38 Went with exitAnyFullscreen.
524
525 // Whether the system is in the very specific fullscreen mode: Presentation
526 // Mode.
449 - (BOOL)inPresentationMode; 527 - (BOOL)inPresentationMode;
450 528
451 // Resizes the fullscreen window to fit the screen it's currently on. Called by 529 // Resizes the fullscreen window to fit the screen it's currently on. Called by
452 // the PresentationModeController when there is a change in monitor placement or 530 // the PresentationModeController when there is a change in monitor placement or
453 // resolution. 531 // resolution.
454 - (void)resizeFullscreenWindow; 532 - (void)resizeFullscreenWindow;
455 533
456 // Gets or sets the fraction of the floating bar (presentation mode overlay) 534 // Gets or sets the fraction of the floating bar (presentation mode overlay)
457 // that is shown. 0 is completely hidden, 1 is fully shown. 535 // that is shown. 0 is completely hidden, 1 is fully shown.
458 - (CGFloat)floatingBarShownFraction; 536 - (CGFloat)floatingBarShownFraction;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 // positioned relative to. 600 // positioned relative to.
523 - (NSRect)omniboxPopupAnchorRect; 601 - (NSRect)omniboxPopupAnchorRect;
524 602
525 // Force a layout of info bars. 603 // Force a layout of info bars.
526 - (void)layoutInfoBars; 604 - (void)layoutInfoBars;
527 605
528 @end // @interface BrowserWindowController (TestingAPI) 606 @end // @interface BrowserWindowController (TestingAPI)
529 607
530 608
531 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ 609 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698