| 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 |
| 11 // TabWindowController, a tab strip along the top. | 11 // TabWindowController, a tab strip along the top. |
| 12 | 12 |
| 13 #import <Cocoa/Cocoa.h> | 13 #import <Cocoa/Cocoa.h> |
| 14 | 14 |
| 15 #include "base/mac/scoped_nsobject.h" | 15 #include "base/mac/scoped_nsobject.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "chrome/browser/translate/chrome_translate_client.h" | 17 #include "chrome/browser/translate/chrome_translate_client.h" |
| 18 #include "chrome/browser/ui/tabs/tab_utils.h" | |
| 19 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
| 20 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h" | 19 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h" |
| 21 #import "chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.h" | |
| 22 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 20 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 23 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" | 21 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" |
| 24 #import "chrome/browser/ui/cocoa/themed_window.h" | 22 #import "chrome/browser/ui/cocoa/themed_window.h" |
| 25 #import "chrome/browser/ui/cocoa/url_drop_target.h" | 23 #import "chrome/browser/ui/cocoa/url_drop_target.h" |
| 26 #import "chrome/browser/ui/cocoa/view_resizer.h" | 24 #import "chrome/browser/ui/cocoa/view_resizer.h" |
| 25 #include "chrome/browser/ui/tabs/tab_utils.h" |
| 27 #include "components/translate/core/common/translate_errors.h" | 26 #include "components/translate/core/common/translate_errors.h" |
| 28 #include "ui/base/accelerators/accelerator_manager.h" | 27 #include "ui/base/accelerators/accelerator_manager.h" |
| 29 #include "ui/gfx/geometry/rect.h" | 28 #include "ui/gfx/geometry/rect.h" |
| 30 | 29 |
| 31 @class AvatarBaseController; | 30 @class AvatarBaseController; |
| 32 class BookmarkBubbleObserverCocoa; | 31 class BookmarkBubbleObserverCocoa; |
| 33 class Browser; | 32 class Browser; |
| 34 class BrowserWindow; | 33 class BrowserWindow; |
| 35 class BrowserWindowCocoa; | 34 class BrowserWindowCocoa; |
| 36 @class BrowserWindowFullscreenTransition; | 35 @class BrowserWindowFullscreenTransition; |
| 37 @class DevToolsController; | 36 @class DevToolsController; |
| 38 @class DownloadShelfController; | 37 @class DownloadShelfController; |
| 39 class ExtensionKeybindingRegistryCocoa; | 38 class ExtensionKeybindingRegistryCocoa; |
| 39 class ExclusiveAccessController; |
| 40 class ExclusiveAccessContext; |
| 40 @class FindBarCocoaController; | 41 @class FindBarCocoaController; |
| 41 @class FullscreenModeController; | 42 @class FullscreenModeController; |
| 42 @class FullscreenWindow; | 43 @class FullscreenWindow; |
| 43 @class InfoBarContainerController; | 44 @class InfoBarContainerController; |
| 44 class LocationBarViewMac; | 45 class LocationBarViewMac; |
| 45 @class OverlayableContentsController; | 46 @class OverlayableContentsController; |
| 46 class PermissionBubbleCocoa; | 47 class PermissionBubbleCocoa; |
| 47 @class PresentationModeController; | 48 @class PresentationModeController; |
| 48 class StatusBubbleMac; | 49 class StatusBubbleMac; |
| 49 @class TabStripController; | 50 @class TabStripController; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 74 base::scoped_nsobject<ToolbarController> toolbarController_; | 75 base::scoped_nsobject<ToolbarController> toolbarController_; |
| 75 base::scoped_nsobject<TabStripController> tabStripController_; | 76 base::scoped_nsobject<TabStripController> tabStripController_; |
| 76 base::scoped_nsobject<FindBarCocoaController> findBarCocoaController_; | 77 base::scoped_nsobject<FindBarCocoaController> findBarCocoaController_; |
| 77 base::scoped_nsobject<InfoBarContainerController> infoBarContainerController_; | 78 base::scoped_nsobject<InfoBarContainerController> infoBarContainerController_; |
| 78 base::scoped_nsobject<DownloadShelfController> downloadShelfController_; | 79 base::scoped_nsobject<DownloadShelfController> downloadShelfController_; |
| 79 base::scoped_nsobject<BookmarkBarController> bookmarkBarController_; | 80 base::scoped_nsobject<BookmarkBarController> bookmarkBarController_; |
| 80 base::scoped_nsobject<DevToolsController> devToolsController_; | 81 base::scoped_nsobject<DevToolsController> devToolsController_; |
| 81 base::scoped_nsobject<OverlayableContentsController> | 82 base::scoped_nsobject<OverlayableContentsController> |
| 82 overlayableContentsController_; | 83 overlayableContentsController_; |
| 83 base::scoped_nsobject<PresentationModeController> presentationModeController_; | 84 base::scoped_nsobject<PresentationModeController> presentationModeController_; |
| 84 base::scoped_nsobject<ExclusiveAccessBubbleWindowController> | 85 scoped_ptr<ExclusiveAccessController> exclusiveAccessController_; |
| 85 exclusiveAccessBubbleWindowController_; | |
| 86 base::scoped_nsobject<BrowserWindowFullscreenTransition> | 86 base::scoped_nsobject<BrowserWindowFullscreenTransition> |
| 87 fullscreenTransition_; | 87 fullscreenTransition_; |
| 88 | 88 |
| 89 // Strong. StatusBubble is a special case of a strong reference that | 89 // Strong. StatusBubble is a special case of a strong reference that |
| 90 // we don't wrap in a scoped_ptr because it is acting the same | 90 // we don't wrap in a scoped_ptr because it is acting the same |
| 91 // as an NSWindowController in that it wraps a window that must | 91 // as an NSWindowController in that it wraps a window that must |
| 92 // be shut down before our destructors are called. | 92 // be shut down before our destructors are called. |
| 93 StatusBubbleMac* statusBubble_; | 93 StatusBubbleMac* statusBubble_; |
| 94 | 94 |
| 95 scoped_ptr<BookmarkBubbleObserverCocoa> bookmarkBubbleObserver_; | 95 scoped_ptr<BookmarkBubbleObserverCocoa> bookmarkBubbleObserver_; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 179 |
| 180 // Bar visibility locks and releases only result (when appropriate) in changes | 180 // Bar visibility locks and releases only result (when appropriate) in changes |
| 181 // in visible state when the following is |YES|. | 181 // in visible state when the following is |YES|. |
| 182 BOOL barVisibilityUpdatesEnabled_; | 182 BOOL barVisibilityUpdatesEnabled_; |
| 183 | 183 |
| 184 // If this ivar is set to YES, layoutSubviews calls will be ignored. This is | 184 // If this ivar is set to YES, layoutSubviews calls will be ignored. This is |
| 185 // used in fullscreen transition to prevent spurious resize messages from | 185 // used in fullscreen transition to prevent spurious resize messages from |
| 186 // being sent to the renderer, which causes the transition to be janky. | 186 // being sent to the renderer, which causes the transition to be janky. |
| 187 BOOL blockLayoutSubviews_; | 187 BOOL blockLayoutSubviews_; |
| 188 | 188 |
| 189 // When going fullscreen for a tab, we need to store the URL and the | |
| 190 // fullscreen type, since we can't show the bubble until | |
| 191 // -windowDidEnterFullScreen: gets called. | |
| 192 GURL fullscreenUrl_; | |
| 193 ExclusiveAccessBubbleType exclusiveAccessBubbleType_; | |
| 194 | |
| 195 // The Extension Command Registry used to determine which keyboard events to | 189 // The Extension Command Registry used to determine which keyboard events to |
| 196 // handle. | 190 // handle. |
| 197 scoped_ptr<ExtensionKeybindingRegistryCocoa> extension_keybinding_registry_; | 191 scoped_ptr<ExtensionKeybindingRegistryCocoa> extension_keybinding_registry_; |
| 198 } | 192 } |
| 199 | 193 |
| 200 // A convenience class method which gets the |BrowserWindowController| for a | 194 // A convenience class method which gets the |BrowserWindowController| for a |
| 201 // given window. This method returns nil if no window in the chain has a BWC. | 195 // given window. This method returns nil if no window in the chain has a BWC. |
| 202 + (BrowserWindowController*)browserWindowControllerForWindow:(NSWindow*)window; | 196 + (BrowserWindowController*)browserWindowControllerForWindow:(NSWindow*)window; |
| 203 | 197 |
| 204 // A convenience class method which gets the |BrowserWindowController| for a | 198 // A convenience class method which gets the |BrowserWindowController| for a |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 // If |withToolbar| is NO, the tab strip and toolbar are hidden | 519 // If |withToolbar| is NO, the tab strip and toolbar are hidden |
| 526 // (aka Presentation Mode). | 520 // (aka Presentation Mode). |
| 527 - (void)enterBrowserFullscreenWithToolbar:(BOOL)withToolbar; | 521 - (void)enterBrowserFullscreenWithToolbar:(BOOL)withToolbar; |
| 528 | 522 |
| 529 // Adds or removes the tab strip and toolbar from the current window. The | 523 // Adds or removes the tab strip and toolbar from the current window. The |
| 530 // window must be in immersive or AppKit Fullscreen. | 524 // window must be in immersive or AppKit Fullscreen. |
| 531 - (void)updateFullscreenWithToolbar:(BOOL)withToolbar; | 525 - (void)updateFullscreenWithToolbar:(BOOL)withToolbar; |
| 532 | 526 |
| 533 // Updates the contents of the fullscreen exit bubble with |url| and | 527 // Updates the contents of the fullscreen exit bubble with |url| and |
| 534 // |bubbleType|. | 528 // |bubbleType|. |
| 535 - (void)updateFullscreenExitBubbleURL:(const GURL&)url | 529 - (void)updateFullscreenExitBubble; |
| 536 bubbleType:(ExclusiveAccessBubbleType)bubbleType; | |
| 537 | 530 |
| 538 // Toggles and updates the toolbar's visibility in fullscreen mode. This | 531 // Toggles and updates the toolbar's visibility in fullscreen mode. This |
| 539 // function toggles between the sliding styles: OMNIBOX_TABS_PRESENT and | 532 // function toggles between the sliding styles: OMNIBOX_TABS_PRESENT and |
| 540 // OMNIBOX_TABS_HIDDEN. | 533 // OMNIBOX_TABS_HIDDEN. |
| 541 - (void)toggleFullscreenToolbar; | 534 - (void)toggleFullscreenToolbar; |
| 542 | 535 |
| 543 // Returns YES if the browser window is in or entering any fullscreen mode. | 536 // Returns YES if the browser window is in or entering any fullscreen mode. |
| 544 - (BOOL)isInAnyFullscreenMode; | 537 - (BOOL)isInAnyFullscreenMode; |
| 545 | 538 |
| 546 // Returns YES if the browser window is currently in or entering fullscreen via | 539 // Returns YES if the browser window is currently in or entering fullscreen via |
| 547 // the built-in immersive mechanism. | 540 // the built-in immersive mechanism. |
| 548 - (BOOL)isInImmersiveFullscreen; | 541 - (BOOL)isInImmersiveFullscreen; |
| 549 | 542 |
| 550 // Returns YES if the browser window is currently in or entering fullscreen via | 543 // Returns YES if the browser window is currently in or entering fullscreen via |
| 551 // the AppKit Fullscreen API. | 544 // the AppKit Fullscreen API. |
| 552 - (BOOL)isInAppKitFullscreen; | 545 - (BOOL)isInAppKitFullscreen; |
| 553 | 546 |
| 554 // Enter fullscreen for an extension. | 547 // Enter fullscreen for an extension. |
| 555 - (void)enterExtensionFullscreenForURL:(const GURL&)url | 548 - (void)enterExtensionFullscreen; |
| 556 bubbleType:(ExclusiveAccessBubbleType)bubbleType; | |
| 557 | 549 |
| 558 // Enters Immersive Fullscreen for the given URL. | 550 // Enters Immersive Fullscreen for the given URL. |
| 559 - (void)enterWebContentFullscreenForURL:(const GURL&)url | 551 - (void)enterWebContentFullscreen; |
| 560 bubbleType:(ExclusiveAccessBubbleType)bubbleType; | |
| 561 | 552 |
| 562 // Exits the current fullscreen mode. | 553 // Exits the current fullscreen mode. |
| 563 - (void)exitAnyFullscreen; | 554 - (void)exitAnyFullscreen; |
| 564 | 555 |
| 565 // Whether the system is in the very specific fullscreen mode: Presentation | 556 // Whether the system is in the very specific fullscreen mode: Presentation |
| 566 // Mode. | 557 // Mode. |
| 567 - (BOOL)inPresentationMode; | 558 - (BOOL)inPresentationMode; |
| 568 | 559 |
| 569 // Whether if the toolbar should be hidden in fullscreen. | 560 // Whether if the toolbar should be hidden in fullscreen. |
| 570 - (BOOL)shouldHideFullscreenToolbar; | 561 - (BOOL)shouldHideFullscreenToolbar; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 588 - (void)lockBarVisibilityForOwner:(id)owner | 579 - (void)lockBarVisibilityForOwner:(id)owner |
| 589 withAnimation:(BOOL)animate | 580 withAnimation:(BOOL)animate |
| 590 delay:(BOOL)delay; | 581 delay:(BOOL)delay; |
| 591 - (void)releaseBarVisibilityForOwner:(id)owner | 582 - (void)releaseBarVisibilityForOwner:(id)owner |
| 592 withAnimation:(BOOL)animate | 583 withAnimation:(BOOL)animate |
| 593 delay:(BOOL)delay; | 584 delay:(BOOL)delay; |
| 594 | 585 |
| 595 // Returns YES if any of the views in the floating bar currently has focus. | 586 // Returns YES if any of the views in the floating bar currently has focus. |
| 596 - (BOOL)floatingBarHasFocus; | 587 - (BOOL)floatingBarHasFocus; |
| 597 | 588 |
| 589 // Accessor for the controller managing fullscreen ExclusiveAccessContext. |
| 590 - (ExclusiveAccessController*)exclusiveAccessController; |
| 591 |
| 598 @end // @interface BrowserWindowController(Fullscreen) | 592 @end // @interface BrowserWindowController(Fullscreen) |
| 599 | 593 |
| 600 | 594 |
| 601 // Methods which are either only for testing, or only public for testing. | 595 // Methods which are either only for testing, or only public for testing. |
| 602 @interface BrowserWindowController (TestingAPI) | 596 @interface BrowserWindowController (TestingAPI) |
| 603 | 597 |
| 604 // Put the incognito badge or multi-profile avatar on the browser and adjust the | 598 // Put the incognito badge or multi-profile avatar on the browser and adjust the |
| 605 // tab strip accordingly. | 599 // tab strip accordingly. |
| 606 - (void)installAvatar; | 600 - (void)installAvatar; |
| 607 | 601 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 624 | 618 |
| 625 // Resets any saved state about window growth (due to showing the bookmark bar | 619 // Resets any saved state about window growth (due to showing the bookmark bar |
| 626 // or the download shelf), so that future shrinking will occur from the bottom. | 620 // or the download shelf), so that future shrinking will occur from the bottom. |
| 627 - (void)resetWindowGrowthState; | 621 - (void)resetWindowGrowthState; |
| 628 | 622 |
| 629 // Computes by how far in each direction, horizontal and vertical, the | 623 // Computes by how far in each direction, horizontal and vertical, the |
| 630 // |source| rect doesn't fit into |target|. | 624 // |source| rect doesn't fit into |target|. |
| 631 - (NSSize)overflowFrom:(NSRect)source | 625 - (NSSize)overflowFrom:(NSRect)source |
| 632 to:(NSRect)target; | 626 to:(NSRect)target; |
| 633 | 627 |
| 634 // The fullscreen exit bubble controller, or nil if the bubble isn't showing. | |
| 635 - (ExclusiveAccessBubbleWindowController*)exclusiveAccessBubbleWindowController; | |
| 636 | |
| 637 // Gets the rect, in window base coordinates, that the omnibox popup should be | 628 // Gets the rect, in window base coordinates, that the omnibox popup should be |
| 638 // positioned relative to. | 629 // positioned relative to. |
| 639 - (NSRect)omniboxPopupAnchorRect; | 630 - (NSRect)omniboxPopupAnchorRect; |
| 640 | 631 |
| 641 @end // @interface BrowserWindowController (TestingAPI) | 632 @end // @interface BrowserWindowController (TestingAPI) |
| 642 | 633 |
| 643 | 634 |
| 644 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ | 635 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ |
| OLD | NEW |