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_ICON_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_BUTTON_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_ICON_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 "base/mac/scoped_nsobject.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h" |
12 | 13 |
13 @class AvatarLabelButton; | 14 @class AvatarLabelButton; |
14 @class BaseBubbleController; | |
15 class Browser; | 15 class Browser; |
16 | 16 |
17 namespace AvatarButtonControllerInternal { | |
18 class Observer; | |
19 } | |
20 | |
21 // This view controller manages the button/image that sits in the top of the | 17 // 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 | 18 // 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 | 19 // avatar, or, when in Incognito, the spy dude. With multi-profiles, clicking |
24 // will open the profile menu; in Incognito, clicking will do nothing. | 20 // will open the profile menu; in Incognito, clicking will do nothing. |
25 @interface AvatarButtonController : NSViewController { | 21 @interface AvatarIconController : AvatarButtonController { |
26 @private | 22 @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. | 23 // The managed user avatar label button. Only used for managed user profiles. |
39 base::scoped_nsobject<AvatarLabelButton> labelButton_; | 24 base::scoped_nsobject<AvatarLabelButton> labelButton_; |
40 } | 25 } |
41 | 26 |
42 // The avatar button view. | |
43 @property(readonly, nonatomic) NSButton* buttonView; | |
44 | |
45 // The managed user avatar label button view. | 27 // The managed user avatar label button view. |
46 @property(readonly, nonatomic) NSButton* labelButtonView; | 28 @property(readonly, nonatomic) NSButton* labelButtonView; |
47 | 29 |
48 // Designated initializer. | 30 // Designated initializer. |
49 - (id)initWithBrowser:(Browser*)browser; | 31 - (id)initWithBrowser:(Browser*)browser; |
50 | 32 |
51 // Sets the image to be used as the avatar. This will have a drop shadow applied | 33 // 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. | 34 // and will be resized to the frame of the button. |
53 - (void)setImage:(NSImage*)image; | 35 - (void)setImage:(NSImage*)image; |
54 | 36 |
55 // Shows the avatar bubble. | |
56 - (void)showAvatarBubble:(NSView*)anchor; | |
57 | |
58 @end | 37 @end |
59 | 38 |
60 @interface AvatarButtonController (ExposedForTesting) | 39 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_ICON_CONTROLLER_H_ |
61 - (BaseBubbleController*)menuController; | |
62 @end | |
63 | |
64 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_BUTTON_CONTROLLER_H_ | |
OLD | NEW |