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_BROWSER_AVATAR_BUTTON_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_BUTTON_CONTROLLER_H_
8 #import <AppKit/AppKit.h>
10 #import "base/mac/scoped_nsobject.h"
11 #include "base/memory/scoped_ptr.h"
13 @class AvatarLabelButton;
14 @class AvatarMenuBubbleController;
17 namespace AvatarButtonControllerInternal {
21 // This view controller manages the button/image that sits in the top of the
22 // window frame when using multi-profiles. It shows the current profile's
23 // avatar, or, when in Incognito, the spy dude. With multi-profiles, clicking
24 // will open the profile menu; in Incognito, clicking will do nothing.
25 @interface AvatarButtonController : NSViewController {
29 // Notification bridge for profile info updates.
30 scoped_ptr<AvatarButtonControllerInternal::Observer> observer_;
32 // The menu controller, if the menu is open.
33 __weak AvatarMenuBubbleController* menuController_;
36 base::scoped_nsobject<NSButton> button_;
38 // The managed user avatar label button. Only used for managed user profiles.
39 base::scoped_nsobject<AvatarLabelButton> labelButton_;
42 // The avatar button view.
43 @property(readonly, nonatomic) NSButton* buttonView;
45 // The managed user avatar label button view.
46 @property(readonly, nonatomic) NSButton* labelButtonView;
48 // Designated initializer.
49 - (id)initWithBrowser:(Browser*)browser;
51 // Sets the image to be used as the avatar. This will have a drop shadow applied
52 // and will be resized to the frame of the button.
53 - (void)setImage:(NSImage*)image;
55 // Shows the avatar bubble.
56 - (void)showAvatarBubble:(NSView*)anchor;
60 @interface AvatarButtonController (ExposedForTesting)
61 - (AvatarMenuBubbleController*)menuController;
64 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_BUTTON_CONTROLLER_H_