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. |
|
tapted
2015/10/16 00:06:16
nit: update comment here
dominickn
2015/10/20 04:40:21
Done.
| |
| 103 - (id)initWithCommands:(CommandUpdater*)commands | 99 - (id)initWithCommands:(CommandUpdater*)commands |
| 104 profile:(Profile*)profile | 100 profile:(Profile*)profile |
| 105 browser:(Browser*)browser; | 101 browser:(Browser*)browser |
| 102 resizeDelegate:(id<ViewResizer>)resizeDelegate; | |
| 106 | 103 |
| 107 // Get the C++ bridge object representing the location bar for this tab. | 104 // Get the C++ bridge object representing the location bar for this tab. |
| 108 - (LocationBarViewMac*)locationBarBridge; | 105 - (LocationBarViewMac*)locationBarBridge; |
| 109 | 106 |
| 110 // Called by the Window delegate so we can provide a custom field editor if | 107 // Called by the Window delegate so we can provide a custom field editor if |
| 111 // needed. | 108 // needed. |
| 112 // Note that this may be called for objects unrelated to the toolbar. | 109 // 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|. | 110 // returns nil if we don't want to override the custom field editor for |obj|. |
| 114 - (id)customFieldEditorForObject:(id)obj; | 111 - (id)customFieldEditorForObject:(id)obj; |
| 115 | 112 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 // Returns the desired toolbar height for the given compression factor. | 157 // Returns the desired toolbar height for the given compression factor. |
| 161 - (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight; | 158 - (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight; |
| 162 | 159 |
| 163 // Set the opacity of the divider (the line at the bottom) *if* we have a | 160 // 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. | 161 // |ToolbarView| (0 means don't show it); no-op otherwise. |
| 165 - (void)setDividerOpacity:(CGFloat)opacity; | 162 - (void)setDividerOpacity:(CGFloat)opacity; |
| 166 | 163 |
| 167 // Create and add the Browser Action buttons to the toolbar view. | 164 // Create and add the Browser Action buttons to the toolbar view. |
| 168 - (void)createBrowserActionButtons; | 165 - (void)createBrowserActionButtons; |
| 169 | 166 |
| 167 // Updates the visibility of the toolbar if the requested visibility differs | |
| 168 // from the current visibility, with an optional animation. | |
| 169 - (void)updateVisibility:(BOOL)visible withAnimation:(BOOL)animate; | |
| 170 | |
| 171 // Hide the back, forward, reload, home, and wrench buttons of the toolbar, | |
| 172 // so that the location bar occupies the entire width. | |
| 173 - (void)shouldHideToolbarButtons:(BOOL)hide; | |
| 174 | |
| 170 // Return the BrowserActionsController for this toolbar. | 175 // Return the BrowserActionsController for this toolbar. |
| 171 - (BrowserActionsController*)browserActionsController; | 176 - (BrowserActionsController*)browserActionsController; |
| 172 | 177 |
| 173 // Returns the wrench button. | 178 // Returns the wrench button. |
| 174 - (NSButton*)wrenchButton; | 179 - (NSButton*)wrenchButton; |
| 175 | 180 |
| 176 // Returns the wrench menu controller. | 181 // Returns the wrench menu controller. |
| 177 - (WrenchMenuController*)wrenchMenuController; | 182 - (WrenchMenuController*)wrenchMenuController; |
| 178 | 183 |
| 179 @end | 184 @end |
| 180 | 185 |
| 181 // A set of private methods used by subclasses. Do not call these directly | 186 // A set of private methods used by subclasses. Do not call these directly |
| 182 // unless a subclass of ToolbarController. | 187 // unless a subclass of ToolbarController. |
| 183 @interface ToolbarController(ProtectedMethods) | 188 @interface ToolbarController(ProtectedMethods) |
| 184 // Designated initializer which takes a nib name in order to allow subclasses | 189 // Designated initializer which takes a nib name in order to allow subclasses |
| 185 // to load a different nib file. | 190 // to load a different nib file. |
| 186 - (id)initWithCommands:(CommandUpdater*)commands | 191 - (id)initWithCommands:(CommandUpdater*)commands |
| 187 profile:(Profile*)profile | 192 profile:(Profile*)profile |
| 188 browser:(Browser*)browser | 193 browser:(Browser*)browser |
| 194 resizeDelegate:(id<ViewResizer>)resizeDelegate | |
| 189 nibFileNamed:(NSString*)nibName; | 195 nibFileNamed:(NSString*)nibName; |
| 190 @end | 196 @end |
| 191 | 197 |
| 192 // A set of private methods used by tests, in the absence of "friends" in ObjC. | 198 // A set of private methods used by tests, in the absence of "friends" in ObjC. |
| 193 @interface ToolbarController(PrivateTestMethods) | 199 @interface ToolbarController(PrivateTestMethods) |
| 194 // Returns an array of views in the order of the outlets above. | 200 // Returns an array of views in the order of the outlets above. |
| 195 - (NSArray*)toolbarViews; | 201 - (NSArray*)toolbarViews; |
| 196 - (void)showOptionalHomeButton; | 202 - (void)showOptionalHomeButton; |
| 197 - (void)installWrenchMenu; | 203 - (void)installWrenchMenu; |
| 198 // Return a hover button for the current event. | 204 // Return a hover button for the current event. |
| 199 - (NSButton*)hoverButtonForEvent:(NSEvent*)theEvent; | 205 - (NSButton*)hoverButtonForEvent:(NSEvent*)theEvent; |
| 200 @end | 206 @end |
| 201 | 207 |
| 202 #endif // CHROME_BROWSER_UI_COCOA_TOOLBAR_TOOLBAR_CONTROLLER_H_ | 208 #endif // CHROME_BROWSER_UI_COCOA_TOOLBAR_TOOLBAR_CONTROLLER_H_ |
| OLD | NEW |