| 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> | 10 #include <memory> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 @protected | 28 @protected |
| 29 Browser* browser_; | 29 Browser* browser_; |
| 30 | 30 |
| 31 // The avatar button. Child classes are responsible for implementing it. | 31 // The avatar button. Child classes are responsible for implementing it. |
| 32 base::scoped_nsobject<NSButton> button_; | 32 base::scoped_nsobject<NSButton> button_; |
| 33 | 33 |
| 34 // Observer that listens for updates to the ProfileAttributesStorage as well | 34 // Observer that listens for updates to the ProfileAttributesStorage as well |
| 35 // as AvatarButtonErrorController. | 35 // as AvatarButtonErrorController. |
| 36 std::unique_ptr<ProfileUpdateObserver> profileObserver_; | 36 std::unique_ptr<ProfileUpdateObserver> profileObserver_; |
| 37 | 37 |
| 38 @private | |
| 39 // The menu controller, if the menu is open. | 38 // The menu controller, if the menu is open. |
| 40 BaseBubbleController* menuController_; | 39 BaseBubbleController* menuController_; |
| 41 } | 40 } |
| 42 | 41 |
| 43 // The avatar button view. | 42 // The avatar button view. |
| 44 @property(readonly, nonatomic) NSButton* buttonView; | 43 @property(readonly, nonatomic) NSButton* buttonView; |
| 45 | 44 |
| 46 // Designated initializer. | 45 // Designated initializer. |
| 47 - (id)initWithBrowser:(Browser*)browser; | 46 - (id)initWithBrowser:(Browser*)browser; |
| 48 | 47 |
| 49 // Shows the avatar bubble in the given mode. | 48 // Shows the avatar bubble in the given mode. |
| 50 - (void)showAvatarBubbleAnchoredAt:(NSView*)anchor | 49 - (void)showAvatarBubbleAnchoredAt:(NSView*)anchor |
| 51 withMode:(BrowserWindow::AvatarBubbleMode)mode | 50 withMode:(BrowserWindow::AvatarBubbleMode)mode |
| 52 withServiceType:(signin::GAIAServiceType)serviceType | 51 withServiceType:(signin::GAIAServiceType)serviceType |
| 53 fromAccessPoint:(signin_metrics::AccessPoint)accessPoint; | 52 fromAccessPoint:(signin_metrics::AccessPoint)accessPoint; |
| 54 | 53 |
| 55 // Called when the avatar bubble will close. | 54 // Called when the avatar bubble will close. |
| 56 - (void)bubbleWillClose:(NSNotification*)notif; | 55 - (void)bubbleWillClose:(NSNotification*)notif; |
| 57 | 56 |
| 58 @end | 57 @end |
| 59 | 58 |
| 60 @interface AvatarBaseController (ExposedForTesting) | 59 @interface AvatarBaseController (ExposedForTesting) |
| 61 - (BaseBubbleController*)menuController; | 60 - (BaseBubbleController*)menuController; |
| 62 | |
| 63 - (BOOL)isCtrlPressed; | |
| 64 @end | 61 @end |
| 65 | 62 |
| 66 class ProfileUpdateObserver : public ProfileAttributesStorage::Observer, | 63 class ProfileUpdateObserver : public ProfileAttributesStorage::Observer, |
| 67 public AvatarButtonErrorControllerDelegate { | 64 public AvatarButtonErrorControllerDelegate { |
| 68 public: | 65 public: |
| 69 ProfileUpdateObserver(Profile* profile, | 66 ProfileUpdateObserver(Profile* profile, |
| 70 AvatarBaseController* avatarController); | 67 AvatarBaseController* avatarController); |
| 71 ~ProfileUpdateObserver() override; | 68 ~ProfileUpdateObserver() override; |
| 72 | 69 |
| 73 // ProfileAttributesStorage::Observer: | 70 // ProfileAttributesStorage::Observer: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 86 | 83 |
| 87 private: | 84 private: |
| 88 AvatarButtonErrorController errorController_; | 85 AvatarButtonErrorController errorController_; |
| 89 Profile* profile_; | 86 Profile* profile_; |
| 90 AvatarBaseController* avatarController_; // Weak; owns this. | 87 AvatarBaseController* avatarController_; // Weak; owns this. |
| 91 | 88 |
| 92 DISALLOW_COPY_AND_ASSIGN(ProfileUpdateObserver); | 89 DISALLOW_COPY_AND_ASSIGN(ProfileUpdateObserver); |
| 93 }; | 90 }; |
| 94 | 91 |
| 95 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_AVATAR_BASE_CONTROLLER_H_ | 92 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_AVATAR_BASE_CONTROLLER_H_ |
| OLD | NEW |