| 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..5cbcb617359b115af693793aa9c098f77ebba766 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/ui/avatar_button_error_controller.h"
|
| +#include "chrome/browser/ui/avatar_button_error_controller_delegate.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;
|
| @@ -17,38 +17,9 @@ class Profile;
|
|
|
| // Avatar button that displays the active profile's name in the caption area.
|
| class NewAvatarButton : public views::LabelButton,
|
| + public AvatarButtonErrorControllerDelegate,
|
| public ProfileAttributesStorage::Observer {
|
| public:
|
| - class SigninErrorObserver : public SigninErrorController::Observer {
|
| - public:
|
| - SigninErrorObserver(NewAvatarButton* parent_button, Profile* profile);
|
| - ~SigninErrorObserver() override;
|
| -
|
| - private:
|
| - // SigninErrorController::Observer:
|
| - void OnErrorChanged() override;
|
| -
|
| - NewAvatarButton* parent_button_;
|
| - Profile* profile_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(SigninErrorObserver);
|
| - };
|
| -
|
| - class SyncErrorObserver : public SyncErrorController::Observer {
|
| - public:
|
| - SyncErrorObserver(NewAvatarButton* parent_button, Profile* profile);
|
| - ~SyncErrorObserver() override;
|
| -
|
| - private:
|
| - // SyncErrorController::Observer:
|
| - void OnErrorChanged() override;
|
| -
|
| - NewAvatarButton* parent_button_;
|
| - Profile* profile_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(SyncErrorObserver);
|
| - };
|
| -
|
| NewAvatarButton(AvatarButtonDelegate* delegate,
|
| AvatarButtonStyle button_style,
|
| Profile* profile);
|
| @@ -61,11 +32,12 @@ class NewAvatarButton : public views::LabelButton,
|
| // Views
|
| void OnGestureEvent(ui::GestureEvent* event) override;
|
|
|
| - void OnErrorChanged();
|
| -
|
| private:
|
| friend class ProfileChooserViewExtensionsTest;
|
|
|
| + // AvatarButtonErrorControllerDelegate:
|
| + void OnAvatarErrorChanged() override;
|
| +
|
| // ProfileAttributesStorage::Observer:
|
| void OnProfileAdded(const base::FilePath& profile_path) override;
|
| void OnProfileWasRemoved(const base::FilePath& profile_path,
|
| @@ -75,20 +47,14 @@ 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.
|
| + // 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();
|
|
|
| - SigninErrorObserver signin_error_observer_;
|
| - SyncErrorObserver sync_error_observer_;
|
| -
|
| AvatarButtonDelegate* delegate_;
|
| + AvatarButtonErrorController error_controller_;
|
| 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_;
|
|
|