Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_COCOA_TOOLBAR_TOOLBAR_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_TOOLBAR_TOOLBAR_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_TOOLBAR_TOOLBAR_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_TOOLBAR_TOOLBAR_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 // Lazily-instantiated menu controller. | 75 // Lazily-instantiated menu controller. |
| 76 base::scoped_nsobject<WrenchMenuController> wrenchMenuController_; | 76 base::scoped_nsobject<WrenchMenuController> wrenchMenuController_; |
| 77 | 77 |
| 78 // Used for monitoring the optional toolbar button prefs. | 78 // Used for monitoring the optional toolbar button prefs. |
| 79 scoped_ptr<ToolbarControllerInternal::NotificationBridge> notificationBridge_; | 79 scoped_ptr<ToolbarControllerInternal::NotificationBridge> notificationBridge_; |
| 80 BooleanPrefMember showHomeButton_; | 80 BooleanPrefMember showHomeButton_; |
| 81 BOOL hasToolbar_; // If NO, we may have only the location bar. | 81 BOOL hasToolbar_; // If NO, we may have only the location bar. |
| 82 BOOL hasLocationBar_; // If |hasToolbar_| is YES, this must also be YES. | 82 BOOL hasLocationBar_; // If |hasToolbar_| is YES, this must also be YES. |
| 83 BOOL locationBarAtMinSize_; // If the location bar is at the minimum size. | 83 BOOL locationBarAtMinSize_; // If the location bar is at the minimum size. |
| 84 | 84 |
| 85 // We have an extra retain in the locationBar_. | |
| 86 // See comments in awakeFromNib for more info. | |
| 87 base::scoped_nsobject<AutocompleteTextField> locationBarRetainer_; | |
| 88 | |
| 89 // Tracking area for mouse enter/exit/moved in the toolbar. | 85 // Tracking area for mouse enter/exit/moved in the toolbar. |
| 90 ui::ScopedCrTrackingArea trackingArea_; | 86 ui::ScopedCrTrackingArea trackingArea_; |
| 91 | 87 |
| 92 // We retain/release the hover button since interaction with the | 88 // We retain/release the hover button since interaction with the |
| 93 // button may make it go away (e.g. delete menu option over a | 89 // button may make it go away (e.g. delete menu option over a |
| 94 // bookmark button). Thus this variable is not weak. The | 90 // bookmark button). Thus this variable is not weak. The |
| 95 // hoveredButton_ is required to have an NSCell that responds to | 91 // hoveredButton_ is required to have an NSCell that responds to |
| 96 // setMouseInside:animate:. | 92 // setMouseInside:animate:. |
| 97 NSButton* hoveredButton_; | 93 NSButton* hoveredButton_; |
| 98 } | 94 } |
| 99 | 95 |
| 100 // Initialize the toolbar and register for command updates. The profile is | 96 // Initialize the toolbar and register for command updates. The profile is |
| 101 // needed for initializing the location bar. The browser is needed for | 97 // needed for initializing the location bar. The browser is needed for |
| 102 // the toolbar model and back/forward menus. | 98 // the toolbar model and back/forward menus. The resizeDelegate is used |
| 99 // to smoothly animate height changes for the toolbar. | |
| 103 - (id)initWithCommands:(CommandUpdater*)commands | 100 - (id)initWithCommands:(CommandUpdater*)commands |
| 104 profile:(Profile*)profile | 101 profile:(Profile*)profile |
| 105 browser:(Browser*)browser; | 102 browser:(Browser*)browser |
| 103 resizeDelegate:(id<ViewResizer>)resizeDelegate; | |
| 106 | 104 |
| 107 // Get the C++ bridge object representing the location bar for this tab. | 105 // Get the C++ bridge object representing the location bar for this tab. |
| 108 - (LocationBarViewMac*)locationBarBridge; | 106 - (LocationBarViewMac*)locationBarBridge; |
| 109 | 107 |
| 110 // Called by the Window delegate so we can provide a custom field editor if | 108 // Called by the Window delegate so we can provide a custom field editor if |
| 111 // needed. | 109 // needed. |
| 112 // Note that this may be called for objects unrelated to the toolbar. | 110 // Note that this may be called for objects unrelated to the toolbar. |
| 113 // returns nil if we don't want to override the custom field editor for |obj|. | 111 // returns nil if we don't want to override the custom field editor for |obj|. |
| 114 - (id)customFieldEditorForObject:(id)obj; | 112 - (id)customFieldEditorForObject:(id)obj; |
| 115 | 113 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 // Returns the desired toolbar height for the given compression factor. | 158 // Returns the desired toolbar height for the given compression factor. |
| 161 - (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight; | 159 - (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight; |
| 162 | 160 |
| 163 // Set the opacity of the divider (the line at the bottom) *if* we have a | 161 // Set the opacity of the divider (the line at the bottom) *if* we have a |
| 164 // |ToolbarView| (0 means don't show it); no-op otherwise. | 162 // |ToolbarView| (0 means don't show it); no-op otherwise. |
| 165 - (void)setDividerOpacity:(CGFloat)opacity; | 163 - (void)setDividerOpacity:(CGFloat)opacity; |
| 166 | 164 |
| 167 // Create and add the Browser Action buttons to the toolbar view. | 165 // Create and add the Browser Action buttons to the toolbar view. |
| 168 - (void)createBrowserActionButtons; | 166 - (void)createBrowserActionButtons; |
| 169 | 167 |
| 168 // Updates the visibility of the toolbar if the requested visibility differs | |
|
tapted
2015/10/26 23:48:08
nit: remove "if the requested visibility differs f
dominickn
2015/10/27 00:15:17
Done.
| |
| 169 // from the current visibility, with an optional animation. | |
| 170 - (void)updateVisibility:(BOOL)visible withAnimation:(BOOL)animate; | |
| 171 | |
| 170 // Return the BrowserActionsController for this toolbar. | 172 // Return the BrowserActionsController for this toolbar. |
| 171 - (BrowserActionsController*)browserActionsController; | 173 - (BrowserActionsController*)browserActionsController; |
| 172 | 174 |
| 173 // Returns the wrench button. | 175 // Returns the wrench button. |
| 174 - (NSButton*)wrenchButton; | 176 - (NSButton*)wrenchButton; |
| 175 | 177 |
| 176 // Returns the wrench menu controller. | 178 // Returns the wrench menu controller. |
| 177 - (WrenchMenuController*)wrenchMenuController; | 179 - (WrenchMenuController*)wrenchMenuController; |
| 178 | 180 |
| 179 @end | 181 @end |
| 180 | 182 |
| 181 // A set of private methods used by subclasses. Do not call these directly | |
| 182 // unless a subclass of ToolbarController. | |
| 183 @interface ToolbarController(ProtectedMethods) | |
| 184 // Designated initializer which takes a nib name in order to allow subclasses | |
| 185 // to load a different nib file. | |
| 186 - (id)initWithCommands:(CommandUpdater*)commands | |
| 187 profile:(Profile*)profile | |
| 188 browser:(Browser*)browser | |
| 189 nibFileNamed:(NSString*)nibName; | |
| 190 @end | |
| 191 | |
| 192 // A set of private methods used by tests, in the absence of "friends" in ObjC. | 183 // A set of private methods used by tests, in the absence of "friends" in ObjC. |
| 193 @interface ToolbarController(PrivateTestMethods) | 184 @interface ToolbarController(PrivateTestMethods) |
| 194 // Returns an array of views in the order of the outlets above. | 185 // Returns an array of views in the order of the outlets above. |
| 195 - (NSArray*)toolbarViews; | 186 - (NSArray*)toolbarViews; |
| 196 - (void)showOptionalHomeButton; | 187 - (void)showOptionalHomeButton; |
| 197 - (void)installWrenchMenu; | 188 - (void)installWrenchMenu; |
| 198 // Return a hover button for the current event. | 189 // Return a hover button for the current event. |
| 199 - (NSButton*)hoverButtonForEvent:(NSEvent*)theEvent; | 190 - (NSButton*)hoverButtonForEvent:(NSEvent*)theEvent; |
| 200 @end | 191 @end |
| 201 | 192 |
| 202 #endif // CHROME_BROWSER_UI_COCOA_TOOLBAR_TOOLBAR_CONTROLLER_H_ | 193 #endif // CHROME_BROWSER_UI_COCOA_TOOLBAR_TOOLBAR_CONTROLLER_H_ |
| OLD | NEW |