Chromium Code Reviews| Index: chrome/browser/ui/avatar_button_error_controller.h |
| diff --git a/chrome/browser/ui/avatar_button_error_controller.h b/chrome/browser/ui/avatar_button_error_controller.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..560abd63ebfef4b842dae4a2f74fd8fd4d3b6f0d |
| --- /dev/null |
| +++ b/chrome/browser/ui/avatar_button_error_controller.h |
| @@ -0,0 +1,75 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_AVATAR_BUTTON_ERROR_CONTROLLER_H_ |
| +#define CHROME_BROWSER_UI_AVATAR_BUTTON_ERROR_CONTROLLER_H_ |
| + |
| +#include "components/signin/core/browser/signin_error_controller.h" |
| +#include "components/sync_driver/sync_error_controller.h" |
| + |
| +class Profile; |
| + |
| +// Keeps track of the signin and sync errors that should be exposed to the user |
| +// in the avatar button. |
| +class AvatarButtonErrorController { |
| + public: |
| + explicit AvatarButtonErrorController(Profile* profile); |
| + virtual ~AvatarButtonErrorController() {} |
| + |
| + void UpdateSigninError(bool has_signin_error); |
|
sky
2016/08/01 15:55:26
The two Update functions are meant for internal us
Jane
2016/08/01 19:10:32
Done.
|
| + void UpdateSyncError(bool has_sync_error); |
| + bool HasAvatarError() { return has_signin_error_ || has_sync_error_; } |
| + |
| + // Explicitly requests an update to the signin/sync errors. |
| + void GetAvatarErrorUpdate(); |
| + |
| + private: |
| + class AvatarSigninErrorController : public SigninErrorController::Observer { |
|
sky
2016/08/01 15:55:26
Please add description. Also, this class is an inn
Jane
2016/08/01 19:10:32
Done.
|
| + public: |
| + AvatarSigninErrorController( |
| + Profile* profile, |
| + AvatarButtonErrorController* avatar_button_error_controller); |
| + ~AvatarSigninErrorController() override; |
| + |
| + // SigninErrorController::Observer: |
| + void OnErrorChanged() override; |
| + |
| + private: |
| + Profile* profile_; |
| + AvatarButtonErrorController* avatar_button_error_controller_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AvatarSigninErrorController); |
| + }; |
| + |
| + class AvatarSyncErrorController : public SyncErrorController::Observer { |
| + public: |
| + AvatarSyncErrorController( |
| + Profile* profile, |
| + AvatarButtonErrorController* avatar_button_error_controller); |
| + ~AvatarSyncErrorController() override; |
| + |
| + // SyncErrorController::Observer: |
| + void OnErrorChanged() override; |
| + |
| + private: |
| + SyncErrorController* GetSyncErrorControllerIfNeeded(); |
| + |
| + Profile* profile_; |
| + AvatarButtonErrorController* avatar_button_error_controller_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AvatarSyncErrorController); |
| + }; |
| + |
| + virtual void OnAvatarErrorChanged() = 0; |
|
sky
2016/08/01 15:55:26
Does this really work? OnAvatarErrorChanged is in
Jane
2016/08/01 19:10:32
Ah, I see what you mean! Thanks for the detailed e
|
| + |
| + AvatarSigninErrorController avatar_signin_error_controller_; |
| + AvatarSyncErrorController avatar_sync_error_controller_; |
| + |
| + bool has_signin_error_; |
| + bool has_sync_error_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AvatarButtonErrorController); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_AVATAR_BUTTON_ERROR_CONTROLLER_H_ |