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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 class ExclusiveAccessController; | 42 class ExclusiveAccessController; |
43 class ExclusiveAccessContext; | 43 class ExclusiveAccessContext; |
44 @class FindBarCocoaController; | 44 @class FindBarCocoaController; |
45 @class FullscreenModeController; | 45 @class FullscreenModeController; |
46 @class FullscreenWindow; | 46 @class FullscreenWindow; |
47 class FullscreenLowPowerCoordinatorCocoa; | 47 class FullscreenLowPowerCoordinatorCocoa; |
48 @class InfoBarContainerController; | 48 @class InfoBarContainerController; |
49 class LocationBarViewMac; | 49 class LocationBarViewMac; |
50 @class OverlayableContentsController; | 50 @class OverlayableContentsController; |
51 class PermissionBubbleCocoa; | 51 class PermissionBubbleCocoa; |
52 @class PresentationModeController; | 52 @class FullscreenToolbarController; |
53 class StatusBubbleMac; | 53 class StatusBubbleMac; |
54 @class TabStripController; | 54 @class TabStripController; |
55 @class TabStripView; | 55 @class TabStripView; |
56 @class ToolbarController; | 56 @class ToolbarController; |
57 @class TranslateBubbleController; | 57 @class TranslateBubbleController; |
58 | 58 |
59 namespace content { | 59 namespace content { |
60 class WebContents; | 60 class WebContents; |
61 } | 61 } |
62 | 62 |
(...skipping 15 matching lines...) Expand all Loading... |
78 std::unique_ptr<BrowserWindowCocoa> windowShim_; | 78 std::unique_ptr<BrowserWindowCocoa> windowShim_; |
79 base::scoped_nsobject<ToolbarController> toolbarController_; | 79 base::scoped_nsobject<ToolbarController> toolbarController_; |
80 base::scoped_nsobject<TabStripController> tabStripController_; | 80 base::scoped_nsobject<TabStripController> tabStripController_; |
81 base::scoped_nsobject<FindBarCocoaController> findBarCocoaController_; | 81 base::scoped_nsobject<FindBarCocoaController> findBarCocoaController_; |
82 base::scoped_nsobject<InfoBarContainerController> infoBarContainerController_; | 82 base::scoped_nsobject<InfoBarContainerController> infoBarContainerController_; |
83 base::scoped_nsobject<DownloadShelfController> downloadShelfController_; | 83 base::scoped_nsobject<DownloadShelfController> downloadShelfController_; |
84 base::scoped_nsobject<BookmarkBarController> bookmarkBarController_; | 84 base::scoped_nsobject<BookmarkBarController> bookmarkBarController_; |
85 base::scoped_nsobject<DevToolsController> devToolsController_; | 85 base::scoped_nsobject<DevToolsController> devToolsController_; |
86 base::scoped_nsobject<OverlayableContentsController> | 86 base::scoped_nsobject<OverlayableContentsController> |
87 overlayableContentsController_; | 87 overlayableContentsController_; |
88 base::scoped_nsobject<PresentationModeController> presentationModeController_; | 88 base::scoped_nsobject<FullscreenToolbarController> |
| 89 fullscreenToolbarController_; |
89 std::unique_ptr<ExclusiveAccessController> exclusiveAccessController_; | 90 std::unique_ptr<ExclusiveAccessController> exclusiveAccessController_; |
90 base::scoped_nsobject<BrowserWindowFullscreenTransition> | 91 base::scoped_nsobject<BrowserWindowFullscreenTransition> |
91 fullscreenTransition_; | 92 fullscreenTransition_; |
92 std::unique_ptr<FullscreenLowPowerCoordinatorCocoa> | 93 std::unique_ptr<FullscreenLowPowerCoordinatorCocoa> |
93 fullscreenLowPowerCoordinator_; | 94 fullscreenLowPowerCoordinator_; |
94 | 95 |
95 // Strong. StatusBubble is a special case of a strong reference that | 96 // Strong. StatusBubble is a special case of a strong reference that |
96 // we don't wrap in a scoped_ptr because it is acting the same | 97 // we don't wrap in a scoped_ptr because it is acting the same |
97 // as an NSWindowController in that it wraps a window that must | 98 // as an NSWindowController in that it wraps a window that must |
98 // be shut down before our destructors are called. | 99 // be shut down before our destructors are called. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // True if AppKit has finished exiting fullscreen before the exit animation | 171 // True if AppKit has finished exiting fullscreen before the exit animation |
171 // is completed. This flag is used to ensure that |windowDidExitFullscreen| | 172 // is completed. This flag is used to ensure that |windowDidExitFullscreen| |
172 // is called after the exit fullscreen animation is complete. | 173 // is called after the exit fullscreen animation is complete. |
173 BOOL appKitDidExitFullscreen_; | 174 BOOL appKitDidExitFullscreen_; |
174 | 175 |
175 // The size of the original (non-fullscreen) window. This is saved just | 176 // The size of the original (non-fullscreen) window. This is saved just |
176 // before entering fullscreen mode and is only valid when |-isFullscreen| | 177 // before entering fullscreen mode and is only valid when |-isFullscreen| |
177 // returns YES. | 178 // returns YES. |
178 NSRect savedRegularWindowFrame_; | 179 NSRect savedRegularWindowFrame_; |
179 | 180 |
180 // The proportion of the floating bar which is shown (in presentation mode). | 181 // The proportion of the floating bar which is shown. |
181 CGFloat floatingBarShownFraction_; | 182 CGFloat floatingBarShownFraction_; |
182 | 183 |
183 // Various UI elements/events may want to ensure that the floating bar is | 184 // Various UI elements/events may want to ensure that the floating bar is |
184 // visible (in presentation mode), e.g., because of where the mouse is or | 185 // visible (in presentation mode), e.g., because of where the mouse is or |
185 // where keyboard focus is. Whenever an object requires bar visibility, it has | 186 // where keyboard focus is. Whenever an object requires bar visibility, it has |
186 // itself added to |barVisibilityLocks_|. When it no longer requires bar | 187 // itself added to |barVisibilityLocks_|. When it no longer requires bar |
187 // visibility, it has itself removed. | 188 // visibility, it has itself removed. |
188 base::scoped_nsobject<NSMutableSet> barVisibilityLocks_; | 189 base::scoped_nsobject<NSMutableSet> barVisibilityLocks_; |
189 | 190 |
190 // Bar visibility locks and releases only result (when appropriate) in changes | 191 // Bar visibility locks and releases only result (when appropriate) in changes |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 - (void)setAlertState:(TabAlertState)alertState; | 395 - (void)setAlertState:(TabAlertState)alertState; |
395 | 396 |
396 // Returns current alert state, determined by the alert state of tabs, set by | 397 // Returns current alert state, determined by the alert state of tabs, set by |
397 // UpdateAlertState. | 398 // UpdateAlertState. |
398 - (TabAlertState)alertState; | 399 - (TabAlertState)alertState; |
399 | 400 |
400 @end // @interface BrowserWindowController | 401 @end // @interface BrowserWindowController |
401 | 402 |
402 | 403 |
403 // Methods having to do with the window type (normal/popup/app, and whether the | 404 // Methods having to do with the window type (normal/popup/app, and whether the |
404 // window has various features; fullscreen and presentation mode methods are | 405 // window has various features. |
405 // separate). | |
406 @interface BrowserWindowController(WindowType) | 406 @interface BrowserWindowController(WindowType) |
407 | 407 |
408 // Determines whether this controller's window supports a given feature (i.e., | 408 // Determines whether this controller's window supports a given feature (i.e., |
409 // whether a given feature is or can be shown in the window). | 409 // whether a given feature is or can be shown in the window). |
410 // TODO(viettrungluu): |feature| is really should be |Browser::Feature|, but I | 410 // TODO(viettrungluu): |feature| is really should be |Browser::Feature|, but I |
411 // don't want to include browser.h (and you can't forward declare enums). | 411 // don't want to include browser.h (and you can't forward declare enums). |
412 - (BOOL)supportsWindowFeature:(int)feature; | 412 - (BOOL)supportsWindowFeature:(int)feature; |
413 | 413 |
414 // Called to check whether or not this window has a normal title bar (YES if it | 414 // Called to check whether or not this window has a normal title bar (YES if it |
415 // does, NO otherwise). (E.g., normal browser windows do not, pop-ups do.) | 415 // does, NO otherwise). (E.g., normal browser windows do not, pop-ups do.) |
(...skipping 30 matching lines...) Expand all Loading... |
446 // Fullscreen terminology: | 446 // Fullscreen terminology: |
447 // | 447 // |
448 // ---------------------------------------------------------------------------- | 448 // ---------------------------------------------------------------------------- |
449 // There are 2 APIs that cause the window to get resized, and possibly move | 449 // There are 2 APIs that cause the window to get resized, and possibly move |
450 // spaces. | 450 // spaces. |
451 // | 451 // |
452 // + AppKitFullscreen API: AppKit touts a feature known as "fullscreen". This | 452 // + AppKitFullscreen API: AppKit touts a feature known as "fullscreen". This |
453 // involves moving the current window to a different space, and resizing the | 453 // involves moving the current window to a different space, and resizing the |
454 // window to take up the entire size of the screen. | 454 // window to take up the entire size of the screen. |
455 // | 455 // |
456 // + Immersive fullscreen: An alternative to AppKitFullscreen API. Uses on 10.6 | 456 // + Immersive fullscreen: An alternative to AppKitFullscreen API. Uses on 10.9 |
457 // (before AppKitFullscreen API was available), and on certain HTML/Flash | 457 // on certain HTML/Flash content. This is a method defined by Chrome. |
458 // content. This is a method defined by Chrome. | |
459 // | 458 // |
460 // The Immersive fullscreen API can be called after the AppKitFullscreen API. | 459 // The Immersive fullscreen API can be called after the AppKitFullscreen API. |
461 // Calling the AppKitFullscreen API while immersive fullscreen API has been | 460 // Calling the AppKitFullscreen API while immersive fullscreen API has been |
462 // invoked causes all fullscreen modes to exit. | 461 // invoked causes all fullscreen modes to exit. |
463 // | 462 // |
464 // ---------------------------------------------------------------------------- | 463 // ---------------------------------------------------------------------------- |
465 // There are 3 "styles" of omnibox sliding. | 464 // There are 3 "styles" of omnibox sliding. |
466 // + OMNIBOX_TABS_PRESENT: Both the omnibox and the tabstrip are present. | 465 // + OMNIBOX_TABS_PRESENT: Both the omnibox and the tabstrip are present. |
467 // Moving the cursor to the top causes the menubar to appear, and everything | 466 // Moving the cursor to the top causes the menubar to appear, and everything |
468 // else to slide down. | 467 // else to slide down. |
469 // + OMNIBOX_TABS_HIDDEN: Both tabstrip and omnibox are hidden. Moving cursor | 468 // + OMNIBOX_TABS_HIDDEN: Both tabstrip and omnibox are hidden. Moving cursor |
470 // to top shows tabstrip, omnibox, and menu bar. | 469 // to top shows tabstrip, omnibox, and menu bar. |
471 // + OMNIBOX_TABS_NONE: Both tabstrip and omnibox are hidden. Moving cursor | 470 // + OMNIBOX_TABS_NONE: Both tabstrip and omnibox are hidden. Moving cursor |
472 // to top causes the menubar to appear, but not the tabstrip and omnibox. | 471 // to top causes the menubar to appear, but not the tabstrip and omnibox. |
473 // | 472 // |
474 // The omnibox sliding styles are used in conjunction with the fullscreen APIs. | 473 // The omnibox sliding styles are used in conjunction with the fullscreen APIs. |
475 // There is exactly 1 sliding style active at a time. The sliding is mangaged | 474 // There is exactly 1 sliding style active at a time. The sliding is mangaged |
476 // by the presentationModeController_. (poorly named). | 475 // by the fullscreenToolbarController_. |
477 // | 476 // |
478 // ---------------------------------------------------------------------------- | 477 // ---------------------------------------------------------------------------- |
479 // There are several "fullscreen modes" bantered around. Technically, any | 478 // There are several "fullscreen modes" bantered around. Technically, any |
480 // fullscreen API can be combined with any sliding style. | 479 // fullscreen API can be combined with any sliding style. |
481 // | 480 // |
482 // + System fullscreen***deprecated***: This term is confusing. Don't use it. | 481 // + System fullscreen***deprecated***: This term is confusing. Don't use it. |
483 // It either refers to the AppKitFullscreen API, or the behavior that users | 482 // It either refers to the AppKitFullscreen API, or the behavior that users |
484 // expect to see when they click the fullscreen button, or some Chrome specific | 483 // expect to see when they click the fullscreen button, or some Chrome specific |
485 // implementation that uses the AppKitFullscreen API. | 484 // implementation that uses the AppKitFullscreen API. |
486 // | 485 // |
487 // + Canonical Fullscreen: When a user clicks on the fullscreen button, they | 486 // + Canonical Fullscreen: When a user clicks on the fullscreen button, they |
488 // expect a fullscreen behavior similar to other AppKit apps. | 487 // expect a fullscreen behavior similar to other AppKit apps. |
489 // - AppKitFullscreen API + OMNIBOX_TABS_PRESENT. | 488 // - AppKitFullscreen API + OMNIBOX_TABS_PRESENT/OMNIBOX_TABS_HIDDEN. |
490 // - The button click directly invokes the AppKitFullscreen API. This class | 489 // - The button click directly invokes the AppKitFullscreen API. This class |
491 // get a callback, and calls adjustUIForOmniboxFullscreen. | 490 // get a callback, and calls adjustUIForOmniboxFullscreen. |
492 // - There is a menu item that is intended to invoke the same behavior. When | 491 // - There is a menu item that is intended to invoke the same behavior. When |
493 // the user clicks the menu item, or use its hotkey, this class invokes the | 492 // the user clicks the menu item, or use its hotkey, this class invokes the |
494 // AppKitFullscreen API. | 493 // AppKitFullscreen API. |
495 // | 494 // |
496 // + Presentation Mode: | 495 // + HTML5 fullscreen. Uses AppKitFullscreen in 10.10+, otherwise Immersive. |
497 // - OMNIBOX_TABS_HIDDEN, typically with AppKitFullscreen API, but can | |
498 // also be with Immersive fullscreen API. | |
499 // - This class sets a flag, indicating that it wants Presentation Mode | |
500 // instead of Canonical Fullscreen. Then it invokes the AppKitFullscreen API. | |
501 // | |
502 // + HTML5 fullscreen. <-- Currently uses AppKitFullscreen API. This should | |
503 // eventually migrate to the Immersive Fullscreen API. | |
504 // | 496 // |
505 // There are more fullscreen styles on OSX than other OSes. However, all OSes | 497 // There are more fullscreen styles on OSX than other OSes. However, all OSes |
506 // share the same cross-platform code for entering fullscreen | 498 // share the same cross-platform code for entering fullscreen |
507 // (FullscreenController). It is important for OSX fullscreen logic to track | 499 // (FullscreenController). It is important for OSX fullscreen logic to track |
508 // how the user triggered fullscreen mode. | 500 // how the user triggered fullscreen mode. |
509 // There are currently 5 possible mechanisms: | 501 // There are currently 5 possible mechanisms: |
510 // - User clicks the AppKit Fullscreen button. | 502 // - User clicks the AppKit Fullscreen button. |
511 // -- This invokes -[BrowserWindowController windowWillEnterFullscreen:] | 503 // -- This invokes -[BrowserWindowController windowWillEnterFullscreen:] |
512 // - User selects the menu item "Enter Full Screen". | 504 // - User selects the menu item "Enter Full Screen". |
513 // -- This invokes FullscreenController::ToggleFullscreenModeInternal( | 505 // -- This invokes FullscreenController::ToggleFullscreenModeInternal( |
514 // BROWSER_WITH_CHROME) | |
515 // - User selects the menu item "Enter Presentation Mode". | |
516 // -- This invokes FullscreenController::ToggleFullscreenModeInternal( | |
517 // BROWSER) | 506 // BROWSER) |
518 // -- The corresponding URL will be empty. | |
519 // - User requests fullscreen via an extension. | 507 // - User requests fullscreen via an extension. |
520 // -- This invokes FullscreenController::ToggleFullscreenModeInternal( | 508 // -- This invokes FullscreenController::ToggleFullscreenModeInternal( |
521 // BROWSER) | 509 // BROWSER) |
522 // -- The corresponding URL will be the url of the extension. | 510 // -- The corresponding URL will be the url of the extension. |
523 // - User requests fullscreen via Flash or JavaScript apis. | 511 // - User requests fullscreen via Flash or JavaScript apis. |
524 // -- This invokes FullscreenController::ToggleFullscreenModeInternal( | 512 // -- This invokes FullscreenController::ToggleFullscreenModeInternal( |
525 // BROWSER) | 513 // BROWSER) |
526 // -- browser_->fullscreen_controller()-> | 514 // -- browser_->fullscreen_controller()-> |
527 // IsWindowFullscreenForTabOrPending() returns true. | 515 // IsWindowFullscreenForTabOrPending() returns true. |
528 // -- The corresponding URL will be the url of the web page. | 516 // -- The corresponding URL will be the url of the web page. |
529 | 517 |
530 // Methods having to do with fullscreen and presentation mode. | 518 // Methods having to do with fullscreen mode. |
531 @interface BrowserWindowController(Fullscreen) | 519 @interface BrowserWindowController(Fullscreen) |
532 | 520 |
533 // Toggles fullscreen mode. Meant to be called by Lion windows when they enter | |
534 // or exit Lion fullscreen mode. Must not be called on Snow Leopard or earlier. | |
535 - (void)handleLionToggleFullscreen; | |
536 | |
537 // Enters Browser AppKit Fullscreen. | 521 // Enters Browser AppKit Fullscreen. |
538 - (void)enterBrowserFullscreen; | 522 - (void)enterBrowserFullscreen; |
539 | 523 |
540 // Updates the UI for tab fullscreen by adding or removing the tab strip and | 524 // Updates the UI for tab fullscreen by adding or removing the tab strip and |
541 // toolbar from the current window. The window must already be in fullscreen. | 525 // toolbar from the current window. The window must already be in fullscreen. |
542 - (void)updateUIForTabFullscreen: | 526 - (void)updateUIForTabFullscreen: |
543 (ExclusiveAccessContext::TabFullscreenState)state; | 527 (ExclusiveAccessContext::TabFullscreenState)state; |
544 | 528 |
545 // Exits extension fullscreen if we're currently in the mode. Returns YES | 529 // Exits extension fullscreen if we're currently in the mode. Returns YES |
546 // if we exited fullscreen. | 530 // if we exited fullscreen. |
(...skipping 21 matching lines...) Expand all Loading... |
568 - (void)enterWebContentFullscreen; | 552 - (void)enterWebContentFullscreen; |
569 | 553 |
570 // Exits the current fullscreen mode. | 554 // Exits the current fullscreen mode. |
571 - (void)exitAnyFullscreen; | 555 - (void)exitAnyFullscreen; |
572 | 556 |
573 // Called by BrowserWindowFullscreenTransition when the exit animation is | 557 // Called by BrowserWindowFullscreenTransition when the exit animation is |
574 // finished. | 558 // finished. |
575 - (void)exitFullscreenAnimationFinished; | 559 - (void)exitFullscreenAnimationFinished; |
576 | 560 |
577 // Resizes the fullscreen window to fit the screen it's currently on. Called by | 561 // Resizes the fullscreen window to fit the screen it's currently on. Called by |
578 // the PresentationModeController when there is a change in monitor placement or | 562 // the FullscreenToolbarController when there is a change in monitor placement |
579 // resolution. | 563 // or resolution. |
580 - (void)resizeFullscreenWindow; | 564 - (void)resizeFullscreenWindow; |
581 | 565 |
582 // Query/lock/release the requirement that the tab strip/toolbar/attached | 566 // Query/lock/release the requirement that the tab strip/toolbar/attached |
583 // bookmark bar bar cluster is visible (e.g., when one of its elements has | 567 // bookmark bar bar cluster is visible (e.g., when one of its elements has |
584 // focus). This is required for the floating bar in presentation mode, but | 568 // focus). This is required for the floating bar in presentation mode, but |
585 // should also be called when not in presentation mode; see the comments for | 569 // should also be called when not in presentation mode; see the comments for |
586 // |barVisibilityLocks_| for more details. Double locks/releases by the same | 570 // |barVisibilityLocks_| for more details. Double locks/releases by the same |
587 // owner are ignored. If |animate:| is YES, then an animation may be performed, | 571 // owner are ignored. If |animate:| is YES, then an animation may be performed, |
588 // possibly after a small delay if |delay:| is YES. If |animate:| is NO, | 572 // possibly after a small delay if |delay:| is YES. If |animate:| is NO, |
589 // |delay:| will be ignored. In the case of multiple calls, later calls have | 573 // |delay:| will be ignored. In the case of multiple calls, later calls have |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 // Gets the rect, in window base coordinates, that the omnibox popup should be | 626 // Gets the rect, in window base coordinates, that the omnibox popup should be |
643 // positioned relative to. | 627 // positioned relative to. |
644 - (NSRect)omniboxPopupAnchorRect; | 628 - (NSRect)omniboxPopupAnchorRect; |
645 | 629 |
646 // Returns the flag |blockLayoutSubviews_|. | 630 // Returns the flag |blockLayoutSubviews_|. |
647 - (BOOL)isLayoutSubviewsBlocked; | 631 - (BOOL)isLayoutSubviewsBlocked; |
648 | 632 |
649 // Returns the active tab contents controller's |blockFullscreenResize_| flag. | 633 // Returns the active tab contents controller's |blockFullscreenResize_| flag. |
650 - (BOOL)isActiveTabContentsControllerResizeBlocked; | 634 - (BOOL)isActiveTabContentsControllerResizeBlocked; |
651 | 635 |
652 // Returns the presentation mode controller. | 636 // Returns the fullscreen toolbar controller. |
653 - (PresentationModeController*)presentationModeController; | 637 - (FullscreenToolbarController*)fullscreenToolbarController; |
654 | 638 |
655 // Sets the presentation mode controller. | 639 // Sets the fullscreen toolbar controller. |
656 - (void)setPresentationModeController:(PresentationModeController*)controller; | 640 - (void)setFullscreenToolbarController:(FullscreenToolbarController*)controller; |
657 | 641 |
658 @end // @interface BrowserWindowController (TestingAPI) | 642 @end // @interface BrowserWindowController (TestingAPI) |
659 | 643 |
660 | 644 |
661 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ | 645 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ |
OLD | NEW |