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" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 scoped_ptr<ToolbarControllerInternal::MenuDelegate> menuDelegate_; | 65 scoped_ptr<ToolbarControllerInternal::MenuDelegate> menuDelegate_; |
66 scoped_ptr<AppMenuModel> appMenuModel_; | 66 scoped_ptr<AppMenuModel> appMenuModel_; |
67 scoped_nsobject<MenuController> appMenuController_; | 67 scoped_nsobject<MenuController> appMenuController_; |
68 | 68 |
69 // Used for monitoring the optional toolbar button prefs. | 69 // Used for monitoring the optional toolbar button prefs. |
70 scoped_ptr<ToolbarControllerInternal::PrefObserverBridge> prefObserver_; | 70 scoped_ptr<ToolbarControllerInternal::PrefObserverBridge> prefObserver_; |
71 // Used to position the omnibox bubble. | 71 // Used to position the omnibox bubble. |
72 scoped_ptr<BubblePositioner> bubblePositioner_; | 72 scoped_ptr<BubblePositioner> bubblePositioner_; |
73 BooleanPrefMember showHomeButton_; | 73 BooleanPrefMember showHomeButton_; |
74 BooleanPrefMember showPageOptionButtons_; | 74 BooleanPrefMember showPageOptionButtons_; |
75 BOOL hasToolbar_; // if NO, we only have the location bar. | 75 BOOL hasToolbar_; // If NO, we may have only the location bar. |
| 76 BOOL hasLocationBar_; // If |hasToolbar_| is YES, this must also be YES. |
76 | 77 |
77 // We have an extra retain in the locationBar_. | 78 // We have an extra retain in the locationBar_. |
78 // See comments in awakeFromNib for more info. | 79 // See comments in awakeFromNib for more info. |
79 scoped_nsobject<AutocompleteTextField> locationBarRetainer_; | 80 scoped_nsobject<AutocompleteTextField> locationBarRetainer_; |
80 | 81 |
81 // Tracking area for mouse enter/exit/moved in the toolbar. | 82 // Tracking area for mouse enter/exit/moved in the toolbar. |
82 scoped_nsobject<NSTrackingArea> trackingArea_; | 83 scoped_nsobject<NSTrackingArea> trackingArea_; |
83 | 84 |
84 // We retain/release the hover button since interaction with the | 85 // We retain/release the hover button since interaction with the |
85 // button may make it go away (e.g. delete menu option over a | 86 // button may make it go away (e.g. delete menu option over a |
(...skipping 20 matching lines...) Expand all Loading... |
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; |
114 | 115 |
115 // Get the C++ bridge object representing the location bar for this tab. | 116 // Get the C++ bridge object representing the location bar for this tab. |
116 - (LocationBar*)locationBar; | 117 - (LocationBar*)locationBarBridge; |
117 | 118 |
118 // Called by the Window delegate so we can provide a custom field editor if | 119 // Called by the Window delegate so we can provide a custom field editor if |
119 // needed. | 120 // needed. |
120 // Note that this may be called for objects unrelated to the toolbar. | 121 // Note that this may be called for objects unrelated to the toolbar. |
121 // returns nil if we don't want to override the custom field editor for |obj|. | 122 // returns nil if we don't want to override the custom field editor for |obj|. |
122 - (id)customFieldEditorForObject:(id)obj; | 123 - (id)customFieldEditorForObject:(id)obj; |
123 | 124 |
124 // Make the location bar the first responder, if possible. | 125 // Make the location bar the first responder, if possible. |
125 - (void)focusLocationBar; | 126 - (void)focusLocationBar; |
126 | 127 |
127 // Updates the toolbar (and transitively the location bar) with the states of | 128 // Updates the toolbar (and transitively the location bar) with the states of |
128 // the specified |tab|. If |shouldRestore| is true, we're switching | 129 // the specified |tab|. If |shouldRestore| is true, we're switching |
129 // (back?) to this tab and should restore any previous location bar state | 130 // (back?) to this tab and should restore any previous location bar state |
130 // (such as user editing) as well. | 131 // (such as user editing) as well. |
131 - (void)updateToolbarWithContents:(TabContents*)tabForRestoring | 132 - (void)updateToolbarWithContents:(TabContents*)tabForRestoring |
132 shouldRestoreState:(BOOL)shouldRestore; | 133 shouldRestoreState:(BOOL)shouldRestore; |
133 | 134 |
134 // Sets whether or not the current page in the frontmost tab is bookmarked. | 135 // Sets whether or not the current page in the frontmost tab is bookmarked. |
135 - (void)setStarredState:(BOOL)isStarred; | 136 - (void)setStarredState:(BOOL)isStarred; |
136 | 137 |
137 // Called to update the loading state. Handles updating the go/stop button | 138 // Called to update the loading state. Handles updating the go/stop button |
138 // state. | 139 // state. |
139 - (void)setIsLoading:(BOOL)isLoading; | 140 - (void)setIsLoading:(BOOL)isLoading; |
140 | 141 |
141 // Allow turning off the toolbar (but we keep the location bar | 142 // Allow turning off the toolbar (but we may keep the location bar without a |
142 // around). This changes the behavior of other methods, like | 143 // surrounding toolbar). If |toolbar| is YES, the value of |hasLocationBar| is |
143 // [self view]. | 144 // ignored. This changes the behavior of other methods, like |-view|. |
144 - (void)setHasToolbar:(BOOL)toolbar; | 145 - (void)setHasToolbar:(BOOL)toolbar hasLocationBar:(BOOL)locBar; |
145 | 146 |
146 // The bookmark bubble (when you click the star) needs to know where to go. | 147 // The bookmark bubble (when you click the star) needs to know where to go. |
147 // Somewhere near the star button seems like a good start. | 148 // Somewhere near the star button seems like a good start. |
148 - (NSRect)starButtonInWindowCoordinates; | 149 - (NSRect)starButtonInWindowCoordinates; |
149 | 150 |
150 // Returns the desired toolbar height for the given compression factor. | 151 // Returns the desired toolbar height for the given compression factor. |
151 - (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight; | 152 - (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight; |
152 | 153 |
153 // Set the opacity of the divider (the line at the bottom) *if* we have a | 154 // Set the opacity of the divider (the line at the bottom) *if* we have a |
154 // |ToolbarView| (0 means don't show it); no-op otherwise. | 155 // |ToolbarView| (0 means don't show it); no-op otherwise. |
155 - (void)setDividerOpacity:(CGFloat)opacity; | 156 - (void)setDividerOpacity:(CGFloat)opacity; |
156 | 157 |
157 @end | 158 @end |
158 | 159 |
159 // A set of private methods used by tests, in the absence of "friends" in ObjC. | 160 // A set of private methods used by tests, in the absence of "friends" in ObjC. |
160 @interface ToolbarController(PrivateTestMethods) | 161 @interface ToolbarController(PrivateTestMethods) |
161 // Returns an array of views in the order of the outlets above. | 162 // Returns an array of views in the order of the outlets above. |
162 - (NSArray*)toolbarViews; | 163 - (NSArray*)toolbarViews; |
163 - (void)showOptionalHomeButton; | 164 - (void)showOptionalHomeButton; |
164 - (void)showOptionalPageWrenchButtons; | 165 - (void)showOptionalPageWrenchButtons; |
165 - (gfx::Rect)locationStackBounds; | 166 - (gfx::Rect)locationStackBounds; |
166 // Return a hover button for the current event. | 167 // Return a hover button for the current event. |
167 - (NSButton*)hoverButtonForEvent:(NSEvent*)theEvent; | 168 - (NSButton*)hoverButtonForEvent:(NSEvent*)theEvent; |
168 - (BrowserActionsController*)browserActionsController; | 169 - (BrowserActionsController*)browserActionsController; |
169 @end | 170 @end |
170 | 171 |
171 #endif // CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_ | 172 #endif // CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_ |
OLD | NEW |