| 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 object. Handles | 8 // A class acting as the Objective-C controller for the Browser object. Handles |
| 9 // interactions between Cocoa and the cross-platform code. Each window has a | 9 // interactions between Cocoa and the cross-platform code. Each window has a |
| 10 // single set of toolbars (main toolbar, bookmark bar, etc) and, by virtue of | 10 // single set of toolbars (main toolbar, bookmark bar, etc) and, by virtue of |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // The ordering of these members is important as it determines the order in | 37 // The ordering of these members is important as it determines the order in |
| 38 // which they are destroyed. |browser_| needs to be destroyed last as most of | 38 // which they are destroyed. |browser_| needs to be destroyed last as most of |
| 39 // the other objects hold weak references to it or things it owns | 39 // the other objects hold weak references to it or things it owns |
| 40 // (tab/toolbar/bookmark models, profiles, etc). We hold a strong ref to the | 40 // (tab/toolbar/bookmark models, profiles, etc). We hold a strong ref to the |
| 41 // window so that it will live after the NSWindowController dealloc has run | 41 // window so that it will live after the NSWindowController dealloc has run |
| 42 // (which happens *before* these scoped pointers are torn down). Keeping it | 42 // (which happens *before* these scoped pointers are torn down). Keeping it |
| 43 // alive ensures that weak view or window pointers remain valid through | 43 // alive ensures that weak view or window pointers remain valid through |
| 44 // their destruction sequence. | 44 // their destruction sequence. |
| 45 scoped_ptr<Browser> browser_; | 45 scoped_ptr<Browser> browser_; |
| 46 scoped_nsobject<NSWindow> window_; | 46 scoped_nsobject<NSWindow> window_; |
| 47 scoped_nsobject<NSWindow> fullscreen_window_; |
| 47 scoped_ptr<TabStripModelObserverBridge> tabObserver_; | 48 scoped_ptr<TabStripModelObserverBridge> tabObserver_; |
| 48 scoped_ptr<BrowserWindowCocoa> windowShim_; | 49 scoped_ptr<BrowserWindowCocoa> windowShim_; |
| 49 scoped_nsobject<ToolbarController> toolbarController_; | 50 scoped_nsobject<ToolbarController> toolbarController_; |
| 50 scoped_nsobject<BookmarkBarController> bookmarkBarController_; | 51 scoped_nsobject<BookmarkBarController> bookmarkBarController_; |
| 51 scoped_nsobject<TabStripController> tabStripController_; | 52 scoped_nsobject<TabStripController> tabStripController_; |
| 52 scoped_nsobject<FindBarCocoaController> findBarCocoaController_; | 53 scoped_nsobject<FindBarCocoaController> findBarCocoaController_; |
| 53 scoped_ptr<StatusBubble> statusBubble_; | 54 scoped_ptr<StatusBubble> statusBubble_; |
| 54 scoped_nsobject<DownloadShelfController> downloadShelfController_; | 55 scoped_nsobject<DownloadShelfController> downloadShelfController_; |
| 55 BOOL ownsBrowser_; // Only ever NO when testing | 56 BOOL ownsBrowser_; // Only ever NO when testing |
| 57 BOOL fullscreen_; |
| 56 } | 58 } |
| 57 | 59 |
| 58 // Load the browser window nib and do any Cocoa-specific initialization. | 60 // Load the browser window nib and do any Cocoa-specific initialization. |
| 59 // Takes ownership of |browser|. | 61 // Takes ownership of |browser|. |
| 60 - (id)initWithBrowser:(Browser*)browser; | 62 - (id)initWithBrowser:(Browser*)browser; |
| 61 | 63 |
| 62 // Call to make the browser go away from other places in the cross-platform | 64 // Call to make the browser go away from other places in the cross-platform |
| 63 // code. | 65 // code. |
| 64 - (void)destroyBrowser; | 66 - (void)destroyBrowser; |
| 65 | 67 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 - (BOOL)isDownloadShelfVisible; | 104 - (BOOL)isDownloadShelfVisible; |
| 103 | 105 |
| 104 // Lazily creates the download shelf in visible state if it doesn't exist yet. | 106 // Lazily creates the download shelf in visible state if it doesn't exist yet. |
| 105 - (DownloadShelfController*)downloadShelf; | 107 - (DownloadShelfController*)downloadShelf; |
| 106 | 108 |
| 107 // Retains the given FindBarCocoaController and adds its view to this | 109 // Retains the given FindBarCocoaController and adds its view to this |
| 108 // browser window. Must only be called once per | 110 // browser window. Must only be called once per |
| 109 // BrowserWindowController. | 111 // BrowserWindowController. |
| 110 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController; | 112 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController; |
| 111 | 113 |
| 114 // Enters (or exits) fullscreen mode. |
| 115 - (void)setFullscreen:(BOOL)fullscreen; |
| 116 |
| 117 // Returns fullscreen state. |
| 118 - (BOOL)isFullscreen; |
| 119 |
| 112 @end | 120 @end |
| 113 | 121 |
| 114 | 122 |
| 115 @interface BrowserWindowController(TestingAPI) | 123 @interface BrowserWindowController(TestingAPI) |
| 116 | 124 |
| 117 // Allows us to initWithBrowser withOUT taking ownership of the browser. | 125 // Allows us to initWithBrowser withOUT taking ownership of the browser. |
| 118 - (id)initWithBrowser:(Browser*)browser takeOwnership:(BOOL)ownIt; | 126 - (id)initWithBrowser:(Browser*)browser takeOwnership:(BOOL)ownIt; |
| 119 | 127 |
| 128 // Return an autoreleased NSWindow suitable for fullscreen use. |
| 129 - (NSWindow*)fullscreenWindow; |
| 130 |
| 120 @end // BrowserWindowController(TestingAPI) | 131 @end // BrowserWindowController(TestingAPI) |
| 121 | 132 |
| 122 #endif // CHROME_BROWSER_COCOA_BROWSER_WINDOW_CONTROLLER_H_ | 133 #endif // CHROME_BROWSER_COCOA_BROWSER_WINDOW_CONTROLLER_H_ |
| OLD | NEW |