- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / browser / avatar_button_controller.h
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.
4
5 #ifndef CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_BUTTON_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_BUTTON_CONTROLLER_H_
7
8 #import <AppKit/AppKit.h>
9
10 #import "base/mac/scoped_nsobject.h"
11 #include "base/memory/scoped_ptr.h"
12
13 @class AvatarLabelButton;
14 @class AvatarMenuBubbleController;
15 class Browser;
16
17 namespace AvatarButtonControllerInternal {
18 class Observer;
19 }
20
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 {
26  @private
27   Browser* browser_;
28
29   // Notification bridge for profile info updates.
30   scoped_ptr<AvatarButtonControllerInternal::Observer> observer_;
31
32   // The menu controller, if the menu is open.
33   __weak AvatarMenuBubbleController* menuController_;
34
35   // The avatar button.
36   base::scoped_nsobject<NSButton> button_;
37
38   // The managed user avatar label button. Only used for managed user profiles.
39   base::scoped_nsobject<AvatarLabelButton> labelButton_;
40 }
41
42 // The avatar button view.
43 @property(readonly, nonatomic) NSButton* buttonView;
44
45 // The managed user avatar label button view.
46 @property(readonly, nonatomic) NSButton* labelButtonView;
47
48 // Designated initializer.
49 - (id)initWithBrowser:(Browser*)browser;
50
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;
54
55 // Shows the avatar bubble.
56 - (void)showAvatarBubble:(NSView*)anchor;
57
58 @end
59
60 @interface AvatarButtonController (ExposedForTesting)
61 - (AvatarMenuBubbleController*)menuController;
62 @end
63
64 #endif  // CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_BUTTON_CONTROLLER_H_