Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / extensions / browser_actions_controller.h
blobb8dc7613a9835e96dd63286167e416e6365d9707
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_
8 #import <Cocoa/Cocoa.h>
10 #import "base/mac/scoped_nsobject.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "ui/gfx/geometry/size.h"
14 class Browser;
15 @class BrowserActionButton;
16 @class BrowserActionsContainerView;
17 @class MenuButton;
18 class ToolbarActionsBar;
19 @class ToolbarActionsBarBubbleMac;
20 class ToolbarActionsBarDelegate;
22 namespace content {
23 class WebContents;
26 // Sent when the visibility of the Browser Actions changes.
27 extern NSString* const kBrowserActionVisibilityChangedNotification;
29 // Handles state and provides an interface for controlling the Browser Actions
30 // container within the Toolbar.
31 @interface BrowserActionsController : NSObject<NSMenuDelegate> {
32 @private
33 // Reference to the current browser. Weak.
34 Browser* browser_;
36 // The view from Toolbar.xib we'll be rendering our browser actions in. Weak.
37 BrowserActionsContainerView* containerView_;
39 // Array of toolbar action buttons in the correct order for them to be
40 // displayed (includes both hidden and visible buttons).
41 base::scoped_nsobject<NSMutableArray> buttons_;
43 // The delegate for the ToolbarActionsBar.
44 scoped_ptr<ToolbarActionsBarDelegate> toolbarActionsBarBridge_;
46 // The controlling ToolbarActionsBar.
47 scoped_ptr<ToolbarActionsBar> toolbarActionsBar_;
49 // True if we should supppress the chevron (we do this during drag
50 // animations).
51 BOOL suppressChevron_;
53 // True if this is the overflow container for toolbar actions.
54 BOOL isOverflow_;
56 // The currently running chevron animation (fade in/out).
57 base::scoped_nsobject<NSViewAnimation> chevronAnimation_;
59 // The chevron button used when Browser Actions are hidden.
60 base::scoped_nsobject<MenuButton> chevronMenuButton_;
62 // The Browser Actions overflow menu.
63 base::scoped_nsobject<NSMenu> overflowMenu_;
65 // The bubble that is actively showing, if any.
66 ToolbarActionsBarBubbleMac* activeBubble_;
69 @property(readonly, nonatomic) BrowserActionsContainerView* containerView;
70 @property(readonly, nonatomic) Browser* browser;
71 @property(readonly, nonatomic) BOOL isOverflow;
72 @property(readonly, nonatomic) ToolbarActionsBarBubbleMac* activeBubble;
74 // Initializes the controller given the current browser and container view that
75 // will hold the browser action buttons. If |mainController| is nil, the created
76 // BrowserActionsController will be the main controller; otherwise (if this is
77 // for the overflow menu), |mainController| should be controller of the main bar
78 // for the |browser|.
79 - (id)initWithBrowser:(Browser*)browser
80 containerView:(BrowserActionsContainerView*)container
81 mainController:(BrowserActionsController*)mainController;
83 // Update the display of all buttons.
84 - (void)update;
86 // Returns the current number of browser action buttons within the container,
87 // whether or not they are displayed.
88 - (NSUInteger)buttonCount;
90 // Returns the current number of browser action buttons displayed in the
91 // container.
92 - (NSUInteger)visibleButtonCount;
94 // Returns the preferred size for the container.
95 - (gfx::Size)preferredSize;
97 // Returns where the popup arrow should point to for the action with the given
98 // |id|. If passed an id with no corresponding button, returns NSZeroPoint.
99 - (NSPoint)popupPointForId:(const std::string&)id;
101 // Returns whether the chevron button is currently hidden or in the process of
102 // being hidden (fading out). Will return NO if it is not hidden or is in the
103 // process of fading in.
104 - (BOOL)chevronIsHidden;
106 // Returns the currently-active web contents.
107 - (content::WebContents*)currentWebContents;
109 // Returns the BrowserActionButton in the main browser actions container (as
110 // opposed to the overflow) for the action of the given id.
111 - (BrowserActionButton*)mainButtonForId:(const std::string&)id;
113 // Returns the associated ToolbarActionsBar.
114 - (ToolbarActionsBar*)toolbarActionsBar;
116 @end // @interface BrowserActionsController
118 @interface BrowserActionsController(TestingAPI)
119 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index;
120 @end
122 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_