Chromium Code Reviews| 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 |
| 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/scoped_nsobject.h" | 15 #include "base/scoped_nsobject.h" |
| 16 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
| 17 #import "chrome/browser/cocoa/tab_window_controller.h" | 17 #import "chrome/browser/cocoa/tab_window_controller.h" |
| 18 #import "chrome/browser/cocoa/bookmark_bar_controller.h" | 18 #import "chrome/browser/cocoa/bookmark_bar_controller.h" |
| 19 #import "chrome/browser/cocoa/bookmark_bubble_controller.h" | 19 #import "chrome/browser/cocoa/bookmark_bubble_controller.h" |
| 20 #import "chrome/browser/cocoa/browser_command_executor.h" | 20 #import "chrome/browser/cocoa/browser_command_executor.h" |
| 21 #import "chrome/browser/cocoa/url_drop_target.h" | |
| 21 #import "chrome/browser/cocoa/view_resizer.h" | 22 #import "chrome/browser/cocoa/view_resizer.h" |
| 22 #include "chrome/browser/sync/sync_ui_util.h" | 23 #include "chrome/browser/sync/sync_ui_util.h" |
| 23 #import "third_party/GTM/AppKit/GTMTheme.h" | 24 #import "third_party/GTM/AppKit/GTMTheme.h" |
| 24 | 25 |
| 25 class Browser; | 26 class Browser; |
| 26 class BrowserWindow; | 27 class BrowserWindow; |
| 27 class BrowserWindowCocoa; | 28 class BrowserWindowCocoa; |
| 28 @class ChromeBrowserWindow; | 29 @class ChromeBrowserWindow; |
| 29 class ConstrainedWindowMac; | 30 class ConstrainedWindowMac; |
| 30 @class DownloadShelfController; | 31 @class DownloadShelfController; |
| 31 @class ExtensionShelfController; | 32 @class ExtensionShelfController; |
| 32 @class FindBarCocoaController; | 33 @class FindBarCocoaController; |
| 33 @class GTMWindowSheetController; | 34 @class GTMWindowSheetController; |
| 34 @class InfoBarContainerController; | 35 @class InfoBarContainerController; |
| 35 class LocationBar; | 36 class LocationBar; |
| 36 class StatusBubbleMac; | 37 class StatusBubbleMac; |
| 37 class TabContents; | 38 class TabContents; |
| 38 @class TabContentsController; | 39 @class TabContentsController; |
| 39 @class TabStripController; | 40 @class TabStripController; |
| 40 class TabStripModelObserverBridge; | 41 class TabStripModelObserverBridge; |
| 41 @class TabStripView; | 42 @class TabStripView; |
| 42 @class ToolbarController; | 43 @class ToolbarController; |
| 43 @class TitlebarController; | 44 @class TitlebarController; |
| 44 | 45 |
| 45 @interface BrowserWindowController : | 46 @interface BrowserWindowController : |
| 46 TabWindowController<NSUserInterfaceValidations, | 47 TabWindowController<NSUserInterfaceValidations, |
| 47 BookmarkBarControllerDelegate, | 48 BookmarkBarControllerDelegate, |
| 48 BrowserCommandExecutor, | 49 BrowserCommandExecutor, |
| 49 ViewResizer, | 50 ViewResizer, |
| 50 GTMThemeDelegate> { | 51 GTMThemeDelegate, |
| 52 URLDropTargetWindowController> { | |
|
pink (ping after 24hrs)
2009/12/07 15:42:02
crud, i wish i had seen this before you checked it
viettrungluu
2009/12/07 15:52:21
I had a previous version which passed it down the
| |
| 51 @private | 53 @private |
| 52 // The ordering of these members is important as it determines the order in | 54 // The ordering of these members is important as it determines the order in |
| 53 // which they are destroyed. |browser_| needs to be destroyed last as most of | 55 // which they are destroyed. |browser_| needs to be destroyed last as most of |
| 54 // the other objects hold weak references to it or things it owns | 56 // the other objects hold weak references to it or things it owns |
| 55 // (tab/toolbar/bookmark models, profiles, etc). | 57 // (tab/toolbar/bookmark models, profiles, etc). |
| 56 scoped_ptr<Browser> browser_; | 58 scoped_ptr<Browser> browser_; |
| 57 NSWindow* savedRegularWindow_; | 59 NSWindow* savedRegularWindow_; |
| 58 scoped_ptr<TabStripModelObserverBridge> tabObserver_; | 60 scoped_ptr<TabStripModelObserverBridge> tabObserver_; |
| 59 scoped_ptr<BrowserWindowCocoa> windowShim_; | 61 scoped_ptr<BrowserWindowCocoa> windowShim_; |
| 60 scoped_nsobject<ToolbarController> toolbarController_; | 62 scoped_nsobject<ToolbarController> toolbarController_; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 // Returns YES if the window became the active per-tab sheet of the current tab, | 178 // Returns YES if the window became the active per-tab sheet of the current tab, |
| 177 // or NO if the current tab already has a per-tab sheet. If this returns NO, | 179 // or NO if the current tab already has a per-tab sheet. If this returns NO, |
| 178 // the window's |Realize()| method will be called again when the curren sheet | 180 // the window's |Realize()| method will be called again when the curren sheet |
| 179 // disappears. The window should then call |attachConstrainedWindow:| again. | 181 // disappears. The window should then call |attachConstrainedWindow:| again. |
| 180 - (BOOL)attachConstrainedWindow:(ConstrainedWindowMac*)window; | 182 - (BOOL)attachConstrainedWindow:(ConstrainedWindowMac*)window; |
| 181 | 183 |
| 182 // Closes the tab sheet |window| and potentially shows the next sheet in the | 184 // Closes the tab sheet |window| and potentially shows the next sheet in the |
| 183 // tab's sheet queue. | 185 // tab's sheet queue. |
| 184 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window; | 186 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window; |
| 185 | 187 |
| 188 // Implementation of the |URLDropTargetWindowController| protocol, which is | |
| 189 // needed for URL dropping on the tab strip. | |
| 190 - (void)dropURLs:(NSArray*)urls at:(NSPoint)location; | |
| 191 - (void)indicateDropURLsAt:(NSPoint)location; | |
| 192 - (void)hideDropURLsIndicator; | |
| 193 | |
| 186 @end | 194 @end |
| 187 | 195 |
| 188 // Methods which are either only for testing, or only public for testing. | 196 // Methods which are either only for testing, or only public for testing. |
| 189 @interface BrowserWindowController(TestingAPI) | 197 @interface BrowserWindowController(TestingAPI) |
| 190 | 198 |
| 191 // Put the incognito badge on the browser and adjust the tab strip | 199 // Put the incognito badge on the browser and adjust the tab strip |
| 192 // accordingly. | 200 // accordingly. |
| 193 - (void)installIncognitoBadge; | 201 - (void)installIncognitoBadge; |
| 194 | 202 |
| 195 // Allows us to initWithBrowser withOUT taking ownership of the browser. | 203 // Allows us to initWithBrowser withOUT taking ownership of the browser. |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 211 // Return a point suitable for the topLeft for a bookmark bubble. | 219 // Return a point suitable for the topLeft for a bookmark bubble. |
| 212 - (NSPoint)topLeftForBubble; | 220 - (NSPoint)topLeftForBubble; |
| 213 | 221 |
| 214 // Resets any saved state about window growth (due to showing the bookmark bar | 222 // Resets any saved state about window growth (due to showing the bookmark bar |
| 215 // or the download shelf), so that future shrinking will occur from the bottom. | 223 // or the download shelf), so that future shrinking will occur from the bottom. |
| 216 - (void)resetWindowGrowthState; | 224 - (void)resetWindowGrowthState; |
| 217 | 225 |
| 218 @end // BrowserWindowController(TestingAPI) | 226 @end // BrowserWindowController(TestingAPI) |
| 219 | 227 |
| 220 #endif // CHROME_BROWSER_COCOA_BROWSER_WINDOW_CONTROLLER_H_ | 228 #endif // CHROME_BROWSER_COCOA_BROWSER_WINDOW_CONTROLLER_H_ |
| OLD | NEW |