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 #pragma once | 7 #pragma once |
8 | 8 |
9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
10 | 10 |
11 #import "base/memory/scoped_nsobject.h" | 11 #import "base/memory/scoped_nsobject.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 | 13 |
14 class Browser; | 14 class Browser; |
15 @class BrowserActionButton; | 15 @class BrowserActionButton; |
16 @class BrowserActionsContainerView; | 16 @class BrowserActionsContainerView; |
17 class Extension; | |
18 @class ExtensionPopupController; | 17 @class ExtensionPopupController; |
19 class ExtensionToolbarModel; | 18 class ExtensionToolbarModel; |
20 class ExtensionServiceObserverBridge; | 19 class ExtensionServiceObserverBridge; |
21 @class MenuButton; | 20 @class MenuButton; |
22 class PrefService; | 21 class PrefService; |
23 class Profile; | 22 class Profile; |
24 | 23 |
| 24 namespace extensions { |
| 25 class Extension; |
| 26 } |
| 27 |
25 // Sent when the visibility of the Browser Actions changes. | 28 // Sent when the visibility of the Browser Actions changes. |
26 extern NSString* const kBrowserActionVisibilityChangedNotification; | 29 extern NSString* const kBrowserActionVisibilityChangedNotification; |
27 | 30 |
28 // Handles state and provides an interface for controlling the Browser Actions | 31 // Handles state and provides an interface for controlling the Browser Actions |
29 // container within the Toolbar. | 32 // container within the Toolbar. |
30 @interface BrowserActionsController : NSObject { | 33 @interface BrowserActionsController : NSObject { |
31 @private | 34 @private |
32 // Reference to the current browser. Weak. | 35 // Reference to the current browser. Weak. |
33 Browser* browser_; | 36 Browser* browser_; |
34 | 37 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 - (NSUInteger)visibleButtonCount; | 84 - (NSUInteger)visibleButtonCount; |
82 | 85 |
83 // Returns a pointer to the chevron menu button. | 86 // Returns a pointer to the chevron menu button. |
84 - (MenuButton*)chevronMenuButton; | 87 - (MenuButton*)chevronMenuButton; |
85 | 88 |
86 // Resizes the container given the number of visible buttons, taking into | 89 // Resizes the container given the number of visible buttons, taking into |
87 // account the size of the grippy. Also updates the persistent width preference. | 90 // account the size of the grippy. Also updates the persistent width preference. |
88 - (void)resizeContainerAndAnimate:(BOOL)animate; | 91 - (void)resizeContainerAndAnimate:(BOOL)animate; |
89 | 92 |
90 // Returns the NSView for the action button associated with an extension. | 93 // Returns the NSView for the action button associated with an extension. |
91 - (NSView*)browserActionViewForExtension:(const Extension*)extension; | 94 - (NSView*)browserActionViewForExtension:( |
| 95 const extensions::Extension*)extension; |
92 | 96 |
93 // Returns the saved width determined by the number of shown Browser Actions | 97 // Returns the saved width determined by the number of shown Browser Actions |
94 // preference property. If no preference is found, then the width for the | 98 // preference property. If no preference is found, then the width for the |
95 // container is returned as if all buttons are shown. | 99 // container is returned as if all buttons are shown. |
96 - (CGFloat)savedWidth; | 100 - (CGFloat)savedWidth; |
97 | 101 |
98 // Returns where the popup arrow should point to for a given Browser Action. If | 102 // Returns where the popup arrow should point to for a given Browser Action. If |
99 // it is passed an extension that is not a Browser Action, then it will return | 103 // it is passed an extension that is not a Browser Action, then it will return |
100 // NSZeroPoint. | 104 // NSZeroPoint. |
101 - (NSPoint)popupPointForBrowserAction:(const Extension*)extension; | 105 - (NSPoint)popupPointForBrowserAction:(const extensions::Extension*)extension; |
102 | 106 |
103 // Returns whether the chevron button is currently hidden or in the process of | 107 // Returns whether the chevron button is currently hidden or in the process of |
104 // being hidden (fading out). Will return NO if it is not hidden or is in the | 108 // being hidden (fading out). Will return NO if it is not hidden or is in the |
105 // process of fading in. | 109 // process of fading in. |
106 - (BOOL)chevronIsHidden; | 110 - (BOOL)chevronIsHidden; |
107 | 111 |
108 // Registers the user preferences used by this class. | 112 // Registers the user preferences used by this class. |
109 + (void)registerUserPrefs:(PrefService*)prefs; | 113 + (void)registerUserPrefs:(PrefService*)prefs; |
110 | 114 |
111 @end // @interface BrowserActionsController | 115 @end // @interface BrowserActionsController |
112 | 116 |
113 @interface BrowserActionsController(TestingAPI) | 117 @interface BrowserActionsController(TestingAPI) |
114 - (NSButton*)buttonWithIndex:(NSUInteger)index; | 118 - (NSButton*)buttonWithIndex:(NSUInteger)index; |
115 @end | 119 @end |
116 | 120 |
117 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ | 121 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ |
OLD | NEW |