| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 @interface BrowserWindowController : | 43 @interface BrowserWindowController : |
| 44 TabWindowController<NSUserInterfaceValidations, | 44 TabWindowController<NSUserInterfaceValidations, |
| 45 BookmarkURLOpener, | 45 BookmarkURLOpener, |
| 46 BookmarkBubbleControllerDelegate, | 46 BookmarkBubbleControllerDelegate, |
| 47 ViewResizer, | 47 ViewResizer, |
| 48 GTMThemeDelegate> { | 48 GTMThemeDelegate> { |
| 49 @private | 49 @private |
| 50 // The ordering of these members is important as it determines the order in | 50 // The ordering of these members is important as it determines the order in |
| 51 // which they are destroyed. |browser_| needs to be destroyed last as most of | 51 // which they are destroyed. |browser_| needs to be destroyed last as most of |
| 52 // the other objects hold weak references to it or things it owns | 52 // the other objects hold weak references to it or things it owns |
| 53 // (tab/toolbar/bookmark models, profiles, etc). We hold a strong ref to the | 53 // (tab/toolbar/bookmark models, profiles, etc). |
| 54 // window so that it will live after the NSWindowController dealloc has run | |
| 55 // (which happens *before* these scoped pointers are torn down). Keeping it | |
| 56 // alive ensures that weak view or window pointers remain valid through | |
| 57 // their destruction sequence. | |
| 58 scoped_ptr<Browser> browser_; | 54 scoped_ptr<Browser> browser_; |
| 59 scoped_nsobject<ChromeBrowserWindow> window_; | 55 NSWindow* savedRegularWindow_; |
| 60 scoped_nsobject<NSWindow> fullscreen_window_; | |
| 61 scoped_ptr<TabStripModelObserverBridge> tabObserver_; | 56 scoped_ptr<TabStripModelObserverBridge> tabObserver_; |
| 62 scoped_ptr<BrowserWindowCocoa> windowShim_; | 57 scoped_ptr<BrowserWindowCocoa> windowShim_; |
| 63 scoped_nsobject<ToolbarController> toolbarController_; | 58 scoped_nsobject<ToolbarController> toolbarController_; |
| 64 scoped_nsobject<TitlebarController> titlebarController_; | 59 scoped_nsobject<TitlebarController> titlebarController_; |
| 65 scoped_nsobject<TabStripController> tabStripController_; | 60 scoped_nsobject<TabStripController> tabStripController_; |
| 66 scoped_nsobject<FindBarCocoaController> findBarCocoaController_; | 61 scoped_nsobject<FindBarCocoaController> findBarCocoaController_; |
| 67 scoped_nsobject<InfoBarContainerController> infoBarContainerController_; | 62 scoped_nsobject<InfoBarContainerController> infoBarContainerController_; |
| 68 scoped_ptr<StatusBubbleMac> statusBubble_; | |
| 69 scoped_nsobject<DownloadShelfController> downloadShelfController_; | 63 scoped_nsobject<DownloadShelfController> downloadShelfController_; |
| 70 scoped_nsobject<ExtensionShelfController> extensionShelfController_; | 64 scoped_nsobject<ExtensionShelfController> extensionShelfController_; |
| 71 scoped_nsobject<BookmarkBarController> bookmarkBarController_; | 65 scoped_nsobject<BookmarkBarController> bookmarkBarController_; |
| 72 scoped_nsobject<BookmarkBubbleController> bookmarkBubbleController_; | 66 |
| 67 // Strong. StatusBubble is a special case of a strong reference that |
| 68 // we don't wrap in a scoped_ptr because it is acting the same |
| 69 // as an NSWindowController in that it wraps a window that must |
| 70 // be shut down before our destructors are called. |
| 71 StatusBubbleMac* statusBubble_; |
| 72 |
| 73 // Strong. We don't wrap it in scoped_nsobject because we must close |
| 74 // it appropriately in [windowWillClose:]. |
| 75 BookmarkBubbleController* bookmarkBubbleController_; |
| 73 scoped_nsobject<GTMTheme> theme_; | 76 scoped_nsobject<GTMTheme> theme_; |
| 74 BOOL ownsBrowser_; // Only ever NO when testing | 77 BOOL ownsBrowser_; // Only ever NO when testing |
| 75 BOOL fullscreen_; | |
| 76 CGFloat verticalOffsetForStatusBubble_; | 78 CGFloat verticalOffsetForStatusBubble_; |
| 77 } | 79 } |
| 78 | 80 |
| 79 // Load the browser window nib and do any Cocoa-specific initialization. | 81 // Load the browser window nib and do any Cocoa-specific initialization. |
| 80 // Takes ownership of |browser|. | 82 // Takes ownership of |browser|. |
| 81 - (id)initWithBrowser:(Browser*)browser; | 83 - (id)initWithBrowser:(Browser*)browser; |
| 82 | 84 |
| 83 // Call to make the browser go away from other places in the cross-platform | 85 // Call to make the browser go away from other places in the cross-platform |
| 84 // code. | 86 // code. |
| 85 - (void)destroyBrowser; | 87 - (void)destroyBrowser; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 178 |
| 177 // Return an autoreleased NSWindow suitable for fullscreen use. | 179 // Return an autoreleased NSWindow suitable for fullscreen use. |
| 178 - (NSWindow*)fullscreenWindow; | 180 - (NSWindow*)fullscreenWindow; |
| 179 | 181 |
| 180 // Return a point suitable for the topLeft for a bookmark bubble. | 182 // Return a point suitable for the topLeft for a bookmark bubble. |
| 181 - (NSPoint)topLeftForBubble; | 183 - (NSPoint)topLeftForBubble; |
| 182 | 184 |
| 183 @end // BrowserWindowController(TestingAPI) | 185 @end // BrowserWindowController(TestingAPI) |
| 184 | 186 |
| 185 #endif // CHROME_BROWSER_COCOA_BROWSER_WINDOW_CONTROLLER_H_ | 187 #endif // CHROME_BROWSER_COCOA_BROWSER_WINDOW_CONTROLLER_H_ |
| OLD | NEW |