Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_AVATAR_BUTTON_ERROR_CONTROLLER_H_ | |
| 6 #define CHROME_BROWSER_UI_AVATAR_BUTTON_ERROR_CONTROLLER_H_ | |
| 7 | |
| 8 #include "components/signin/core/browser/signin_error_controller.h" | |
| 9 #include "components/sync_driver/sync_error_controller.h" | |
| 10 | |
| 11 class Profile; | |
| 12 | |
| 13 // Keeps track of the signin and sync errors that should be exposed to the user | |
| 14 // in the avatar button. | |
| 15 class AvatarButtonErrorController { | |
| 16 public: | |
| 17 explicit AvatarButtonErrorController(Profile* profile); | |
| 18 virtual ~AvatarButtonErrorController() {} | |
| 19 | |
| 20 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.
| |
| 21 void UpdateSyncError(bool has_sync_error); | |
| 22 bool HasAvatarError() { return has_signin_error_ || has_sync_error_; } | |
| 23 | |
| 24 // Explicitly requests an update to the signin/sync errors. | |
| 25 void GetAvatarErrorUpdate(); | |
| 26 | |
| 27 private: | |
| 28 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.
| |
| 29 public: | |
| 30 AvatarSigninErrorController( | |
| 31 Profile* profile, | |
| 32 AvatarButtonErrorController* avatar_button_error_controller); | |
| 33 ~AvatarSigninErrorController() override; | |
| 34 | |
| 35 // SigninErrorController::Observer: | |
| 36 void OnErrorChanged() override; | |
| 37 | |
| 38 private: | |
| 39 Profile* profile_; | |
| 40 AvatarButtonErrorController* avatar_button_error_controller_; | |
| 41 | |
| 42 DISALLOW_COPY_AND_ASSIGN(AvatarSigninErrorController); | |
| 43 }; | |
| 44 | |
| 45 class AvatarSyncErrorController : public SyncErrorController::Observer { | |
| 46 public: | |
| 47 AvatarSyncErrorController( | |
| 48 Profile* profile, | |
| 49 AvatarButtonErrorController* avatar_button_error_controller); | |
| 50 ~AvatarSyncErrorController() override; | |
| 51 | |
| 52 // SyncErrorController::Observer: | |
| 53 void OnErrorChanged() override; | |
| 54 | |
| 55 private: | |
| 56 SyncErrorController* GetSyncErrorControllerIfNeeded(); | |
| 57 | |
| 58 Profile* profile_; | |
| 59 AvatarButtonErrorController* avatar_button_error_controller_; | |
| 60 | |
| 61 DISALLOW_COPY_AND_ASSIGN(AvatarSyncErrorController); | |
| 62 }; | |
| 63 | |
| 64 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
| |
| 65 | |
| 66 AvatarSigninErrorController avatar_signin_error_controller_; | |
| 67 AvatarSyncErrorController avatar_sync_error_controller_; | |
| 68 | |
| 69 bool has_signin_error_; | |
| 70 bool has_sync_error_; | |
| 71 | |
| 72 DISALLOW_COPY_AND_ASSIGN(AvatarButtonErrorController); | |
| 73 }; | |
| 74 | |
| 75 #endif // CHROME_BROWSER_UI_AVATAR_BUTTON_ERROR_CONTROLLER_H_ | |
| OLD | NEW |