| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_COCOA_BROWSER_WINDOW_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_COCOA_BROWSER_WINDOW_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_COCOA_BROWSER_WINDOW_CONTROLLER_H_ | 6 #define CHROME_BROWSER_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 29 matching lines...) Expand all Loading... |
| 40 class TabStripModelObserverBridge; | 40 class TabStripModelObserverBridge; |
| 41 @class TabStripView; | 41 @class TabStripView; |
| 42 @class ToolbarController; | 42 @class ToolbarController; |
| 43 @class TitlebarController; | 43 @class TitlebarController; |
| 44 | 44 |
| 45 @interface BrowserWindowController : | 45 @interface BrowserWindowController : |
| 46 TabWindowController<NSUserInterfaceValidations, | 46 TabWindowController<NSUserInterfaceValidations, |
| 47 BookmarkBarControllerDelegate, | 47 BookmarkBarControllerDelegate, |
| 48 BrowserCommandExecutor, | 48 BrowserCommandExecutor, |
| 49 ViewResizer, | 49 ViewResizer, |
| 50 GTMThemeDelegate, | 50 GTMThemeDelegate> { |
| 51 URLDropTargetWindowController> { | |
| 52 @private | 51 @private |
| 53 // The ordering of these members is important as it determines the order in | 52 // The ordering of these members is important as it determines the order in |
| 54 // which they are destroyed. |browser_| needs to be destroyed last as most of | 53 // which they are destroyed. |browser_| needs to be destroyed last as most of |
| 55 // the other objects hold weak references to it or things it owns | 54 // the other objects hold weak references to it or things it owns |
| 56 // (tab/toolbar/bookmark models, profiles, etc). | 55 // (tab/toolbar/bookmark models, profiles, etc). |
| 57 scoped_ptr<Browser> browser_; | 56 scoped_ptr<Browser> browser_; |
| 58 NSWindow* savedRegularWindow_; | 57 NSWindow* savedRegularWindow_; |
| 59 scoped_ptr<TabStripModelObserverBridge> tabObserver_; | 58 scoped_ptr<TabStripModelObserverBridge> tabObserver_; |
| 60 scoped_ptr<BrowserWindowCocoa> windowShim_; | 59 scoped_ptr<BrowserWindowCocoa> windowShim_; |
| 61 scoped_nsobject<ToolbarController> toolbarController_; | 60 scoped_nsobject<ToolbarController> toolbarController_; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 // Called to check if this controller's window is a normal window (e.g., not a | 156 // Called to check if this controller's window is a normal window (e.g., not a |
| 158 // pop-up window). Returns YES if it is, NO otherwise. | 157 // pop-up window). Returns YES if it is, NO otherwise. |
| 159 - (BOOL)isNormalWindow; | 158 - (BOOL)isNormalWindow; |
| 160 | 159 |
| 161 - (BOOL)isBookmarkBarVisible; | 160 - (BOOL)isBookmarkBarVisible; |
| 162 | 161 |
| 163 // Called after bookmark bar visibility changes (due to pref change or change in | 162 // Called after bookmark bar visibility changes (due to pref change or change in |
| 164 // tab/tab contents). | 163 // tab/tab contents). |
| 165 - (void)updateBookmarkBarVisibilityWithAnimation:(BOOL)animate; | 164 - (void)updateBookmarkBarVisibilityWithAnimation:(BOOL)animate; |
| 166 | 165 |
| 166 // Return a weak pointer to the tab strip controller. |
| 167 - (TabStripController*)tabStripController; |
| 168 |
| 169 // Return a weak pointer to the toolbar controller. |
| 170 - (ToolbarController*)toolbarController; |
| 171 |
| 167 - (BOOL)isDownloadShelfVisible; | 172 - (BOOL)isDownloadShelfVisible; |
| 168 | 173 |
| 169 // Lazily creates the download shelf in visible state if it doesn't exist yet. | 174 // Lazily creates the download shelf in visible state if it doesn't exist yet. |
| 170 - (DownloadShelfController*)downloadShelf; | 175 - (DownloadShelfController*)downloadShelf; |
| 171 | 176 |
| 172 // Retains the given FindBarCocoaController and adds its view to this | 177 // Retains the given FindBarCocoaController and adds its view to this |
| 173 // browser window. Must only be called once per | 178 // browser window. Must only be called once per |
| 174 // BrowserWindowController. | 179 // BrowserWindowController. |
| 175 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController; | 180 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController; |
| 176 | 181 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 203 // Returns YES if the window became the active per-tab sheet of the current tab, | 208 // Returns YES if the window became the active per-tab sheet of the current tab, |
| 204 // or NO if the current tab already has a per-tab sheet. If this returns NO, | 209 // or NO if the current tab already has a per-tab sheet. If this returns NO, |
| 205 // the window's |Realize()| method will be called again when the curren sheet | 210 // the window's |Realize()| method will be called again when the curren sheet |
| 206 // disappears. The window should then call |attachConstrainedWindow:| again. | 211 // disappears. The window should then call |attachConstrainedWindow:| again. |
| 207 - (BOOL)attachConstrainedWindow:(ConstrainedWindowMac*)window; | 212 - (BOOL)attachConstrainedWindow:(ConstrainedWindowMac*)window; |
| 208 | 213 |
| 209 // Closes the tab sheet |window| and potentially shows the next sheet in the | 214 // Closes the tab sheet |window| and potentially shows the next sheet in the |
| 210 // tab's sheet queue. | 215 // tab's sheet queue. |
| 211 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window; | 216 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window; |
| 212 | 217 |
| 213 // Implementation of the |URLDropTargetWindowController| protocol, which is | |
| 214 // needed for URL dropping on the tab strip. | |
| 215 - (void)dropURLs:(NSArray*)urls at:(NSPoint)location; | |
| 216 - (void)indicateDropURLsAt:(NSPoint)location; | |
| 217 - (void)hideDropURLsIndicator; | |
| 218 | |
| 219 @end | 218 @end |
| 220 | 219 |
| 221 // Methods which are either only for testing, or only public for testing. | 220 // Methods which are either only for testing, or only public for testing. |
| 222 @interface BrowserWindowController(TestingAPI) | 221 @interface BrowserWindowController(TestingAPI) |
| 223 | 222 |
| 224 // Put the incognito badge on the browser and adjust the tab strip | 223 // Put the incognito badge on the browser and adjust the tab strip |
| 225 // accordingly. | 224 // accordingly. |
| 226 - (void)installIncognitoBadge; | 225 - (void)installIncognitoBadge; |
| 227 | 226 |
| 228 // Allows us to initWithBrowser withOUT taking ownership of the browser. | 227 // Allows us to initWithBrowser withOUT taking ownership of the browser. |
| 229 - (id)initWithBrowser:(Browser*)browser takeOwnership:(BOOL)ownIt; | 228 - (id)initWithBrowser:(Browser*)browser takeOwnership:(BOOL)ownIt; |
| 230 | 229 |
| 231 // Adjusts the window height by the given amount. If the window spans from the | 230 // Adjusts the window height by the given amount. If the window spans from the |
| 232 // top of the current workspace to the bottom of the current workspace, the | 231 // top of the current workspace to the bottom of the current workspace, the |
| 233 // height is not adjusted. If growing the window by the requested amount would | 232 // height is not adjusted. If growing the window by the requested amount would |
| 234 // size the window to be taller than the current workspace, the window height is | 233 // size the window to be taller than the current workspace, the window height is |
| 235 // capped to be equal to the height of the current workspace. If the window is | 234 // capped to be equal to the height of the current workspace. If the window is |
| 236 // partially offscreen, its height is not adjusted at all. This function | 235 // partially offscreen, its height is not adjusted at all. This function |
| 237 // prefers to grow the window down, but will grow up if needed. Calls to this | 236 // prefers to grow the window down, but will grow up if needed. Calls to this |
| 238 // function should be followed by a call to |layoutSubviews|. | 237 // function should be followed by a call to |layoutSubviews|. |
| 239 - (void)adjustWindowHeightBy:(CGFloat)deltaH; | 238 - (void)adjustWindowHeightBy:(CGFloat)deltaH; |
| 240 | 239 |
| 241 // Return an autoreleased NSWindow suitable for fullscreen use. | 240 // Return an autoreleased NSWindow suitable for fullscreen use. |
| 242 - (NSWindow*)fullscreenWindow; | 241 - (NSWindow*)fullscreenWindow; |
| 243 | 242 |
| 244 // Return a point suitable for the topLeft for a bookmark bubble. | 243 // Return a point suitable for the topLeft for a bookmark bubble. |
| 245 - (NSPoint)topLeftForBubble; | 244 - (NSPoint)topLeftForBubble; |
| 246 | 245 |
| 247 // Return a weak pointer to the toolbar controller. | |
| 248 - (ToolbarController*)toolbarController; | |
| 249 | |
| 250 // Resets any saved state about window growth (due to showing the bookmark bar | 246 // Resets any saved state about window growth (due to showing the bookmark bar |
| 251 // or the download shelf), so that future shrinking will occur from the bottom. | 247 // or the download shelf), so that future shrinking will occur from the bottom. |
| 252 - (void)resetWindowGrowthState; | 248 - (void)resetWindowGrowthState; |
| 253 | 249 |
| 254 @end // BrowserWindowController(TestingAPI) | 250 @end // BrowserWindowController(TestingAPI) |
| 255 | 251 |
| 256 #endif // CHROME_BROWSER_COCOA_BROWSER_WINDOW_CONTROLLER_H_ | 252 #endif // CHROME_BROWSER_COCOA_BROWSER_WINDOW_CONTROLLER_H_ |
| OLD | NEW |