OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_AVATAR_BUTTON_ERROR_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_AVATAR_BUTTON_ERROR_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_AVATAR_BUTTON_ERROR_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_AVATAR_BUTTON_ERROR_CONTROLLER_H_ |
7 | 7 |
8 #include "chrome/browser/ui/avatar_button_error_controller_delegate.h" | 8 #include "chrome/browser/ui/avatar_button_error_controller_delegate.h" |
9 #include "components/signin/core/browser/signin_error_controller.h" | 9 #include "components/signin/core/browser/signin_error_controller.h" |
10 #include "components/sync/driver/sync_error_controller.h" | 10 #include "components/sync/driver/sync_error_controller.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 private: | 42 private: |
43 Profile* profile_; | 43 Profile* profile_; |
44 AvatarButtonErrorController* avatar_button_error_controller_; | 44 AvatarButtonErrorController* avatar_button_error_controller_; |
45 | 45 |
46 DISALLOW_COPY_AND_ASSIGN(SigninErrorObserver); | 46 DISALLOW_COPY_AND_ASSIGN(SigninErrorObserver); |
47 }; | 47 }; |
48 | 48 |
49 // Observes sync errors and updates the error controller for the avatar | 49 // Observes sync errors and updates the error controller for the avatar |
50 // button accordingly. | 50 // button accordingly. |
51 class SyncErrorObserver : public syncer::SyncErrorController::Observer { | 51 class SyncErrorObserver : public SyncErrorController::Observer { |
52 public: | 52 public: |
53 SyncErrorObserver( | 53 SyncErrorObserver( |
54 Profile* profile, | 54 Profile* profile, |
55 AvatarButtonErrorController* avatar_button_error_controller); | 55 AvatarButtonErrorController* avatar_button_error_controller); |
56 ~SyncErrorObserver() override; | 56 ~SyncErrorObserver() override; |
57 | 57 |
58 // SyncErrorController::Observer: | 58 // SyncErrorController::Observer: |
59 void OnErrorChanged() override; | 59 void OnErrorChanged() override; |
60 | 60 |
61 bool HasSyncError(); | 61 bool HasSyncError(); |
62 | 62 |
63 private: | 63 private: |
64 syncer::SyncErrorController* GetSyncErrorControllerIfNeeded(); | 64 SyncErrorController* GetSyncErrorControllerIfNeeded(); |
65 | 65 |
66 Profile* profile_; | 66 Profile* profile_; |
67 AvatarButtonErrorController* avatar_button_error_controller_; | 67 AvatarButtonErrorController* avatar_button_error_controller_; |
68 | 68 |
69 DISALLOW_COPY_AND_ASSIGN(SyncErrorObserver); | 69 DISALLOW_COPY_AND_ASSIGN(SyncErrorObserver); |
70 }; | 70 }; |
71 | 71 |
72 void UpdateSigninError(bool has_signin_error); | 72 void UpdateSigninError(bool has_signin_error); |
73 void UpdateSyncError(bool has_sync_error); | 73 void UpdateSyncError(bool has_sync_error); |
74 | 74 |
75 AvatarButtonErrorControllerDelegate* delegate_; | 75 AvatarButtonErrorControllerDelegate* delegate_; |
76 | 76 |
77 SigninErrorObserver avatar_signin_error_controller_; | 77 SigninErrorObserver avatar_signin_error_controller_; |
78 SyncErrorObserver avatar_sync_error_controller_; | 78 SyncErrorObserver avatar_sync_error_controller_; |
79 | 79 |
80 bool has_signin_error_; | 80 bool has_signin_error_; |
81 bool has_sync_error_; | 81 bool has_sync_error_; |
82 | 82 |
83 DISALLOW_COPY_AND_ASSIGN(AvatarButtonErrorController); | 83 DISALLOW_COPY_AND_ASSIGN(AvatarButtonErrorController); |
84 }; | 84 }; |
85 | 85 |
86 #endif // CHROME_BROWSER_UI_AVATAR_BUTTON_ERROR_CONTROLLER_H_ | 86 #endif // CHROME_BROWSER_UI_AVATAR_BUTTON_ERROR_CONTROLLER_H_ |
OLD | NEW |