OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BROWSER_AVATAR_BUTTON_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_BUTTON_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_BUTTON_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_BUTTON_CONTROLLER_H_ |
7 | 7 |
8 #import <AppKit/AppKit.h> | 8 #import <AppKit/AppKit.h> |
9 | 9 |
10 #import "base/mac/scoped_nsobject.h" | 10 #import "chrome/browser/ui/cocoa/browser/avatar_base_controller.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 | 11 |
13 @class AvatarLabelButton; | |
14 @class BaseBubbleController; | |
15 class Browser; | 12 class Browser; |
16 | 13 |
17 namespace AvatarButtonControllerInternal { | 14 // This view controller manages the button that sits in the top of the |
18 class Observer; | 15 // window frame when using multi-profiles, and shows the current profile's |
19 } | 16 // name. Clicking the button will open the profile menu. |
20 | 17 @interface AvatarButtonController : AvatarBaseController |
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 BaseBubbleController* 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 | 18 |
48 // Designated initializer. | 19 // Designated initializer. |
49 - (id)initWithBrowser:(Browser*)browser; | 20 - (id)initWithBrowser:(Browser*)browser; |
50 | 21 |
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 - (BaseBubbleController*)menuController; | |
62 @end | 22 @end |
63 | 23 |
64 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_BUTTON_CONTROLLER_H_ | 24 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_BUTTON_CONTROLLER_H_ |
OLD | NEW |