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_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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 base::scoped_nsobject<ToolbarController> toolbarController_; | 74 base::scoped_nsobject<ToolbarController> toolbarController_; |
75 base::scoped_nsobject<TabStripController> tabStripController_; | 75 base::scoped_nsobject<TabStripController> tabStripController_; |
76 base::scoped_nsobject<FindBarCocoaController> findBarCocoaController_; | 76 base::scoped_nsobject<FindBarCocoaController> findBarCocoaController_; |
77 base::scoped_nsobject<InfoBarContainerController> infoBarContainerController_; | 77 base::scoped_nsobject<InfoBarContainerController> infoBarContainerController_; |
78 base::scoped_nsobject<DownloadShelfController> downloadShelfController_; | 78 base::scoped_nsobject<DownloadShelfController> downloadShelfController_; |
79 base::scoped_nsobject<BookmarkBarController> bookmarkBarController_; | 79 base::scoped_nsobject<BookmarkBarController> bookmarkBarController_; |
80 base::scoped_nsobject<DevToolsController> devToolsController_; | 80 base::scoped_nsobject<DevToolsController> devToolsController_; |
81 base::scoped_nsobject<OverlayableContentsController> | 81 base::scoped_nsobject<OverlayableContentsController> |
82 overlayableContentsController_; | 82 overlayableContentsController_; |
83 base::scoped_nsobject<PresentationModeController> presentationModeController_; | 83 base::scoped_nsobject<PresentationModeController> presentationModeController_; |
84 base::scoped_nsobject<FullscreenModeController> fullscreenModeController_; | |
85 base::scoped_nsobject<FullscreenExitBubbleController> | 84 base::scoped_nsobject<FullscreenExitBubbleController> |
86 fullscreenExitBubbleController_; | 85 fullscreenExitBubbleController_; |
87 | 86 |
88 // Strong. StatusBubble is a special case of a strong reference that | 87 // 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 | 88 // 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 | 89 // as an NSWindowController in that it wraps a window that must |
91 // be shut down before our destructors are called. | 90 // be shut down before our destructors are called. |
92 StatusBubbleMac* statusBubble_; | 91 StatusBubbleMac* statusBubble_; |
93 | 92 |
94 BookmarkBubbleController* bookmarkBubbleController_; // Weak. | 93 BookmarkBubbleController* bookmarkBubbleController_; // Weak. |
(...skipping 30 matching lines...) Expand all Loading... |
125 | 124 |
126 // The borderless window used in fullscreen mode when Cocoa's System | 125 // 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). | 126 // Fullscreen API is not being used (or not available, before OS 10.7). |
128 base::scoped_nsobject<NSWindow> fullscreenWindow_; | 127 base::scoped_nsobject<NSWindow> fullscreenWindow_; |
129 | 128 |
130 // The Cocoa implementation of the PermissionBubbleView. | 129 // The Cocoa implementation of the PermissionBubbleView. |
131 scoped_ptr<PermissionBubbleCocoa> permissionBubbleCocoa_; | 130 scoped_ptr<PermissionBubbleCocoa> permissionBubbleCocoa_; |
132 | 131 |
133 // True between |-windowWillEnterFullScreen:| and |-windowDidEnterFullScreen:| | 132 // True between |-windowWillEnterFullScreen:| and |-windowDidEnterFullScreen:| |
134 // to indicate that the window is in the process of transitioning into | 133 // to indicate that the window is in the process of transitioning into |
135 // fullscreen mode. | 134 // AppKit fullscreen mode. |
136 BOOL enteringFullscreen_; | 135 BOOL enteringAppKitFullscreen_; |
| 136 |
| 137 // Only adjust the tab strip once while entering fullscreen. See the |
| 138 // implementation of -[BrowserWindowController updateSubviewZOrder:] for more |
| 139 // details. |
| 140 BOOL hasAdjustedTabStripWhileEnteringAppKitFullscreen_; |
| 141 |
| 142 // True between |enterImmersiveFullscreen| and |-windowDidEnterFullScreen:| |
| 143 // to indicate that the window is in the process of transitioning into |
| 144 // AppKit fullscreen mode. |
| 145 BOOL enteringImmersiveFullscreen_; |
137 | 146 |
138 // True between |-setPresentationMode:url:bubbleType:| and | 147 // True between |-setPresentationMode:url:bubbleType:| and |
139 // |-windowDidEnterFullScreen:| to indicate that the window is in the process | 148 // |-windowDidEnterFullScreen:| to indicate that the window is in the process |
140 // of transitioning into fullscreen presentation mode. | 149 // of transitioning into fullscreen presentation mode. |
141 BOOL enteringPresentationMode_; | 150 BOOL enteringPresentationMode_; |
142 | 151 |
143 // The size of the original (non-fullscreen) window. This is saved just | 152 // The size of the original (non-fullscreen) window. This is saved just |
144 // before entering fullscreen mode and is only valid when |-isFullscreen| | 153 // before entering fullscreen mode and is only valid when |-isFullscreen| |
145 // returns YES. | 154 // returns YES. |
146 NSRect savedRegularWindowFrame_; | 155 NSRect savedRegularWindowFrame_; |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 - (BOOL)supportsBookmarkBar; | 397 - (BOOL)supportsBookmarkBar; |
389 | 398 |
390 // Called to check if this controller's window is a tabbed window (e.g., not a | 399 // Called to check if this controller's window is a tabbed window (e.g., not a |
391 // pop-up window). Returns YES if it is, NO otherwise. | 400 // pop-up window). Returns YES if it is, NO otherwise. |
392 // Note: The |-has...| methods are usually preferred, so this method is largely | 401 // Note: The |-has...| methods are usually preferred, so this method is largely |
393 // deprecated. | 402 // deprecated. |
394 - (BOOL)isTabbedWindow; | 403 - (BOOL)isTabbedWindow; |
395 | 404 |
396 @end // @interface BrowserWindowController(WindowType) | 405 @end // @interface BrowserWindowController(WindowType) |
397 | 406 |
| 407 // Fullscreen terminology: |
| 408 // |
| 409 // ---------------------------------------------------------------------------- |
| 410 // There are 2 APIs that cause the window to get resized, and possibly move |
| 411 // spaces. |
| 412 // |
| 413 // + AppKitFullscreen API: AppKit touts a feature known as "fullscreen". This |
| 414 // involves moving the current window to a different space, and resizing the |
| 415 // window to take up the entire size of the screen. |
| 416 // |
| 417 // + Immersive fullscreen: An alternative to AppKitFullscreen API. Uses on 10.6 |
| 418 // (before AppKitFullscreen API was available), and on certain HTML/Flash |
| 419 // content. This is a method defined by Chrome. |
| 420 // |
| 421 // The Immersive fullscreen API can be called after the AppKitFullscreen API. |
| 422 // Calling the AppKitFullscreen API while immersive fullscreen API has been |
| 423 // invoked causes all fullscreen modes to exit. |
| 424 // |
| 425 // ---------------------------------------------------------------------------- |
| 426 // There are 3 "styles" of omnibox sliding. |
| 427 // + OMNIBOX_TABS_PRESENT: Both the omnibox and the tabstrip are present. |
| 428 // Moving the cursor to the top causes the menubar to appear, and everything |
| 429 // else to slide down. |
| 430 // + OMNIBOX_PRESENT: The tabstrip is hidden. Moving the cursor to the top |
| 431 // shows the tabstrip and menubar, sliding everything else down. |
| 432 // + OMNIBOX_TABS_HIDDEN: Both tabstrip and omnibox are hidden. Moving cursor |
| 433 // to top shows tabstrip, omnibox, and menu bar. |
| 434 // |
| 435 // The omnibox sliding styles are used in conjunction with the fullscreen APIs. |
| 436 // There is exactly 1 sliding style active at a time. The sliding is mangaged |
| 437 // by the presentationModeController_. (poorly named). |
| 438 // |
| 439 // ---------------------------------------------------------------------------- |
| 440 // There are several "fullscreen modes" bantered around. Technically, any |
| 441 // fullscreen API can be combined with any sliding style. |
| 442 // |
| 443 // + System fullscreen***deprecated***: This term is confusing. Don't use it. |
| 444 // It either refers to the AppKitFullscreen API, or the behavior that users |
| 445 // expect to see when they click the fullscreen button, or some Chrome specific |
| 446 // implementation that uses the AppKitFullscreen API. |
| 447 // |
| 448 // + Canonical Fullscreen: When a user clicks on the fullscreen button, they |
| 449 // expect a fullscreen behavior similar to other AppKit apps. |
| 450 // - AppKitFullscreen API + OMNIBOX_TABS_PRESENT. |
| 451 // - The button click directly invokes the AppKitFullscreen API. This class |
| 452 // get a callback, and calls adjustUIForOmniboxFullscreen. |
| 453 // - There is a menu item that is intended to invoke the same behavior. When |
| 454 // the user clicks the menu item, or use its hotkey, this class invokes the |
| 455 // AppKitFullscreen API. |
| 456 // |
| 457 // + Presentation Mode: |
| 458 // - OMNIBOX_TABS_HIDDEN, typically with AppKitFullscreen API, but can |
| 459 // also be with Immersive fullscreen API. |
| 460 // - This class sets a flag, indicating that it wants Presentation Mode |
| 461 // instead of Canonical Fullscreen. Then it invokes the AppKitFullscreen API. |
| 462 // |
| 463 // + HTML5 fullscreen. <-- Currently uses AppKitFullscreen API. This should |
| 464 // eventually migrate to the Immersive Fullscreen API. |
| 465 // |
| 466 // TODO(erikchen): Remove this. |
| 467 // + Simplified fullscreen. Hidden by default. Some users have manually |
| 468 // enabled it. |
| 469 // - OMNIBOX_PRESENT. Can be with either fullscreen API. |
398 | 470 |
399 // Methods having to do with fullscreen and presentation mode. | 471 // Methods having to do with fullscreen and presentation mode. |
400 @interface BrowserWindowController(Fullscreen) | 472 @interface BrowserWindowController(Fullscreen) |
401 | 473 |
402 // Toggles fullscreen mode. Meant to be called by Lion windows when they enter | 474 // Toggles fullscreen mode. Meant to be called by Lion windows when they enter |
403 // or exit Lion fullscreen mode. Must not be called on Snow Leopard or earlier. | 475 // or exit Lion fullscreen mode. Must not be called on Snow Leopard or earlier. |
404 - (void)handleLionToggleFullscreen; | 476 - (void)handleLionToggleFullscreen; |
405 | 477 |
406 // Enters (or exits) fullscreen mode. This method is safe to call on all OS | 478 // Enters Canonical Fullscreen. |
407 // versions. | 479 - (void)enterFullscreenWithChrome; |
408 - (void)enterFullscreen; | |
409 - (void)exitFullscreen; | |
410 | 480 |
411 // Updates the contents of the fullscreen exit bubble with |url| and | 481 // Updates the contents of the fullscreen exit bubble with |url| and |
412 // |bubbleType|. | 482 // |bubbleType|. |
413 - (void)updateFullscreenExitBubbleURL:(const GURL&)url | 483 - (void)updateFullscreenExitBubbleURL:(const GURL&)url |
414 bubbleType:(FullscreenExitBubbleType)bubbleType; | 484 bubbleType:(FullscreenExitBubbleType)bubbleType; |
415 | 485 |
416 // Returns fullscreen state: YES when the window is in fullscreen or is | 486 // Returns YES if the browser window is in or entering any fullscreen mode. |
417 // animating into fullscreen. | 487 - (BOOL)isInAnyFullscreenMode; |
418 - (BOOL)isFullscreen; | |
419 | 488 |
420 // Returns YES if the browser window is currently in fullscreen via the built-in | 489 // Returns YES if the browser window is currently in or entering fullscreen via |
421 // immersive mechanism. | 490 // the built-in immersive mechanism. |
422 - (BOOL)isInImmersiveFullscreen; | 491 - (BOOL)isInImmersiveFullscreen; |
423 | 492 |
424 // Returns YES if the browser window is currently in fullscreen via the Cocoa | 493 // Returns YES if the browser window is currently in or entering fullscreen via |
425 // System Fullscreen API. | 494 // the AppKit Fullscreen API. |
426 - (BOOL)isInSystemFullscreen; | 495 - (BOOL)isInAppKitFullscreen; |
427 | 496 |
428 // Enters (or exits) presentation mode. Also enters fullscreen mode if this | 497 // Returns YES if the PresentationModeController exists and hence the omnibox |
429 // window is not already fullscreen. This method is safe to call on all OS | 498 // and other UI is expected to slide. |
430 // versions. | 499 - (BOOL)isInFullscreenWithOmniboxSliding; |
| 500 |
| 501 // Enters (or exits) presentation mode. |
431 - (void)enterPresentationModeForURL:(const GURL&)url | 502 - (void)enterPresentationModeForURL:(const GURL&)url |
432 bubbleType:(FullscreenExitBubbleType)bubbleType; | 503 bubbleType:(FullscreenExitBubbleType)bubbleType; |
433 - (void)exitPresentationMode; | |
434 | 504 |
435 // For simplified fullscreen: Enters fullscreen for a tab at a URL. The |url| | 505 // Tries to enter presentation mode. Falls back to simplified fullscreen. |
436 // is guaranteed to be non-empty; see -enterFullscreen for the user-initiated | 506 - (void)enterHTML5FullscreenForURL:(const GURL&)url |
437 // fullscreen mode. Called on Snow Leopard and Lion+. | 507 bubbleType:(FullscreenExitBubbleType)bubbleType; |
438 - (void)enterFullscreenForURL:(const GURL&)url | |
439 bubbleType:(FullscreenExitBubbleType)bubbleType; | |
440 | 508 |
441 // Returns presentation mode state. This method is safe to call on all OS | 509 // Exits the current fullscreen mode. |
442 // versions. | 510 - (void)exitAnyFullscreen; |
| 511 |
| 512 // Whether the system is in the very specific fullscreen mode: Presentation |
| 513 // Mode. |
443 - (BOOL)inPresentationMode; | 514 - (BOOL)inPresentationMode; |
444 | 515 |
445 // Resizes the fullscreen window to fit the screen it's currently on. Called by | 516 // Resizes the fullscreen window to fit the screen it's currently on. Called by |
446 // the PresentationModeController when there is a change in monitor placement or | 517 // the PresentationModeController when there is a change in monitor placement or |
447 // resolution. | 518 // resolution. |
448 - (void)resizeFullscreenWindow; | 519 - (void)resizeFullscreenWindow; |
449 | 520 |
450 // Gets or sets the fraction of the floating bar (presentation mode overlay) | |
451 // that is shown. 0 is completely hidden, 1 is fully shown. | |
452 - (CGFloat)floatingBarShownFraction; | |
453 - (void)setFloatingBarShownFraction:(CGFloat)fraction; | |
454 | |
455 // Query/lock/release the requirement that the tab strip/toolbar/attached | 521 // Query/lock/release the requirement that the tab strip/toolbar/attached |
456 // bookmark bar bar cluster is visible (e.g., when one of its elements has | 522 // bookmark bar bar cluster is visible (e.g., when one of its elements has |
457 // focus). This is required for the floating bar in presentation mode, but | 523 // focus). This is required for the floating bar in presentation mode, but |
458 // should also be called when not in presentation mode; see the comments for | 524 // should also be called when not in presentation mode; see the comments for |
459 // |barVisibilityLocks_| for more details. Double locks/releases by the same | 525 // |barVisibilityLocks_| for more details. Double locks/releases by the same |
460 // owner are ignored. If |animate:| is YES, then an animation may be performed, | 526 // owner are ignored. If |animate:| is YES, then an animation may be performed, |
461 // possibly after a small delay if |delay:| is YES. If |animate:| is NO, | 527 // possibly after a small delay if |delay:| is YES. If |animate:| is NO, |
462 // |delay:| will be ignored. In the case of multiple calls, later calls have | 528 // |delay:| will be ignored. In the case of multiple calls, later calls have |
463 // precedence with the rule that |animate:NO| has precedence over |animate:YES|, | 529 // precedence with the rule that |animate:NO| has precedence over |animate:YES|, |
464 // and |delay:NO| has precedence over |delay:YES|. | 530 // and |delay:NO| has precedence over |delay:YES|. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 // positioned relative to. | 582 // positioned relative to. |
517 - (NSRect)omniboxPopupAnchorRect; | 583 - (NSRect)omniboxPopupAnchorRect; |
518 | 584 |
519 // Force a layout of info bars. | 585 // Force a layout of info bars. |
520 - (void)layoutInfoBars; | 586 - (void)layoutInfoBars; |
521 | 587 |
522 @end // @interface BrowserWindowController (TestingAPI) | 588 @end // @interface BrowserWindowController (TestingAPI) |
523 | 589 |
524 | 590 |
525 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ | 591 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ |
OLD | NEW |