| 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_TOOLBAR_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_ | 6 #define CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "base/scoped_nsobject.h" | 11 #include "base/scoped_nsobject.h" |
| 12 #import "chrome/browser/cocoa/command_observer_bridge.h" | 12 #import "chrome/browser/cocoa/command_observer_bridge.h" |
| 13 #import "chrome/browser/cocoa/delayedmenu_button.h" | 13 #import "chrome/browser/cocoa/delayedmenu_button.h" |
| 14 #import "chrome/browser/cocoa/view_resizer.h" | 14 #import "chrome/browser/cocoa/view_resizer.h" |
| 15 #include "chrome/common/pref_member.h" | 15 #include "chrome/common/pref_member.h" |
| 16 | 16 |
| 17 @class AutocompleteTextField; | 17 @class AutocompleteTextField; |
| 18 @class AutocompleteTextFieldEditor; | 18 @class AutocompleteTextFieldEditor; |
| 19 @class BackForwardMenuController; | 19 @class BackForwardMenuController; |
| 20 class Browser; | 20 class Browser; |
| 21 @class BrowserActionsController; | 21 @class BrowserActionsController; |
| 22 class BubblePositioner; | 22 class BubblePositioner; |
| 23 class CommandUpdater; | 23 class CommandUpdater; |
| 24 @class DelayedMenuButton; | 24 @class DelayedMenuButton; |
| 25 class LocationBar; | 25 class LocationBar; |
| 26 class LocationBarViewMac; | 26 class LocationBarViewMac; |
| 27 @class MenuButton; | 27 @class MenuButton; |
| 28 @class MenuController; |
| 29 class PageMenuModel; |
| 28 namespace ToolbarControllerInternal { | 30 namespace ToolbarControllerInternal { |
| 31 class MenuDelegate; |
| 29 class PrefObserverBridge; | 32 class PrefObserverBridge; |
| 30 } | 33 } |
| 31 class Profile; | 34 class Profile; |
| 32 class TabContents; | 35 class TabContents; |
| 33 class ToolbarModel; | 36 class ToolbarModel; |
| 34 | 37 |
| 35 // A controller for the toolbar in the browser window. Manages | 38 // A controller for the toolbar in the browser window. Manages |
| 36 // updating the state for location bar and back/fwd/reload/go buttons. | 39 // updating the state for location bar and back/fwd/reload/go buttons. |
| 37 // Manages the bookmark bar and its position in the window relative to | 40 // Manages the bookmark bar and its position in the window relative to |
| 38 // the web content view. | 41 // the web content view. |
| 39 | 42 |
| 40 @interface ToolbarController : | 43 @interface ToolbarController : |
| 41 NSViewController<CommandObserverProtocol> { | 44 NSViewController<CommandObserverProtocol> { |
| 42 @private | 45 @private |
| 43 ToolbarModel* toolbarModel_; // weak, one per window | 46 ToolbarModel* toolbarModel_; // weak, one per window |
| 44 CommandUpdater* commands_; // weak, one per window | 47 CommandUpdater* commands_; // weak, one per window |
| 45 Profile* profile_; // weak, one per window | 48 Profile* profile_; // weak, one per window |
| 46 Browser* browser_; // weak, one per window | 49 Browser* browser_; // weak, one per window |
| 47 scoped_ptr<CommandObserverBridge> commandObserver_; | 50 scoped_ptr<CommandObserverBridge> commandObserver_; |
| 48 scoped_ptr<LocationBarViewMac> locationBarView_; | 51 scoped_ptr<LocationBarViewMac> locationBarView_; |
| 49 scoped_nsobject<AutocompleteTextFieldEditor> autocompleteTextFieldEditor_; | 52 scoped_nsobject<AutocompleteTextFieldEditor> autocompleteTextFieldEditor_; |
| 50 id<ViewResizer> resizeDelegate_; // weak | 53 id<ViewResizer> resizeDelegate_; // weak |
| 51 scoped_nsobject<BackForwardMenuController> backMenuController_; | 54 scoped_nsobject<BackForwardMenuController> backMenuController_; |
| 52 scoped_nsobject<BackForwardMenuController> forwardMenuController_; | 55 scoped_nsobject<BackForwardMenuController> forwardMenuController_; |
| 53 scoped_nsobject<BrowserActionsController> browserActionsController_; | 56 scoped_nsobject<BrowserActionsController> browserActionsController_; |
| 54 | 57 |
| 58 // Lazily-instantiated model, controller, and delegate for the menu on the |
| 59 // page button. If it's visible, these will be non-null, but they are not |
| 60 // reaped when the button is hidden once it is initially shown. |
| 61 scoped_ptr<PageMenuModel> pageMenuModel_; |
| 62 scoped_nsobject<MenuController> pageMenuController_; |
| 63 scoped_ptr<ToolbarControllerInternal::MenuDelegate> pageMenuDelegate_; |
| 64 |
| 55 // Used for monitoring the optional toolbar button prefs. | 65 // Used for monitoring the optional toolbar button prefs. |
| 56 scoped_ptr<ToolbarControllerInternal::PrefObserverBridge> prefObserver_; | 66 scoped_ptr<ToolbarControllerInternal::PrefObserverBridge> prefObserver_; |
| 57 // Used to position the omnibox bubble. | 67 // Used to position the omnibox bubble. |
| 58 scoped_ptr<BubblePositioner> bubblePositioner_; | 68 scoped_ptr<BubblePositioner> bubblePositioner_; |
| 59 BooleanPrefMember showHomeButton_; | 69 BooleanPrefMember showHomeButton_; |
| 60 BooleanPrefMember showPageOptionButtons_; | 70 BooleanPrefMember showPageOptionButtons_; |
| 61 BOOL hasToolbar_; // if NO, we only have the location bar. | 71 BOOL hasToolbar_; // if NO, we only have the location bar. |
| 62 | 72 |
| 63 // We have an extra retain in the locationBar_. | 73 // We have an extra retain in the locationBar_. |
| 64 // See comments in awakeFromNib for more info. | 74 // See comments in awakeFromNib for more info. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 79 // corresponding enum in the unit tests. | 89 // corresponding enum in the unit tests. |
| 80 IBOutlet DelayedMenuButton* backButton_; | 90 IBOutlet DelayedMenuButton* backButton_; |
| 81 IBOutlet DelayedMenuButton* forwardButton_; | 91 IBOutlet DelayedMenuButton* forwardButton_; |
| 82 IBOutlet NSButton* reloadButton_; | 92 IBOutlet NSButton* reloadButton_; |
| 83 IBOutlet NSButton* homeButton_; | 93 IBOutlet NSButton* homeButton_; |
| 84 IBOutlet NSButton* starButton_; | 94 IBOutlet NSButton* starButton_; |
| 85 IBOutlet NSButton* goButton_; | 95 IBOutlet NSButton* goButton_; |
| 86 IBOutlet MenuButton* pageButton_; | 96 IBOutlet MenuButton* pageButton_; |
| 87 IBOutlet MenuButton* wrenchButton_; | 97 IBOutlet MenuButton* wrenchButton_; |
| 88 IBOutlet AutocompleteTextField* locationBar_; | 98 IBOutlet AutocompleteTextField* locationBar_; |
| 89 IBOutlet NSMenu* encodingMenu_; | |
| 90 IBOutlet NSView* browserActionContainerView_; | 99 IBOutlet NSView* browserActionContainerView_; |
| 91 } | 100 } |
| 92 | 101 |
| 93 // Initialize the toolbar and register for command updates. The profile is | 102 // Initialize the toolbar and register for command updates. The profile is |
| 94 // needed for initializing the location bar. The browser is needed for | 103 // needed for initializing the location bar. The browser is needed for |
| 95 // initializing the back/forward menus. | 104 // initializing the back/forward menus. |
| 96 - (id)initWithModel:(ToolbarModel*)model | 105 - (id)initWithModel:(ToolbarModel*)model |
| 97 commands:(CommandUpdater*)commands | 106 commands:(CommandUpdater*)commands |
| 98 profile:(Profile*)profile | 107 profile:(Profile*)profile |
| 99 browser:(Browser*)browser | 108 browser:(Browser*)browser |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 // Returns an array of views in the order of the outlets above. | 157 // Returns an array of views in the order of the outlets above. |
| 149 - (NSArray*)toolbarViews; | 158 - (NSArray*)toolbarViews; |
| 150 - (void)showOptionalHomeButton; | 159 - (void)showOptionalHomeButton; |
| 151 - (void)showOptionalPageWrenchButtons; | 160 - (void)showOptionalPageWrenchButtons; |
| 152 - (gfx::Rect)locationStackBounds; | 161 - (gfx::Rect)locationStackBounds; |
| 153 // Return a hover button for the current event. | 162 // Return a hover button for the current event. |
| 154 - (NSButton*)hoverButtonForEvent:(NSEvent*)theEvent; | 163 - (NSButton*)hoverButtonForEvent:(NSEvent*)theEvent; |
| 155 @end | 164 @end |
| 156 | 165 |
| 157 #endif // CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_ | 166 #endif // CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_ |
| OLD | NEW |