Chromium Code Reviews| 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 0811d6d990a8edcbdd2bdfad2bfb63c5b3cba59e..1b52473da45627aafe6293fd5017a1d03dab1245 100644 |
| --- a/chrome/browser/ui/views/profiles/new_avatar_button.h |
| +++ b/chrome/browser/ui/views/profiles/new_avatar_button.h |
| @@ -9,6 +9,7 @@ |
| #include "chrome/browser/profiles/profile_attributes_storage.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; |
| @@ -16,9 +17,34 @@ class Profile; |
| // Avatar button that displays the active profile's name in the caption area. |
| class NewAvatarButton : public views::LabelButton, |
| - public ProfileAttributesStorage::Observer, |
| - public SigninErrorController::Observer { |
| + public ProfileAttributesStorage::Observer { |
| public: |
| + class SigninErrorObserver : public SigninErrorController::Observer { |
| + public: |
| + SigninErrorObserver(NewAvatarButton* parent_button, Profile* profile); |
| + ~SigninErrorObserver() override; |
| + |
| + private: |
| + // SigninErrorController::Observer |
|
msw
2016/07/14 17:47:52
nit: trailing colon
Jane
2016/07/14 17:59:44
Done.
|
| + void OnErrorChanged() override; |
| + |
| + NewAvatarButton* parent_button_; |
| + Profile* profile_; |
| + }; |
|
msw
2016/07/14 17:47:53
nit: DISALLOW_COPY_AND_ASSIGN
Jane
2016/07/14 17:59:44
Done.
|
| + |
| + class SyncErrorObserver : public SyncErrorController::Observer { |
| + public: |
| + SyncErrorObserver(NewAvatarButton* parent_button, Profile* profile); |
| + ~SyncErrorObserver() override; |
| + |
| + private: |
| + // SyncErrorController::Observer |
|
msw
2016/07/14 17:47:52
nit: trailing colon
Jane
2016/07/14 17:59:44
Done.
|
| + void OnErrorChanged() override; |
| + |
| + NewAvatarButton* parent_button_; |
| + Profile* profile_; |
| + }; |
|
msw
2016/07/14 17:47:53
nit: DISALLOW_COPY_AND_ASSIGN
Jane
2016/07/14 17:59:44
Done.
|
| + |
| NewAvatarButton(AvatarButtonDelegate* delegate, |
| AvatarButtonStyle button_style, |
| Profile* profile); |
| @@ -31,6 +57,8 @@ class NewAvatarButton : public views::LabelButton, |
| // Views |
| void OnGestureEvent(ui::GestureEvent* event) override; |
| + void OnErrorChanged(); |
| + |
| private: |
| friend class ProfileChooserViewExtensionsTest; |
| @@ -43,19 +71,19 @@ class NewAvatarButton : public views::LabelButton, |
| void OnProfileSupervisedUserIdChanged( |
| const base::FilePath& profile_path) override; |
| - // SigninErrorController::Observer: |
| - void OnErrorChanged() 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_; |
|
msw
2016/07/14 17:47:53
nit: std::unique_ptr
Jane
2016/07/14 17:59:44
Done.
|
| + SyncErrorObserver* sync_error_observer_; |
|
msw
2016/07/14 17:47:53
nit: std::unique_ptr
Jane
2016/07/14 17:59:44
Done.
|
| + |
| AvatarButtonDelegate* delegate_; |
| Profile* profile_; |
| - // Whether the signed in profile has an authentication error. Used to display |
| - // an error icon next to the button text. |
| - bool has_auth_error_; |
| + // 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. |