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

Unified Diff: chrome/browser/ui/views/profiles/new_avatar_button.h

Issue 2179283002: Refactored signin/sync error controllers for the avatar button (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactored logic for classifying errors Created 4 years, 5 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
Index: chrome/browser/ui/views/profiles/new_avatar_button.h
diff --git a/chrome/browser/ui/views/profiles/new_avatar_button.h b/chrome/browser/ui/views/profiles/new_avatar_button.h
index 662d58dd5fd99acf1eb9484636163f2553a7e100..66111e2034df1a46ed8ba2718d781ca76e28d16d 100644
--- a/chrome/browser/ui/views/profiles/new_avatar_button.h
+++ b/chrome/browser/ui/views/profiles/new_avatar_button.h
@@ -7,9 +7,9 @@
#include "base/macros.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
+#include "chrome/browser/signin/avatar_signin_error_controller.h"
+#include "chrome/browser/sync/avatar_sync_error_controller.h"
#include "chrome/browser/ui/views/profiles/avatar_button_style.h"
-#include "components/signin/core/browser/signin_error_controller.h"
-#include "components/sync_driver/sync_error_controller.h"
#include "ui/views/controls/button/label_button.h"
class AvatarButtonDelegate;
@@ -19,34 +19,26 @@ class Profile;
class NewAvatarButton : public views::LabelButton,
public ProfileAttributesStorage::Observer {
public:
- class SigninErrorObserver : public SigninErrorController::Observer {
+ class AvatarSigninErrorObserver : public AvatarSigninErrorController {
public:
- SigninErrorObserver(NewAvatarButton* parent_button, Profile* profile);
- ~SigninErrorObserver() override;
-
- private:
- // SigninErrorController::Observer:
+ AvatarSigninErrorObserver(Profile* profile, NewAvatarButton* parent_button);
void OnErrorChanged() override;
+ private:
NewAvatarButton* parent_button_;
- Profile* profile_;
- DISALLOW_COPY_AND_ASSIGN(SigninErrorObserver);
+ DISALLOW_COPY_AND_ASSIGN(AvatarSigninErrorObserver);
};
- class SyncErrorObserver : public SyncErrorController::Observer {
+ class AvatarSyncErrorObserver : public AvatarSyncErrorController {
public:
- SyncErrorObserver(NewAvatarButton* parent_button, Profile* profile);
- ~SyncErrorObserver() override;
-
- private:
- // SyncErrorController::Observer:
+ AvatarSyncErrorObserver(Profile* profile, NewAvatarButton* parent_button);
void OnErrorChanged() override;
+ private:
NewAvatarButton* parent_button_;
- Profile* profile_;
- DISALLOW_COPY_AND_ASSIGN(SyncErrorObserver);
+ DISALLOW_COPY_AND_ASSIGN(AvatarSyncErrorObserver);
};
NewAvatarButton(AvatarButtonDelegate* delegate,
@@ -61,7 +53,9 @@ class NewAvatarButton : public views::LabelButton,
// Views
void OnGestureEvent(ui::GestureEvent* event) override;
- void OnErrorChanged();
+ // Called when the profile info cache or signin/sync error has changed, which
+ // means we might have to update the icon/text of the button.
+ void Update();
private:
friend class ProfileChooserViewExtensionsTest;
@@ -75,20 +69,12 @@ class NewAvatarButton : public views::LabelButton,
void OnProfileSupervisedUserIdChanged(
const base::FilePath& profile_path) override;
- // Called when the profile info cache has changed, which means we might
- // have to update the icon/text of the button.
- void Update();
-
- SigninErrorObserver signin_error_observer_;
- SyncErrorObserver sync_error_observer_;
+ AvatarSigninErrorObserver signin_error_observer_;
+ AvatarSyncErrorObserver sync_error_observer_;
AvatarButtonDelegate* delegate_;
Profile* profile_;
- // Whether the signed in profile has any authentication error or sync error.
- // Used to display an error icon next to the button text.
- bool has_error_;
-
// The icon displayed instead of the profile name in the local profile case.
// Different assets are used depending on the OS version.
gfx::ImageSkia generic_avatar_;

Powered by Google App Engine
This is Rietveld 408576698