Chromium Code Reviews| 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 "base/mac/scoped_nsobject.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 | 12 |
| 13 @class AvatarLabelButton; | 13 class Browser; |
| 14 @class BaseBubbleController; | 14 @class BaseBubbleController; |
| 15 class Browser; | 15 class ProfileInfoUpdateObserver; |
| 16 | 16 |
| 17 namespace AvatarButtonControllerInternal { | 17 // This view controller manages the button that sits in the top of the |
| 18 class Observer; | 18 // window frame when using multi-profiles, and shows the current profile's |
| 19 } | 19 // name. Clicking the button will open the profile menu. |
| 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 { | 20 @interface AvatarButtonController : NSViewController { |
| 26 @private | 21 @protected |
| 27 Browser* browser_; | 22 Browser* browser_; |
| 28 | 23 |
| 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. | 24 // The avatar button. |
| 36 base::scoped_nsobject<NSButton> button_; | 25 base::scoped_nsobject<NSButton> button_; |
| 37 | 26 |
| 38 // The managed user avatar label button. Only used for managed user profiles. | 27 @private |
| 39 base::scoped_nsobject<AvatarLabelButton> labelButton_; | 28 // The menu controller, if the menu is open. |
| 29 BaseBubbleController* menuController_; | |
| 30 | |
| 31 // Observer that listens for updates to the ProfileInfoCache. | |
| 32 scoped_ptr<ProfileInfoUpdateObserver> profileInfoObserver_; | |
| 40 } | 33 } |
| 41 | 34 |
| 42 // The avatar button view. | 35 // The avatar button view. |
| 43 @property(readonly, nonatomic) NSButton* buttonView; | 36 @property(readonly, nonatomic) NSButton* buttonView; |
| 44 | 37 |
| 45 // The managed user avatar label button view. | |
| 46 @property(readonly, nonatomic) NSButton* labelButtonView; | |
| 47 | |
| 48 // Designated initializer. | 38 // Designated initializer. |
| 49 - (id)initWithBrowser:(Browser*)browser; | 39 - (id)initWithBrowser:(Browser*)browser; |
| 50 | 40 |
| 51 // Sets the image to be used as the avatar. This will have a drop shadow applied | 41 // Initializer to be used by child classes. |
|
Nico
2014/01/14 03:56:02
initWithBrowser: is marked as "designated initiali
noms (inactive)
2014/01/15 22:07:47
Done.
| |
| 52 // and will be resized to the frame of the button. | 42 - (id)init; |
| 53 - (void)setImage:(NSImage*)image; | |
| 54 | 43 |
| 55 // Shows the avatar bubble. | 44 // Shows the avatar bubble. |
| 56 - (void)showAvatarBubble:(NSView*)anchor; | 45 - (void)showAvatarBubble:(NSView*)anchor; |
| 57 | 46 |
| 58 @end | 47 @end |
| 59 | 48 |
| 60 @interface AvatarButtonController (ExposedForTesting) | 49 @interface AvatarButtonController (ExposedForTesting) |
| 61 - (BaseBubbleController*)menuController; | 50 - (BaseBubbleController*)menuController; |
| 62 @end | 51 @end |
| 63 | 52 |
| 64 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_BUTTON_CONTROLLER_H_ | 53 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_BUTTON_CONTROLLER_H_ |
| OLD | NEW |