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 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
19 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h" | 19 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h" |
20 #import "chrome/browser/ui/cocoa/browser_command_executor.h" | 20 #import "chrome/browser/ui/cocoa/browser_command_executor.h" |
21 #import "chrome/browser/ui/cocoa/fullscreen_exit_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" | 22 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
23 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" | 23 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" |
24 #import "chrome/browser/ui/cocoa/themed_window.h" | 24 #import "chrome/browser/ui/cocoa/themed_window.h" |
25 #import "chrome/browser/ui/cocoa/url_drop_target.h" | 25 #import "chrome/browser/ui/cocoa/url_drop_target.h" |
26 #import "chrome/browser/ui/cocoa/view_resizer.h" | 26 #import "chrome/browser/ui/cocoa/view_resizer.h" |
27 #include "components/translate/core/common/translate_errors.h" | 27 #include "components/translate/core/common/translate_errors.h" |
28 #include "ui/base/accelerators/accelerator_manager.h" | 28 #include "ui/base/accelerators/accelerator_manager.h" |
29 #include "ui/gfx/rect.h" | 29 #include "ui/gfx/rect.h" |
30 | 30 |
31 @class AvatarBaseController; | 31 @class AvatarBaseController; |
(...skipping 42 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<FullscreenExitBubbleController> | 84 base::scoped_nsobject<ExclusiveAccessBubbleWindowController> |
85 fullscreenExitBubbleController_; | 85 exclusiveAccessBubbleWindowController_; |
86 | 86 |
87 // Strong. StatusBubble is a special case of a strong reference that | 87 // Strong. StatusBubble is a special case of a strong reference that |
88 // 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 |
89 // as an NSWindowController in that it wraps a window that must | 89 // as an NSWindowController in that it wraps a window that must |
90 // be shut down before our destructors are called. | 90 // be shut down before our destructors are called. |
91 StatusBubbleMac* statusBubble_; | 91 StatusBubbleMac* statusBubble_; |
92 | 92 |
93 BookmarkBubbleController* bookmarkBubbleController_; // Weak. | 93 BookmarkBubbleController* bookmarkBubbleController_; // Weak. |
94 BOOL initializing_; // YES while we are currently in initWithBrowser: | 94 BOOL initializing_; // YES while we are currently in initWithBrowser: |
95 BOOL ownsBrowser_; // Only ever NO when testing | 95 BOOL ownsBrowser_; // Only ever NO when testing |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 base::scoped_nsobject<NSMutableSet> barVisibilityLocks_; | 165 base::scoped_nsobject<NSMutableSet> barVisibilityLocks_; |
166 | 166 |
167 // Bar visibility locks and releases only result (when appropriate) in changes | 167 // Bar visibility locks and releases only result (when appropriate) in changes |
168 // in visible state when the following is |YES|. | 168 // in visible state when the following is |YES|. |
169 BOOL barVisibilityUpdatesEnabled_; | 169 BOOL barVisibilityUpdatesEnabled_; |
170 | 170 |
171 // When going fullscreen for a tab, we need to store the URL and the | 171 // When going fullscreen for a tab, we need to store the URL and the |
172 // fullscreen type, since we can't show the bubble until | 172 // fullscreen type, since we can't show the bubble until |
173 // -windowDidEnterFullScreen: gets called. | 173 // -windowDidEnterFullScreen: gets called. |
174 GURL fullscreenUrl_; | 174 GURL fullscreenUrl_; |
175 FullscreenExitBubbleType fullscreenBubbleType_; | 175 ExclusiveAccessBubbleType exclusiveAccessBubbleType_; |
176 | 176 |
177 // The Extension Command Registry used to determine which keyboard events to | 177 // The Extension Command Registry used to determine which keyboard events to |
178 // handle. | 178 // handle. |
179 scoped_ptr<ExtensionKeybindingRegistryCocoa> extension_keybinding_registry_; | 179 scoped_ptr<ExtensionKeybindingRegistryCocoa> extension_keybinding_registry_; |
180 | 180 |
181 // Whether the root view of the window is layer backed. | 181 // Whether the root view of the window is layer backed. |
182 BOOL windowViewWantsLayer_; | 182 BOOL windowViewWantsLayer_; |
183 } | 183 } |
184 | 184 |
185 // A convenience class method which gets the |BrowserWindowController| for a | 185 // A convenience class method which gets the |BrowserWindowController| for a |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 // (aka Presentation Mode). | 504 // (aka Presentation Mode). |
505 - (void)enterBrowserFullscreenWithToolbar:(BOOL)withToolbar; | 505 - (void)enterBrowserFullscreenWithToolbar:(BOOL)withToolbar; |
506 | 506 |
507 // Adds or removes the tab strip and toolbar from the current window. The | 507 // Adds or removes the tab strip and toolbar from the current window. The |
508 // window must be in immersive or AppKit Fullscreen. | 508 // window must be in immersive or AppKit Fullscreen. |
509 - (void)updateFullscreenWithToolbar:(BOOL)withToolbar; | 509 - (void)updateFullscreenWithToolbar:(BOOL)withToolbar; |
510 | 510 |
511 // Updates the contents of the fullscreen exit bubble with |url| and | 511 // Updates the contents of the fullscreen exit bubble with |url| and |
512 // |bubbleType|. | 512 // |bubbleType|. |
513 - (void)updateFullscreenExitBubbleURL:(const GURL&)url | 513 - (void)updateFullscreenExitBubbleURL:(const GURL&)url |
514 bubbleType:(FullscreenExitBubbleType)bubbleType; | 514 bubbleType:(ExclusiveAccessBubbleType)bubbleType; |
515 | 515 |
516 // Returns YES if the browser window is in or entering any fullscreen mode. | 516 // Returns YES if the browser window is in or entering any fullscreen mode. |
517 - (BOOL)isInAnyFullscreenMode; | 517 - (BOOL)isInAnyFullscreenMode; |
518 | 518 |
519 // Returns YES if the browser window is currently in or entering fullscreen via | 519 // Returns YES if the browser window is currently in or entering fullscreen via |
520 // the built-in immersive mechanism. | 520 // the built-in immersive mechanism. |
521 - (BOOL)isInImmersiveFullscreen; | 521 - (BOOL)isInImmersiveFullscreen; |
522 | 522 |
523 // Returns YES if the browser window is currently in or entering fullscreen via | 523 // Returns YES if the browser window is currently in or entering fullscreen via |
524 // the AppKit Fullscreen API. | 524 // the AppKit Fullscreen API. |
525 - (BOOL)isInAppKitFullscreen; | 525 - (BOOL)isInAppKitFullscreen; |
526 | 526 |
527 // Enter fullscreen for an extension. | 527 // Enter fullscreen for an extension. |
528 - (void)enterExtensionFullscreenForURL:(const GURL&)url | 528 - (void)enterExtensionFullscreenForURL:(const GURL&)url |
529 bubbleType:(FullscreenExitBubbleType)bubbleType; | 529 bubbleType:(ExclusiveAccessBubbleType)bubbleType; |
530 | 530 |
531 // Enters Immersive Fullscreen for the given URL. | 531 // Enters Immersive Fullscreen for the given URL. |
532 - (void)enterWebContentFullscreenForURL:(const GURL&)url | 532 - (void)enterWebContentFullscreenForURL:(const GURL&)url |
533 bubbleType:(FullscreenExitBubbleType)bubbleType; | 533 bubbleType:(ExclusiveAccessBubbleType)bubbleType; |
534 | 534 |
535 // Exits the current fullscreen mode. | 535 // Exits the current fullscreen mode. |
536 - (void)exitAnyFullscreen; | 536 - (void)exitAnyFullscreen; |
537 | 537 |
538 // Whether the system is in the very specific fullscreen mode: Presentation | 538 // Whether the system is in the very specific fullscreen mode: Presentation |
539 // Mode. | 539 // Mode. |
540 - (BOOL)inPresentationMode; | 540 - (BOOL)inPresentationMode; |
541 | 541 |
542 // Resizes the fullscreen window to fit the screen it's currently on. Called by | 542 // Resizes the fullscreen window to fit the screen it's currently on. Called by |
543 // the PresentationModeController when there is a change in monitor placement or | 543 // the PresentationModeController when there is a change in monitor placement or |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 // Resets any saved state about window growth (due to showing the bookmark bar | 595 // Resets any saved state about window growth (due to showing the bookmark bar |
596 // or the download shelf), so that future shrinking will occur from the bottom. | 596 // or the download shelf), so that future shrinking will occur from the bottom. |
597 - (void)resetWindowGrowthState; | 597 - (void)resetWindowGrowthState; |
598 | 598 |
599 // Computes by how far in each direction, horizontal and vertical, the | 599 // Computes by how far in each direction, horizontal and vertical, the |
600 // |source| rect doesn't fit into |target|. | 600 // |source| rect doesn't fit into |target|. |
601 - (NSSize)overflowFrom:(NSRect)source | 601 - (NSSize)overflowFrom:(NSRect)source |
602 to:(NSRect)target; | 602 to:(NSRect)target; |
603 | 603 |
604 // The fullscreen exit bubble controller, or nil if the bubble isn't showing. | 604 // The fullscreen exit bubble controller, or nil if the bubble isn't showing. |
605 - (FullscreenExitBubbleController*)fullscreenExitBubbleController; | 605 - (ExclusiveAccessBubbleWindowController*)exclusiveAccessBubbleWindowController; |
606 | 606 |
607 // Gets the rect, in window base coordinates, that the omnibox popup should be | 607 // Gets the rect, in window base coordinates, that the omnibox popup should be |
608 // positioned relative to. | 608 // positioned relative to. |
609 - (NSRect)omniboxPopupAnchorRect; | 609 - (NSRect)omniboxPopupAnchorRect; |
610 | 610 |
611 // Force a layout of info bars. | 611 // Force a layout of info bars. |
612 - (void)layoutInfoBars; | 612 - (void)layoutInfoBars; |
613 | 613 |
614 @end // @interface BrowserWindowController (TestingAPI) | 614 @end // @interface BrowserWindowController (TestingAPI) |
615 | 615 |
616 | 616 |
617 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ | 617 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ |
OLD | NEW |