OLD | NEW |
1 // Copyright 2014 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_PROFILES_AVATAR_BASE_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_PROFILES_AVATAR_BASE_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_COCOA_PROFILES_AVATAR_BASE_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_PROFILES_AVATAR_BASE_CONTROLLER_H_ |
7 | 7 |
8 #import <AppKit/AppKit.h> | 8 #import <AppKit/AppKit.h> |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #import "base/mac/scoped_nsobject.h" | 12 #import "base/mac/scoped_nsobject.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
13 #import "chrome/browser/ui/cocoa/has_weak_browser_pointer.h" | 14 #import "chrome/browser/ui/cocoa/has_weak_browser_pointer.h" |
14 #include "components/signin/core/browser/signin_header_helper.h" | 15 #include "components/signin/core/browser/signin_header_helper.h" |
15 | 16 |
16 @class BaseBubbleController; | 17 @class BaseBubbleController; |
17 class Browser; | 18 class Browser; |
18 class ProfileAttributesUpdateObserver; | 19 class ProfileAttributesUpdateObserver; |
19 | 20 |
20 // This view controller manages the button that sits in the top of the | 21 // This view controller manages the button that sits in the top of the |
21 // window frame when using multi-profiles, and shows information about the | 22 // window frame when using multi-profiles, and shows information about the |
22 // current profile. Clicking the button will open the profile menu. | 23 // current profile. Clicking the button will open the profile menu. |
23 @interface AvatarBaseController : NSViewController<HasWeakBrowserPointer> { | 24 @interface AvatarBaseController : NSViewController<HasWeakBrowserPointer> { |
24 @protected | 25 @protected |
25 Browser* browser_; | 26 Browser* browser_; |
26 | 27 |
27 // The avatar button. Child classes are responsible for implementing it. | 28 // The avatar button. Child classes are responsible for implementing it. |
28 base::scoped_nsobject<NSButton> button_; | 29 base::scoped_nsobject<NSButton> button_; |
29 | 30 |
30 @private | 31 @private |
31 // The menu controller, if the menu is open. | 32 // The menu controller, if the menu is open. |
32 BaseBubbleController* menuController_; | 33 BaseBubbleController* menuController_; |
33 | 34 |
34 // Observer that listens for updates to the ProfileAttributesStorage. | 35 // Observer that listens for updates to the ProfileAttributesStorage. |
35 scoped_ptr<ProfileAttributesUpdateObserver> profileAttributesObserver_; | 36 std::unique_ptr<ProfileAttributesUpdateObserver> profileAttributesObserver_; |
36 } | 37 } |
37 | 38 |
38 // The avatar button view. | 39 // The avatar button view. |
39 @property(readonly, nonatomic) NSButton* buttonView; | 40 @property(readonly, nonatomic) NSButton* buttonView; |
40 | 41 |
41 // Designated initializer. | 42 // Designated initializer. |
42 - (id)initWithBrowser:(Browser*)browser; | 43 - (id)initWithBrowser:(Browser*)browser; |
43 | 44 |
44 // Shows the avatar bubble in the given mode. | 45 // Shows the avatar bubble in the given mode. |
45 - (void)showAvatarBubbleAnchoredAt:(NSView*)anchor | 46 - (void)showAvatarBubbleAnchoredAt:(NSView*)anchor |
46 withMode:(BrowserWindow::AvatarBubbleMode)mode | 47 withMode:(BrowserWindow::AvatarBubbleMode)mode |
47 withServiceType:(signin::GAIAServiceType)serviceType | 48 withServiceType:(signin::GAIAServiceType)serviceType |
48 fromAccessPoint:(signin_metrics::AccessPoint)accessPoint; | 49 fromAccessPoint:(signin_metrics::AccessPoint)accessPoint; |
49 | 50 |
50 @end | 51 @end |
51 | 52 |
52 @interface AvatarBaseController (ExposedForTesting) | 53 @interface AvatarBaseController (ExposedForTesting) |
53 - (BaseBubbleController*)menuController; | 54 - (BaseBubbleController*)menuController; |
54 | 55 |
55 - (BOOL)isCtrlPressed; | 56 - (BOOL)isCtrlPressed; |
56 @end | 57 @end |
57 | 58 |
58 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_AVATAR_BASE_CONTROLLER_H_ | 59 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_AVATAR_BASE_CONTROLLER_H_ |
OLD | NEW |