| 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/memory/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 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 17 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
| 18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h" | 18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h" |
| 19 #import "chrome/browser/ui/cocoa/browser_command_executor.h" | 19 #import "chrome/browser/ui/cocoa/browser_command_executor.h" |
| 20 #import "chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.h" | 20 #import "chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.h" |
| 21 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 21 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 22 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" | 22 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" |
| 23 #import "chrome/browser/ui/cocoa/themed_window.h" | 23 #import "chrome/browser/ui/cocoa/themed_window.h" |
| 24 #import "chrome/browser/ui/cocoa/url_drop_target.h" | 24 #import "chrome/browser/ui/cocoa/url_drop_target.h" |
| 25 #import "chrome/browser/ui/cocoa/view_resizer.h" | 25 #import "chrome/browser/ui/cocoa/view_resizer.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 55 ViewResizer, | 55 ViewResizer, |
| 56 TabStripControllerDelegate> { | 56 TabStripControllerDelegate> { |
| 57 @private | 57 @private |
| 58 // The ordering of these members is important as it determines the order in | 58 // The ordering of these members is important as it determines the order in |
| 59 // which they are destroyed. |browser_| needs to be destroyed last as most of | 59 // which they are destroyed. |browser_| needs to be destroyed last as most of |
| 60 // the other objects hold weak references to it or things it owns | 60 // the other objects hold weak references to it or things it owns |
| 61 // (tab/toolbar/bookmark models, profiles, etc). | 61 // (tab/toolbar/bookmark models, profiles, etc). |
| 62 scoped_ptr<Browser> browser_; | 62 scoped_ptr<Browser> browser_; |
| 63 NSWindow* savedRegularWindow_; | 63 NSWindow* savedRegularWindow_; |
| 64 scoped_ptr<BrowserWindowCocoa> windowShim_; | 64 scoped_ptr<BrowserWindowCocoa> windowShim_; |
| 65 scoped_nsobject<ToolbarController> toolbarController_; | 65 base::scoped_nsobject<ToolbarController> toolbarController_; |
| 66 scoped_nsobject<TabStripController> tabStripController_; | 66 base::scoped_nsobject<TabStripController> tabStripController_; |
| 67 scoped_nsobject<FindBarCocoaController> findBarCocoaController_; | 67 base::scoped_nsobject<FindBarCocoaController> findBarCocoaController_; |
| 68 scoped_nsobject<InfoBarContainerController> infoBarContainerController_; | 68 base::scoped_nsobject<InfoBarContainerController> infoBarContainerController_; |
| 69 scoped_nsobject<DownloadShelfController> downloadShelfController_; | 69 base::scoped_nsobject<DownloadShelfController> downloadShelfController_; |
| 70 scoped_nsobject<BookmarkBarController> bookmarkBarController_; | 70 base::scoped_nsobject<BookmarkBarController> bookmarkBarController_; |
| 71 scoped_nsobject<DevToolsController> devToolsController_; | 71 base::scoped_nsobject<DevToolsController> devToolsController_; |
| 72 scoped_nsobject<OverlayableContentsController> overlayableContentsController_; | 72 base::scoped_nsobject<OverlayableContentsController> |
| 73 scoped_nsobject<PresentationModeController> presentationModeController_; | 73 overlayableContentsController_; |
| 74 scoped_nsobject<FullscreenExitBubbleController> | 74 base::scoped_nsobject<PresentationModeController> presentationModeController_; |
| 75 base::scoped_nsobject<FullscreenExitBubbleController> |
| 75 fullscreenExitBubbleController_; | 76 fullscreenExitBubbleController_; |
| 76 | 77 |
| 77 // Strong. StatusBubble is a special case of a strong reference that | 78 // Strong. StatusBubble is a special case of a strong reference that |
| 78 // we don't wrap in a scoped_ptr because it is acting the same | 79 // we don't wrap in a scoped_ptr because it is acting the same |
| 79 // as an NSWindowController in that it wraps a window that must | 80 // as an NSWindowController in that it wraps a window that must |
| 80 // be shut down before our destructors are called. | 81 // be shut down before our destructors are called. |
| 81 StatusBubbleMac* statusBubble_; | 82 StatusBubbleMac* statusBubble_; |
| 82 | 83 |
| 83 BookmarkBubbleController* bookmarkBubbleController_; // Weak. | 84 BookmarkBubbleController* bookmarkBubbleController_; // Weak. |
| 84 BOOL initializing_; // YES while we are currently in initWithBrowser: | 85 BOOL initializing_; // YES while we are currently in initWithBrowser: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 99 BOOL isShrinkingFromZoomed_; | 100 BOOL isShrinkingFromZoomed_; |
| 100 | 101 |
| 101 // The raw accumulated zoom value and the actual zoom increments made for an | 102 // The raw accumulated zoom value and the actual zoom increments made for an |
| 102 // an in-progress pinch gesture. | 103 // an in-progress pinch gesture. |
| 103 CGFloat totalMagnifyGestureAmount_; | 104 CGFloat totalMagnifyGestureAmount_; |
| 104 NSInteger currentZoomStepDelta_; | 105 NSInteger currentZoomStepDelta_; |
| 105 | 106 |
| 106 // The view controller that manages the incognito badge or the multi-profile | 107 // The view controller that manages the incognito badge or the multi-profile |
| 107 // avatar icon. The view is always in the view hierarchy, but will be hidden | 108 // avatar icon. The view is always in the view hierarchy, but will be hidden |
| 108 // unless it's appropriate to show it. | 109 // unless it's appropriate to show it. |
| 109 scoped_nsobject<AvatarButtonController> avatarButtonController_; | 110 base::scoped_nsobject<AvatarButtonController> avatarButtonController_; |
| 110 | 111 |
| 111 // Lazily created view which draws the background for the floating set of bars | 112 // Lazily created view which draws the background for the floating set of bars |
| 112 // in presentation mode (for window types having a floating bar; it remains | 113 // in presentation mode (for window types having a floating bar; it remains |
| 113 // nil for those which don't). | 114 // nil for those which don't). |
| 114 scoped_nsobject<NSView> floatingBarBackingView_; | 115 base::scoped_nsobject<NSView> floatingBarBackingView_; |
| 115 | 116 |
| 116 // The borderless window used in fullscreen mode. Lion reuses the original | 117 // The borderless window used in fullscreen mode. Lion reuses the original |
| 117 // window in fullscreen mode, so this is always nil on Lion. | 118 // window in fullscreen mode, so this is always nil on Lion. |
| 118 scoped_nsobject<NSWindow> fullscreenWindow_; | 119 base::scoped_nsobject<NSWindow> fullscreenWindow_; |
| 119 | 120 |
| 120 // Tracks whether presentation mode was entered from fullscreen mode or | 121 // Tracks whether presentation mode was entered from fullscreen mode or |
| 121 // directly from normal windowed mode. Used to determine what to do when | 122 // directly from normal windowed mode. Used to determine what to do when |
| 122 // exiting presentation mode. | 123 // exiting presentation mode. |
| 123 BOOL enteredPresentationModeFromFullscreen_; | 124 BOOL enteredPresentationModeFromFullscreen_; |
| 124 | 125 |
| 125 // True between -windowWillEnterFullScreen and -windowDidEnterFullScreen. | 126 // True between -windowWillEnterFullScreen and -windowDidEnterFullScreen. |
| 126 // Only used on Lion and higher. | 127 // Only used on Lion and higher. |
| 127 BOOL enteringFullscreen_; | 128 BOOL enteringFullscreen_; |
| 128 | 129 |
| 129 // True between |-setPresentationMode:url:bubbleType:| and | 130 // True between |-setPresentationMode:url:bubbleType:| and |
| 130 // -windowDidEnterFullScreen. Only used on Lion and higher. | 131 // -windowDidEnterFullScreen. Only used on Lion and higher. |
| 131 BOOL enteringPresentationMode_; | 132 BOOL enteringPresentationMode_; |
| 132 | 133 |
| 133 // The size of the original (non-fullscreen) window. This is saved just | 134 // The size of the original (non-fullscreen) window. This is saved just |
| 134 // before entering fullscreen mode and is only valid when |-isFullscreen| | 135 // before entering fullscreen mode and is only valid when |-isFullscreen| |
| 135 // returns YES. | 136 // returns YES. |
| 136 NSRect savedRegularWindowFrame_; | 137 NSRect savedRegularWindowFrame_; |
| 137 | 138 |
| 138 // The proportion of the floating bar which is shown (in presentation mode). | 139 // The proportion of the floating bar which is shown (in presentation mode). |
| 139 CGFloat floatingBarShownFraction_; | 140 CGFloat floatingBarShownFraction_; |
| 140 | 141 |
| 141 // Various UI elements/events may want to ensure that the floating bar is | 142 // Various UI elements/events may want to ensure that the floating bar is |
| 142 // visible (in presentation mode), e.g., because of where the mouse is or | 143 // visible (in presentation mode), e.g., because of where the mouse is or |
| 143 // where keyboard focus is. Whenever an object requires bar visibility, it has | 144 // where keyboard focus is. Whenever an object requires bar visibility, it has |
| 144 // itself added to |barVisibilityLocks_|. When it no longer requires bar | 145 // itself added to |barVisibilityLocks_|. When it no longer requires bar |
| 145 // visibility, it has itself removed. | 146 // visibility, it has itself removed. |
| 146 scoped_nsobject<NSMutableSet> barVisibilityLocks_; | 147 base::scoped_nsobject<NSMutableSet> barVisibilityLocks_; |
| 147 | 148 |
| 148 // Bar visibility locks and releases only result (when appropriate) in changes | 149 // Bar visibility locks and releases only result (when appropriate) in changes |
| 149 // in visible state when the following is |YES|. | 150 // in visible state when the following is |YES|. |
| 150 BOOL barVisibilityUpdatesEnabled_; | 151 BOOL barVisibilityUpdatesEnabled_; |
| 151 | 152 |
| 152 // When going fullscreen for a tab, we need to store the URL and the | 153 // When going fullscreen for a tab, we need to store the URL and the |
| 153 // fullscreen type, since we can't show the bubble until | 154 // fullscreen type, since we can't show the bubble until |
| 154 // -windowDidEnterFullScreen: gets called. | 155 // -windowDidEnterFullScreen: gets called. |
| 155 GURL fullscreenUrl_; | 156 GURL fullscreenUrl_; |
| 156 FullscreenExitBubbleType fullscreenBubbleType_; | 157 FullscreenExitBubbleType fullscreenBubbleType_; |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 - (FullscreenExitBubbleController*)fullscreenExitBubbleController; | 505 - (FullscreenExitBubbleController*)fullscreenExitBubbleController; |
| 505 | 506 |
| 506 // Gets the rect, in window base coordinates, that the omnibox popup should be | 507 // Gets the rect, in window base coordinates, that the omnibox popup should be |
| 507 // positioned relative to. | 508 // positioned relative to. |
| 508 - (NSRect)omniboxPopupAnchorRect; | 509 - (NSRect)omniboxPopupAnchorRect; |
| 509 | 510 |
| 510 @end // @interface BrowserWindowController (TestingAPI) | 511 @end // @interface BrowserWindowController (TestingAPI) |
| 511 | 512 |
| 512 | 513 |
| 513 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ | 514 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ |
| OLD | NEW |