OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ |
6 #define CHROME_BROWSER_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ | 6 #define CHROME_BROWSER_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #import "base/scoped_nsobject.h" | 10 #import "base/scoped_nsobject.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 // A dictionary of Extension ID -> BrowserActionButton pairs representing the | 43 // A dictionary of Extension ID -> BrowserActionButton pairs representing the |
44 // buttons present in the container view. The ID is a string unique to each | 44 // buttons present in the container view. The ID is a string unique to each |
45 // extension. | 45 // extension. |
46 scoped_nsobject<NSMutableDictionary> buttons_; | 46 scoped_nsobject<NSMutableDictionary> buttons_; |
47 | 47 |
48 // The order of the BrowserActionButton objects within the dictionary. | 48 // The order of the BrowserActionButton objects within the dictionary. |
49 scoped_nsobject<NSMutableArray> buttonOrder_; | 49 scoped_nsobject<NSMutableArray> buttonOrder_; |
50 } | 50 } |
51 | 51 |
| 52 @property(readonly, nonatomic) BrowserActionsContainerView* containerView; |
| 53 |
52 // Initializes the controller given the current browser and container view that | 54 // Initializes the controller given the current browser and container view that |
53 // will hold the browser action buttons. | 55 // will hold the browser action buttons. |
54 - (id)initWithBrowser:(Browser*)browser | 56 - (id)initWithBrowser:(Browser*)browser |
55 containerView:(BrowserActionsContainerView*)container; | 57 containerView:(BrowserActionsContainerView*)container; |
56 | 58 |
57 // Creates and appends any existing browser action buttons present within the | 59 // Creates and appends any existing browser action buttons present within the |
58 // extensions service to the toolbar. | 60 // extensions service to the toolbar. |
59 - (void)createButtons; | 61 - (void)createButtons; |
60 | 62 |
| 63 // Returns the ideal (not current) width to fit all visible extensions and other |
| 64 // UI elements in the container nicely. |
| 65 - (CGFloat)idealContainerWidth; |
| 66 |
61 // Update the display of all buttons. | 67 // Update the display of all buttons. |
62 - (void)update; | 68 - (void)update; |
63 | 69 |
64 // Returns the current number of browser action buttons within the container, | 70 // Returns the current number of browser action buttons within the container, |
65 // whether or not they are displayed. | 71 // whether or not they are displayed. |
66 - (int)buttonCount; | 72 - (NSUInteger)buttonCount; |
67 | 73 |
68 // Returns the current number of browser action buttons displayed in the | 74 // Returns the current number of browser action buttons displayed in the |
69 // container. | 75 // container. |
70 - (int)visibleButtonCount; | 76 - (NSUInteger)visibleButtonCount; |
71 | 77 |
72 // Executes the action designated by the extension. | 78 // Executes the action designated by the extension. |
73 - (void)browserActionClicked:(BrowserActionButton*)sender; | 79 - (void)browserActionClicked:(BrowserActionButton*)sender; |
74 | 80 |
75 // Returns the NSView for the action button associated with an extension. | 81 // Returns the NSView for the action button associated with an extension. |
76 - (NSView*)browserActionViewForExtension:(Extension*)extension; | 82 - (NSView*)browserActionViewForExtension:(Extension*)extension; |
77 | 83 |
78 @end // @interface BrowserActionsController | 84 @end // @interface BrowserActionsController |
79 | 85 |
80 @interface BrowserActionsController(TestingAPI) | 86 @interface BrowserActionsController(TestingAPI) |
81 - (NSButton*)buttonWithIndex:(int)index; | 87 - (NSButton*)buttonWithIndex:(int)index; |
82 @end | 88 @end |
83 | 89 |
84 #endif // CHROME_BROWSER_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ | 90 #endif // CHROME_BROWSER_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ |
OLD | NEW |