Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6233)

Unified Diff: chrome/browser/ui/cocoa/profiles/avatar_base_controller.h

Issue 2174973002: [Mac][MD User Menu] Revamped signin/sync error surfacing UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: After refactoring Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/profiles/avatar_base_controller.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/profiles/avatar_base_controller.h
diff --git a/chrome/browser/ui/cocoa/profiles/avatar_base_controller.h b/chrome/browser/ui/cocoa/profiles/avatar_base_controller.h
index 115cb2f43c869c64fd9f8bdeaec86d958743db18..af151567292a4a4100596ec8677103588226b846 100644
--- a/chrome/browser/ui/cocoa/profiles/avatar_base_controller.h
+++ b/chrome/browser/ui/cocoa/profiles/avatar_base_controller.h
@@ -10,13 +10,16 @@
#include <memory>
#import "base/mac/scoped_nsobject.h"
+#include "chrome/browser/profiles/profile_attributes_storage.h"
+#include "chrome/browser/ui/avatar_button_error_controller.h"
+#include "chrome/browser/ui/avatar_button_error_controller_delegate.h"
#include "chrome/browser/ui/browser_window.h"
#import "chrome/browser/ui/cocoa/has_weak_browser_pointer.h"
#include "components/signin/core/browser/signin_header_helper.h"
@class BaseBubbleController;
class Browser;
-class ProfileAttributesUpdateObserver;
+class ProfileUpdateObserver;
// This view controller manages the button that sits in the top of the
// window frame when using multi-profiles, and shows information about the
@@ -28,12 +31,13 @@ class ProfileAttributesUpdateObserver;
// The avatar button. Child classes are responsible for implementing it.
base::scoped_nsobject<NSButton> button_;
+ // Observer that listens for updates to the ProfileAttributesStorage as well
+ // as AvatarButtonErrorController.
+ std::unique_ptr<ProfileUpdateObserver> profileObserver_;
+
@private
// The menu controller, if the menu is open.
BaseBubbleController* menuController_;
-
- // Observer that listens for updates to the ProfileAttributesStorage.
- std::unique_ptr<ProfileAttributesUpdateObserver> profileAttributesObserver_;
}
// The avatar button view.
@@ -56,4 +60,33 @@ class ProfileAttributesUpdateObserver;
- (BOOL)isCtrlPressed;
@end
+class ProfileUpdateObserver : public ProfileAttributesStorage::Observer,
+ public AvatarButtonErrorControllerDelegate {
+ public:
+ ProfileUpdateObserver(Profile* profile,
+ AvatarBaseController* avatarController);
+ ~ProfileUpdateObserver() override;
+
+ // ProfileAttributesStorage::Observer:
+ void OnProfileAdded(const base::FilePath& profile_path) override;
+ void OnProfileWasRemoved(const base::FilePath& profile_path,
+ const base::string16& profile_name) override;
+ void OnProfileNameChanged(const base::FilePath& profile_path,
+ const base::string16& old_profile_name) override;
+ void OnProfileSupervisedUserIdChanged(
+ const base::FilePath& profile_path) override;
+
+ // AvatarButtonErrorControllerDelegate:
+ void OnAvatarErrorChanged() override;
+
+ bool HasAvatarError();
+
+ private:
+ AvatarButtonErrorController errorController_;
+ Profile* profile_;
+ AvatarBaseController* avatarController_; // Weak; owns this.
+
+ DISALLOW_COPY_AND_ASSIGN(ProfileUpdateObserver);
+};
+
#endif // CHROME_BROWSER_UI_COCOA_PROFILES_AVATAR_BASE_CONTROLLER_H_
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/profiles/avatar_base_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698