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 | |
| 169 // from the current visibility, with an optional animation. | |
| 170 - (void)updateVisibility:(BOOL)visible withAnimation:(BOOL)animate; | |
| 171 | |
| 172 // Hide the back, forward, reload, home, and wrench buttons of the toolbar, | |
|
tapted
2015/10/20 06:31:08
nit: no comma after `toolbar,`. Or a new sentence,
dominickn
2015/10/26 02:53:04
Done.
| |
| 173 // so that the location bar occupies the entire width. There is no way to | |
| 174 // undo this operation, and once it is called, no other modifications to | |
| 175 // the toolbar or location bar width should be made. | |
|
tapted
2015/10/20 06:31:08
what if the window is resized?
dominickn
2015/10/26 02:53:04
That *just works*. Have updated the comment.
| |
| 176 - (void)showLocationBarOnly; | |
|
tapted
2015/10/20 06:31:09
move this declaration to `@interface ToolbarContro
dominickn
2015/10/26 02:53:04
Done.
| |
| 177 | |
| 170 // Return the BrowserActionsController for this toolbar. | 178 // Return the BrowserActionsController for this toolbar. |
| 171 - (BrowserActionsController*)browserActionsController; | 179 - (BrowserActionsController*)browserActionsController; |
| 172 | 180 |
| 173 // Returns the wrench button. | 181 // Returns the wrench button. |
| 174 - (NSButton*)wrenchButton; | 182 - (NSButton*)wrenchButton; |
| 175 | 183 |
| 176 // Returns the wrench menu controller. | 184 // Returns the wrench menu controller. |
| 177 - (WrenchMenuController*)wrenchMenuController; | 185 - (WrenchMenuController*)wrenchMenuController; |
| 178 | 186 |
| 179 @end | 187 @end |
| 180 | 188 |
| 181 // A set of private methods used by subclasses. Do not call these directly | 189 // A set of private methods used by subclasses. Do not call these directly |
|
tapted
2015/10/20 06:31:08
This comment seems out of date... (pretty sure not
dominickn
2015/10/26 02:53:04
Done.
| |
| 182 // unless a subclass of ToolbarController. | 190 // unless a subclass of ToolbarController. |
| 183 @interface ToolbarController(ProtectedMethods) | 191 @interface ToolbarController(ProtectedMethods) |
| 184 // Designated initializer which takes a nib name in order to allow subclasses | 192 // Designated initializer which takes a nib name in order to allow subclasses |
| 185 // to load a different nib file. | 193 // to load a different nib file. |
| 186 - (id)initWithCommands:(CommandUpdater*)commands | 194 - (id)initWithCommands:(CommandUpdater*)commands |
| 187 profile:(Profile*)profile | 195 profile:(Profile*)profile |
| 188 browser:(Browser*)browser | 196 browser:(Browser*)browser |
| 197 resizeDelegate:(id<ViewResizer>)resizeDelegate | |
| 189 nibFileNamed:(NSString*)nibName; | 198 nibFileNamed:(NSString*)nibName; |
| 190 @end | 199 @end |
| 191 | 200 |
| 192 // A set of private methods used by tests, in the absence of "friends" in ObjC. | 201 // A set of private methods used by tests, in the absence of "friends" in ObjC. |
| 193 @interface ToolbarController(PrivateTestMethods) | 202 @interface ToolbarController(PrivateTestMethods) |
| 194 // Returns an array of views in the order of the outlets above. | 203 // Returns an array of views in the order of the outlets above. |
| 195 - (NSArray*)toolbarViews; | 204 - (NSArray*)toolbarViews; |
| 196 - (void)showOptionalHomeButton; | 205 - (void)showOptionalHomeButton; |
| 197 - (void)installWrenchMenu; | 206 - (void)installWrenchMenu; |
| 198 // Return a hover button for the current event. | 207 // Return a hover button for the current event. |
| 199 - (NSButton*)hoverButtonForEvent:(NSEvent*)theEvent; | 208 - (NSButton*)hoverButtonForEvent:(NSEvent*)theEvent; |
| 200 @end | 209 @end |
| 201 | 210 |
| 202 #endif // CHROME_BROWSER_UI_COCOA_TOOLBAR_TOOLBAR_CONTROLLER_H_ | 211 #endif // CHROME_BROWSER_UI_COCOA_TOOLBAR_TOOLBAR_CONTROLLER_H_ |
| OLD | NEW |