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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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. | |
Robert Sesek
2014/08/27 22:04:30
When is this mode used?
erikchen
2014/08/28 00:50:28
Only for simplified fullscreen.
| |
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 // fullscreen mode. |
143 // | |
144 // TODO(erikchen): This flag is used when entering AppKit Fullscreen and | |
145 // immersive fullscreen. This is confusing. | |
136 BOOL enteringFullscreen_; | 146 BOOL enteringFullscreen_; |
137 | 147 |
138 // True between |-setPresentationMode:url:bubbleType:| and | 148 // True between |-setPresentationMode:url:bubbleType:| and |
139 // |-windowDidEnterFullScreen:| to indicate that the window is in the process | 149 // |-windowDidEnterFullScreen:| to indicate that the window is in the process |
140 // of transitioning into fullscreen presentation mode. | 150 // of transitioning into fullscreen presentation mode. |
141 BOOL enteringPresentationMode_; | 151 BOOL enteringPresentationMode_; |
142 | 152 |
143 // The size of the original (non-fullscreen) window. This is saved just | 153 // The size of the original (non-fullscreen) window. This is saved just |
144 // before entering fullscreen mode and is only valid when |-isFullscreen| | 154 // before entering fullscreen mode and is only valid when |-isFullscreen| |
145 // returns YES. | 155 // returns YES. |
146 NSRect savedRegularWindowFrame_; | 156 NSRect savedRegularWindowFrame_; |
147 | 157 |
148 // The proportion of the floating bar which is shown (in presentation mode). | 158 // The proportion of the floating bar which is shown (in presentation mode). |
149 CGFloat floatingBarShownFraction_; | 159 CGFloat floatingBarShownFraction_; |
150 | 160 |
161 // Whether the omnibox is hidden in fullscreen. | |
162 fullscreen_mac::SlidingStyle fullscreenStyle_; | |
163 | |
151 // Various UI elements/events may want to ensure that the floating bar is | 164 // 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 | 165 // 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 | 166 // where keyboard focus is. Whenever an object requires bar visibility, it has |
154 // itself added to |barVisibilityLocks_|. When it no longer requires bar | 167 // itself added to |barVisibilityLocks_|. When it no longer requires bar |
155 // visibility, it has itself removed. | 168 // visibility, it has itself removed. |
156 base::scoped_nsobject<NSMutableSet> barVisibilityLocks_; | 169 base::scoped_nsobject<NSMutableSet> barVisibilityLocks_; |
157 | 170 |
158 // Bar visibility locks and releases only result (when appropriate) in changes | 171 // Bar visibility locks and releases only result (when appropriate) in changes |
159 // in visible state when the following is |YES|. | 172 // in visible state when the following is |YES|. |
160 BOOL barVisibilityUpdatesEnabled_; | 173 BOOL barVisibilityUpdatesEnabled_; |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
394 - (BOOL)supportsBookmarkBar; | 407 - (BOOL)supportsBookmarkBar; |
395 | 408 |
396 // Called to check if this controller's window is a tabbed window (e.g., not a | 409 // 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. | 410 // pop-up window). Returns YES if it is, NO otherwise. |
398 // Note: The |-has...| methods are usually preferred, so this method is largely | 411 // Note: The |-has...| methods are usually preferred, so this method is largely |
399 // deprecated. | 412 // deprecated. |
400 - (BOOL)isTabbedWindow; | 413 - (BOOL)isTabbedWindow; |
401 | 414 |
402 @end // @interface BrowserWindowController(WindowType) | 415 @end // @interface BrowserWindowController(WindowType) |
403 | 416 |
417 // Fullscreen terminology: | |
418 // | |
419 // ---------------------------------------------------------------------------- | |
420 // There are 2 APIs that cause the window to get resized, and possibly move | |
421 // spaces. | |
422 // | |
423 // + AppKitFullscreen API: AppKit touts a feature known as "fullscreen". This | |
424 // involves moving the current window to a different space, and resizing the | |
425 // window to take up the entire size of the screen. | |
426 // | |
427 // + Immersive fullscreen: An alternative to AppKitFullscreen API. Uses on 10.6 | |
428 // (before AppKitFullscreen API was available), and on certain HTML/Flash | |
429 // content. This is a method defined by Chrome. | |
430 // | |
431 // The Immersive fullscreen API can be called after the AppKitFullscreen API. | |
432 // Calling the AppKitFullscreen API while immersive fullscreen API has been | |
433 // invoked causes all fullscreen modes to exit. | |
434 // | |
435 // ---------------------------------------------------------------------------- | |
436 // There are 3 "styles" of omnibox sliding. | |
437 // + OMNIBOX_TABS_PRESENT: Both the omnibox and the tabstrip are present. | |
438 // Moving the cursor to the top causes the menubar to appear, and everything | |
439 // else to slide down. | |
440 // + OMNIBOX_PRESENT: The tabstrip is hidden. Moving the cursor to the top | |
441 // shows the tabstrip and menubar, sliding everything else down. | |
442 // + OMNIBOX_TABS_HIDDEN: Both tabstrip and omnibox are hidden. Moving cursor | |
443 // to top shows tabstrip, omnibox, and menu bar. | |
444 // | |
445 // The omnibox sliding styles are used in conjunction with the fullscreen APIs. | |
446 // There is exactly 1 sliding style active at a time. The sliding is mangaged | |
447 // by the presentationModeController_. (poorly named). | |
448 // | |
449 // ---------------------------------------------------------------------------- | |
450 // There are several "fullscreen modes" bantered around. Technically, any | |
451 // fullscreen API can be combined with any sliding style. | |
452 // | |
453 // + System fullscreen***deprecated***: This term is confusing. Don't use it. | |
454 // 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
| |
455 // AppKitFullscreen API, or the behavior that users expect to see when they | |
456 // click the fullscreen button, or some Chrome specific implementation that | |
457 // uses the AppKitFullscreen API. | |
458 // | |
459 // + 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
| |
460 // expect a fullscreen behavior similar to other AppKit apps. | |
461 // - AppKitFullscreen API + OMNIBOX_TABS_PRESENT. | |
462 // - The button click directly invokes the AppKitFullscreen API. We get a | |
463 // callback, and call adjustUIForOmniboxFullscreen. | |
464 // - We have a menu item that is intended to invoke the same behavior. When | |
465 // they click the menu item, or use its hotkey, we manually invoke the | |
466 // AppKitFullscreen API. | |
467 // | |
468 // + Presentation Mode: | |
469 // - OMNIBOX_TABS_HIDDEN, typically with AppKitFullscreen API, but can | |
470 // also be with Immersive fullscreen API. | |
471 // - We set a flag, indicating that we want Presentation Mode instead of | |
472 // Canonical Fullscreen. Then we invoke the AppKitFullscreen API. | |
473 // | |
474 // + HTML5 fullscreen. <-- Currently uses AppKitFullscreen API. We want | |
475 // this to change. | |
476 // | |
477 // + 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.
| |
478 // enabled it. | |
479 // - OMNIBOX_PRESENT. Can be with either fullscreen API. | |
480 // | |
481 // + Flash fullscreen. | |
404 | 482 |
405 // Methods having to do with fullscreen and presentation mode. | 483 // Methods having to do with fullscreen and presentation mode. |
406 @interface BrowserWindowController(Fullscreen) | 484 @interface BrowserWindowController(Fullscreen) |
407 | 485 |
408 // Toggles fullscreen mode. Meant to be called by Lion windows when they enter | 486 // 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. | 487 // or exit Lion fullscreen mode. Must not be called on Snow Leopard or earlier. |
410 - (void)handleLionToggleFullscreen; | 488 - (void)handleLionToggleFullscreen; |
411 | 489 |
412 // Enters (or exits) fullscreen mode. This method is safe to call on all OS | 490 // Enters Canonical Fullscreen. |
413 // versions. | 491 - (void)enterFullscreenWithChrome; |
414 - (void)enterFullscreen; | |
415 - (void)exitFullscreen; | |
416 | 492 |
417 // Updates the contents of the fullscreen exit bubble with |url| and | 493 // Updates the contents of the fullscreen exit bubble with |url| and |
418 // |bubbleType|. | 494 // |bubbleType|. |
419 - (void)updateFullscreenExitBubbleURL:(const GURL&)url | 495 - (void)updateFullscreenExitBubbleURL:(const GURL&)url |
420 bubbleType:(FullscreenExitBubbleType)bubbleType; | 496 bubbleType:(FullscreenExitBubbleType)bubbleType; |
421 | 497 |
422 // Returns fullscreen state: YES when the window is in fullscreen or is | 498 // Returns YES if the code is in or entering any fullscreen mode. |
423 // animating into fullscreen. | 499 - (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".
| |
424 - (BOOL)isFullscreen; | |
425 | 500 |
426 // Returns YES if the browser window is currently in fullscreen via the built-in | 501 // Returns YES if the browser window is currently in fullscreen via the built-in |
427 // immersive mechanism. | 502 // immersive mechanism. |
428 - (BOOL)isInImmersiveFullscreen; | 503 - (BOOL)isInImmersiveFullscreen; |
429 | 504 |
430 // Returns YES if the browser window is currently in fullscreen via the Cocoa | 505 // Returns YES if the browser window is currently in fullscreen via the AppKit |
431 // System Fullscreen API. | 506 // Fullscreen API. |
432 - (BOOL)isInSystemFullscreen; | 507 - (BOOL)isInOrEnteringAppKitFullscreen; |
433 | 508 |
434 // Enters (or exits) presentation mode. Also enters fullscreen mode if this | 509 // 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 | 510 // and other UI is expected to slide. |
436 // versions. | 511 - (BOOL)isInFullscreenWithOmniboxSliding; |
512 | |
513 // Enters (or exits) presentation mode. | |
437 - (void)enterPresentationModeForURL:(const GURL&)url | 514 - (void)enterPresentationModeForURL:(const GURL&)url |
438 bubbleType:(FullscreenExitBubbleType)bubbleType; | 515 bubbleType:(FullscreenExitBubbleType)bubbleType; |
439 - (void)exitPresentationMode; | |
440 | 516 |
441 // For simplified fullscreen: Enters fullscreen for a tab at a URL. The |url| | 517 // Tries to enter presentation mode. Falls back to simplified fullscreen. |
442 // is guaranteed to be non-empty; see -enterFullscreen for the user-initiated | 518 - (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
| |
443 // fullscreen mode. Called on Snow Leopard and Lion+. | 519 bubbleType:(FullscreenExitBubbleType)bubbleType; |
444 - (void)enterFullscreenForURL:(const GURL&)url | 520 // Exits the current fullscreen mode. |
445 bubbleType:(FullscreenExitBubbleType)bubbleType; | 521 - (void)exitGenericFullscreen; |
446 | 522 |
447 // Returns presentation mode state. This method is safe to call on all OS | 523 // Whether the system is in the very specific fullscreen mode: Presentation |
448 // versions. | 524 // Mode. |
449 - (BOOL)inPresentationMode; | 525 - (BOOL)inPresentationMode; |
450 | 526 |
451 // Resizes the fullscreen window to fit the screen it's currently on. Called by | 527 // 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 | 528 // the PresentationModeController when there is a change in monitor placement or |
453 // resolution. | 529 // resolution. |
454 - (void)resizeFullscreenWindow; | 530 - (void)resizeFullscreenWindow; |
455 | 531 |
456 // Gets or sets the fraction of the floating bar (presentation mode overlay) | 532 // Gets or sets the fraction of the floating bar (presentation mode overlay) |
457 // that is shown. 0 is completely hidden, 1 is fully shown. | 533 // that is shown. 0 is completely hidden, 1 is fully shown. |
458 - (CGFloat)floatingBarShownFraction; | 534 - (CGFloat)floatingBarShownFraction; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
522 // positioned relative to. | 598 // positioned relative to. |
523 - (NSRect)omniboxPopupAnchorRect; | 599 - (NSRect)omniboxPopupAnchorRect; |
524 | 600 |
525 // Force a layout of info bars. | 601 // Force a layout of info bars. |
526 - (void)layoutInfoBars; | 602 - (void)layoutInfoBars; |
527 | 603 |
528 @end // @interface BrowserWindowController (TestingAPI) | 604 @end // @interface BrowserWindowController (TestingAPI) |
529 | 605 |
530 | 606 |
531 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ | 607 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ |
OLD | NEW |