| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #import "base/mac/scoped_nsobject.h" | 10 #import "base/mac/scoped_nsobject.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 | 12 |
| 13 class Browser; | 13 class Browser; |
| 14 @class BrowserActionButton; | 14 @class BrowserActionButton; |
| 15 @class BrowserActionsContainerView; | 15 @class BrowserActionsContainerView; |
| 16 @class MenuButton; | 16 @class MenuButton; |
| 17 class Profile; | |
| 18 class ToolbarActionsBar; | 17 class ToolbarActionsBar; |
| 19 class ToolbarActionsBarDelegate; | 18 class ToolbarActionsBarDelegate; |
| 20 | 19 |
| 21 namespace content { | 20 namespace content { |
| 22 class WebContents; | 21 class WebContents; |
| 23 } | 22 } |
| 24 | 23 |
| 25 // Sent when the visibility of the Browser Actions changes. | 24 // Sent when the visibility of the Browser Actions changes. |
| 26 extern NSString* const kBrowserActionVisibilityChangedNotification; | 25 extern NSString* const kBrowserActionVisibilityChangedNotification; |
| 27 | 26 |
| 28 // Handles state and provides an interface for controlling the Browser Actions | 27 // Handles state and provides an interface for controlling the Browser Actions |
| 29 // container within the Toolbar. | 28 // container within the Toolbar. |
| 30 @interface BrowserActionsController : NSObject<NSMenuDelegate> { | 29 @interface BrowserActionsController : NSObject<NSMenuDelegate> { |
| 31 @private | 30 @private |
| 32 // Reference to the current browser. Weak. | 31 // Reference to the current browser. Weak. |
| 33 Browser* browser_; | 32 Browser* browser_; |
| 34 | 33 |
| 35 // The view from Toolbar.xib we'll be rendering our browser actions in. Weak. | 34 // The view from Toolbar.xib we'll be rendering our browser actions in. Weak. |
| 36 BrowserActionsContainerView* containerView_; | 35 BrowserActionsContainerView* containerView_; |
| 37 | 36 |
| 38 // The current profile. Weak. | |
| 39 Profile* profile_; | |
| 40 | |
| 41 // Array of toolbar action buttons in the correct order for them to be | 37 // Array of toolbar action buttons in the correct order for them to be |
| 42 // displayed (includes both hidden and visible buttons). | 38 // displayed (includes both hidden and visible buttons). |
| 43 base::scoped_nsobject<NSMutableArray> buttons_; | 39 base::scoped_nsobject<NSMutableArray> buttons_; |
| 44 | 40 |
| 45 // The delegate for the ToolbarActionsBar. | 41 // The delegate for the ToolbarActionsBar. |
| 46 scoped_ptr<ToolbarActionsBarDelegate> toolbarActionsBarBridge_; | 42 scoped_ptr<ToolbarActionsBarDelegate> toolbarActionsBarBridge_; |
| 47 | 43 |
| 48 // The controlling ToolbarActionsBar. | 44 // The controlling ToolbarActionsBar. |
| 49 scoped_ptr<ToolbarActionsBar> toolbarActionsBar_; | 45 scoped_ptr<ToolbarActionsBar> toolbarActionsBar_; |
| 50 | 46 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 73 - (void)update; | 69 - (void)update; |
| 74 | 70 |
| 75 // Returns the current number of browser action buttons within the container, | 71 // Returns the current number of browser action buttons within the container, |
| 76 // whether or not they are displayed. | 72 // whether or not they are displayed. |
| 77 - (NSUInteger)buttonCount; | 73 - (NSUInteger)buttonCount; |
| 78 | 74 |
| 79 // Returns the current number of browser action buttons displayed in the | 75 // Returns the current number of browser action buttons displayed in the |
| 80 // container. | 76 // container. |
| 81 - (NSUInteger)visibleButtonCount; | 77 - (NSUInteger)visibleButtonCount; |
| 82 | 78 |
| 83 // Resizes the container given the number of visible buttons, taking into | |
| 84 // account the size of the grippy. Also updates the persistent width preference. | |
| 85 - (void)resizeContainerAndAnimate:(BOOL)animate; | |
| 86 | |
| 87 // Returns the saved width determined by the number of shown Browser Actions | 79 // Returns the saved width determined by the number of shown Browser Actions |
| 88 // preference property. If no preference is found, then the width for the | 80 // preference property. If no preference is found, then the width for the |
| 89 // container is returned as if all buttons are shown. | 81 // container is returned as if all buttons are shown. |
| 90 - (CGFloat)savedWidth; | 82 - (CGFloat)savedWidth; |
| 91 | 83 |
| 92 // Returns where the popup arrow should point to for the action with the given | 84 // Returns where the popup arrow should point to for the action with the given |
| 93 // |id|. If passed an id with no corresponding button, returns NSZeroPoint. | 85 // |id|. If passed an id with no corresponding button, returns NSZeroPoint. |
| 94 - (NSPoint)popupPointForId:(const std::string&)id; | 86 - (NSPoint)popupPointForId:(const std::string&)id; |
| 95 | 87 |
| 96 // Returns whether the chevron button is currently hidden or in the process of | 88 // Returns whether the chevron button is currently hidden or in the process of |
| 97 // being hidden (fading out). Will return NO if it is not hidden or is in the | 89 // being hidden (fading out). Will return NO if it is not hidden or is in the |
| 98 // process of fading in. | 90 // process of fading in. |
| 99 - (BOOL)chevronIsHidden; | 91 - (BOOL)chevronIsHidden; |
| 100 | 92 |
| 101 // Returns the currently-active web contents. | 93 // Returns the currently-active web contents. |
| 102 - (content::WebContents*)currentWebContents; | 94 - (content::WebContents*)currentWebContents; |
| 103 | 95 |
| 104 @end // @interface BrowserActionsController | 96 @end // @interface BrowserActionsController |
| 105 | 97 |
| 106 @interface BrowserActionsController(TestingAPI) | 98 @interface BrowserActionsController(TestingAPI) |
| 107 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index; | 99 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index; |
| 108 @end | 100 @end |
| 109 | 101 |
| 110 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ | 102 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ |
| OLD | NEW |