OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/memory/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 | 12 |
13 @class AvatarMenuBubbleController; | 13 @class AvatarMenuBubbleController; |
14 class Browser; | 14 class Browser; |
15 | 15 |
16 namespace AvatarButtonControllerInternal { | 16 namespace AvatarButtonControllerInternal { |
17 class Observer; | 17 class Observer; |
18 } | 18 } |
19 | 19 |
20 namespace ui { | 20 namespace ui { |
21 class ThemeProvider; | 21 class ThemeProvider; |
22 } | 22 } |
23 | 23 |
24 // This view controller manages the button/image that sits in the top of the | 24 // This view controller manages the button/image that sits in the top of the |
25 // window frame when using multi-profiles. It shows the current profile's | 25 // window frame when using multi-profiles. It shows the current profile's |
26 // avatar, or, when in Incognito, the spy dude. With multi-profiles, clicking | 26 // avatar, or, when in Incognito, the spy dude. With multi-profiles, clicking |
27 // will open the profile menu; in Incognito, clicking will do nothing. | 27 // will open the profile menu; in Incognito, clicking will do nothing. |
28 @interface AvatarButtonController : NSViewController { | 28 @interface AvatarButtonController : NSViewController { |
29 @private | 29 @private |
30 Browser* browser_; | 30 Browser* browser_; |
31 | 31 |
32 // Notification bridge for profile info updates. | 32 // Notification bridge for profile info updates. |
33 scoped_ptr<AvatarButtonControllerInternal::Observer> observer_; | 33 scoped_ptr<AvatarButtonControllerInternal::Observer> observer_; |
34 | 34 |
35 // The menu controller, if the menu is open. | 35 // The menu controller, if the menu is open. |
36 __weak AvatarMenuBubbleController* menuController_; | 36 __weak AvatarMenuBubbleController* menuController_; |
37 | 37 |
38 // The avatar button. | 38 // The avatar button. |
39 scoped_nsobject<NSButton> button_; | 39 base::scoped_nsobject<NSButton> button_; |
40 | 40 |
41 // The managed user avatar label. Only used for managed user profiles. | 41 // The managed user avatar label. Only used for managed user profiles. |
42 scoped_nsobject<NSButton> labelButton_; | 42 base::scoped_nsobject<NSButton> labelButton_; |
43 } | 43 } |
44 | 44 |
45 // The avatar button view. | 45 // The avatar button view. |
46 @property(readonly, nonatomic) NSButton* buttonView; | 46 @property(readonly, nonatomic) NSButton* buttonView; |
47 | 47 |
48 // The managed user avatar label button view. | 48 // The managed user avatar label button view. |
49 @property(readonly, nonatomic) NSButton* labelButtonView; | 49 @property(readonly, nonatomic) NSButton* labelButtonView; |
50 | 50 |
51 // Designated initializer. | 51 // Designated initializer. |
52 - (id)initWithBrowser:(Browser*)browser; | 52 - (id)initWithBrowser:(Browser*)browser; |
53 | 53 |
54 // Sets the image to be used as the avatar. This will have a drop shadow applied | 54 // Sets the image to be used as the avatar. This will have a drop shadow applied |
55 // and will be resized to the frame of the button. | 55 // and will be resized to the frame of the button. |
56 - (void)setImage:(NSImage*)image; | 56 - (void)setImage:(NSImage*)image; |
57 | 57 |
58 // Shows the avatar bubble. | 58 // Shows the avatar bubble. |
59 - (void)showAvatarBubble:(NSView*)anchor; | 59 - (void)showAvatarBubble:(NSView*)anchor; |
60 | 60 |
61 @end | 61 @end |
62 | 62 |
63 @interface AvatarButtonController (ExposedForTesting) | 63 @interface AvatarButtonController (ExposedForTesting) |
64 - (AvatarMenuBubbleController*)menuController; | 64 - (AvatarMenuBubbleController*)menuController; |
65 @end | 65 @end |
66 | 66 |
67 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_BUTTON_CONTROLLER_H_ | 67 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_BUTTON_CONTROLLER_H_ |
OLD | NEW |