| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 class TabContents; | 37 class TabContents; |
| 38 class ToolbarModel; | 38 class ToolbarModel; |
| 39 | 39 |
| 40 // A controller for the toolbar in the browser window. Manages | 40 // A controller for the toolbar in the browser window. Manages |
| 41 // updating the state for location bar and back/fwd/reload/go buttons. | 41 // updating the state for location bar and back/fwd/reload/go buttons. |
| 42 // Manages the bookmark bar and its position in the window relative to | 42 // Manages the bookmark bar and its position in the window relative to |
| 43 // the web content view. | 43 // the web content view. |
| 44 | 44 |
| 45 @interface ToolbarController : NSViewController<CommandObserverProtocol, | 45 @interface ToolbarController : NSViewController<CommandObserverProtocol, |
| 46 URLDropTargetController> { | 46 URLDropTargetController> { |
| 47 @protected |
| 48 // The ordering is important for unit tests. If new items are added or the |
| 49 // ordering is changed, make sure to update |-toolbarViews| and the |
| 50 // corresponding enum in the unit tests. |
| 51 IBOutlet DelayedMenuButton* backButton_; |
| 52 IBOutlet DelayedMenuButton* forwardButton_; |
| 53 IBOutlet NSButton* reloadButton_; |
| 54 IBOutlet NSButton* homeButton_; |
| 55 IBOutlet NSButton* goButton_; |
| 56 IBOutlet MenuButton* pageButton_; |
| 57 IBOutlet MenuButton* wrenchButton_; |
| 58 IBOutlet AutocompleteTextField* locationBar_; |
| 59 IBOutlet BrowserActionsContainerView* browserActionsContainerView_; |
| 60 |
| 47 @private | 61 @private |
| 48 ToolbarModel* toolbarModel_; // weak, one per window | 62 ToolbarModel* toolbarModel_; // weak, one per window |
| 49 CommandUpdater* commands_; // weak, one per window | 63 CommandUpdater* commands_; // weak, one per window |
| 50 Profile* profile_; // weak, one per window | 64 Profile* profile_; // weak, one per window |
| 51 Browser* browser_; // weak, one per window | 65 Browser* browser_; // weak, one per window |
| 52 scoped_ptr<CommandObserverBridge> commandObserver_; | 66 scoped_ptr<CommandObserverBridge> commandObserver_; |
| 53 scoped_ptr<LocationBarViewMac> locationBarView_; | 67 scoped_ptr<LocationBarViewMac> locationBarView_; |
| 54 scoped_nsobject<AutocompleteTextFieldEditor> autocompleteTextFieldEditor_; | 68 scoped_nsobject<AutocompleteTextFieldEditor> autocompleteTextFieldEditor_; |
| 55 id<ViewResizer> resizeDelegate_; // weak | 69 id<ViewResizer> resizeDelegate_; // weak |
| 56 scoped_nsobject<BackForwardMenuController> backMenuController_; | 70 scoped_nsobject<BackForwardMenuController> backMenuController_; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 81 | 95 |
| 82 // Tracking area for mouse enter/exit/moved in the toolbar. | 96 // Tracking area for mouse enter/exit/moved in the toolbar. |
| 83 scoped_nsobject<NSTrackingArea> trackingArea_; | 97 scoped_nsobject<NSTrackingArea> trackingArea_; |
| 84 | 98 |
| 85 // We retain/release the hover button since interaction with the | 99 // We retain/release the hover button since interaction with the |
| 86 // button may make it go away (e.g. delete menu option over a | 100 // button may make it go away (e.g. delete menu option over a |
| 87 // bookmark button). Thus this variable is not weak. The | 101 // bookmark button). Thus this variable is not weak. The |
| 88 // hoveredButton_ is required to have an NSCell that responds to | 102 // hoveredButton_ is required to have an NSCell that responds to |
| 89 // setMouseInside:animate:. | 103 // setMouseInside:animate:. |
| 90 NSButton* hoveredButton_; | 104 NSButton* hoveredButton_; |
| 91 | |
| 92 // The ordering is important for unit tests. If new items are added or the | |
| 93 // ordering is changed, make sure to update |-toolbarViews| and the | |
| 94 // corresponding enum in the unit tests. | |
| 95 IBOutlet DelayedMenuButton* backButton_; | |
| 96 IBOutlet DelayedMenuButton* forwardButton_; | |
| 97 IBOutlet NSButton* reloadButton_; | |
| 98 IBOutlet NSButton* homeButton_; | |
| 99 IBOutlet NSButton* goButton_; | |
| 100 IBOutlet MenuButton* pageButton_; | |
| 101 IBOutlet MenuButton* wrenchButton_; | |
| 102 IBOutlet AutocompleteTextField* locationBar_; | |
| 103 IBOutlet BrowserActionsContainerView* browserActionsContainerView_; | |
| 104 } | 105 } |
| 105 | 106 |
| 106 // Initialize the toolbar and register for command updates. The profile is | 107 // Initialize the toolbar and register for command updates. The profile is |
| 107 // needed for initializing the location bar. The browser is needed for | 108 // needed for initializing the location bar. The browser is needed for |
| 108 // initializing the back/forward menus. | 109 // initializing the back/forward menus. |
| 109 - (id)initWithModel:(ToolbarModel*)model | 110 - (id)initWithModel:(ToolbarModel*)model |
| 110 commands:(CommandUpdater*)commands | 111 commands:(CommandUpdater*)commands |
| 111 profile:(Profile*)profile | 112 profile:(Profile*)profile |
| 112 browser:(Browser*)browser | 113 browser:(Browser*)browser |
| 113 resizeDelegate:(id<ViewResizer>)resizeDelegate; | 114 resizeDelegate:(id<ViewResizer>)resizeDelegate; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // |ToolbarView| (0 means don't show it); no-op otherwise. | 156 // |ToolbarView| (0 means don't show it); no-op otherwise. |
| 156 - (void)setDividerOpacity:(CGFloat)opacity; | 157 - (void)setDividerOpacity:(CGFloat)opacity; |
| 157 | 158 |
| 158 // Create and add the Browser Action buttons to the toolbar view. | 159 // Create and add the Browser Action buttons to the toolbar view. |
| 159 - (void)createBrowserActionButtons; | 160 - (void)createBrowserActionButtons; |
| 160 | 161 |
| 161 // Return the BrowserActionsController for this toolbar. | 162 // Return the BrowserActionsController for this toolbar. |
| 162 - (BrowserActionsController*)browserActionsController; | 163 - (BrowserActionsController*)browserActionsController; |
| 163 @end | 164 @end |
| 164 | 165 |
| 166 // A set of private methods used by subclasses. Do not call these directly |
| 167 // unless a subclass of ToolbarController. |
| 168 @interface ToolbarController(ProtectedMethods) |
| 169 // Designated initializer which takes a nib name in order to allow subclasses |
| 170 // to load a different nib file. |
| 171 - (id)initWithModel:(ToolbarModel*)model |
| 172 commands:(CommandUpdater*)commands |
| 173 profile:(Profile*)profile |
| 174 browser:(Browser*)browser |
| 175 resizeDelegate:(id<ViewResizer>)resizeDelegate |
| 176 nibFileNamed:(NSString*)nibName; |
| 177 @end |
| 178 |
| 165 // A set of private methods used by tests, in the absence of "friends" in ObjC. | 179 // A set of private methods used by tests, in the absence of "friends" in ObjC. |
| 166 @interface ToolbarController(PrivateTestMethods) | 180 @interface ToolbarController(PrivateTestMethods) |
| 167 // Returns an array of views in the order of the outlets above. | 181 // Returns an array of views in the order of the outlets above. |
| 168 - (NSArray*)toolbarViews; | 182 - (NSArray*)toolbarViews; |
| 169 - (void)showOptionalHomeButton; | 183 - (void)showOptionalHomeButton; |
| 170 - (void)showOptionalPageWrenchButtons; | 184 - (void)showOptionalPageWrenchButtons; |
| 171 // Return a hover button for the current event. | 185 // Return a hover button for the current event. |
| 172 - (NSButton*)hoverButtonForEvent:(NSEvent*)theEvent; | 186 - (NSButton*)hoverButtonForEvent:(NSEvent*)theEvent; |
| 173 @end | 187 @end |
| 174 | 188 |
| 175 #endif // CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_ | 189 #endif // CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_ |
| OLD | NEW |