| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "components/signin/core/browser/signin_error_controller.h" | 5 #include "components/signin/core/browser/signin_error_controller.h" |
| 6 | 6 |
| 7 #include "components/signin/core/browser/signin_metrics.h" | 7 #include "components/signin/core/browser/signin_metrics.h" |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 | 10 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 if (!error_changed && prev_state != GoogleServiceAuthError::NONE) { | 85 if (!error_changed && prev_state != GoogleServiceAuthError::NONE) { |
| 86 // No provider reported an error, so clear the error we have now. | 86 // No provider reported an error, so clear the error we have now. |
| 87 auth_error_ = GoogleServiceAuthError::AuthErrorNone(); | 87 auth_error_ = GoogleServiceAuthError::AuthErrorNone(); |
| 88 error_account_id_.clear(); | 88 error_account_id_.clear(); |
| 89 error_changed = true; | 89 error_changed = true; |
| 90 } | 90 } |
| 91 | 91 |
| 92 if (error_changed) { | 92 if (error_changed) { |
| 93 signin_metrics::LogAuthError(auth_error_.state()); | 93 signin_metrics::LogAuthError(auth_error_.state()); |
| 94 FOR_EACH_OBSERVER(Observer, observer_list_, OnErrorChanged()); | 94 for (auto& observer : observer_list_) |
| 95 observer.OnErrorChanged(); |
| 95 } | 96 } |
| 96 } | 97 } |
| 97 | 98 |
| 98 bool SigninErrorController::HasError() const { | 99 bool SigninErrorController::HasError() const { |
| 99 return auth_error_.state() != GoogleServiceAuthError::NONE && | 100 return auth_error_.state() != GoogleServiceAuthError::NONE && |
| 100 auth_error_.state() != GoogleServiceAuthError::CONNECTION_FAILED; | 101 auth_error_.state() != GoogleServiceAuthError::CONNECTION_FAILED; |
| 101 } | 102 } |
| 102 | 103 |
| 103 void SigninErrorController::AddObserver(Observer* observer) { | 104 void SigninErrorController::AddObserver(Observer* observer) { |
| 104 observer_list_.AddObserver(observer); | 105 observer_list_.AddObserver(observer); |
| 105 } | 106 } |
| 106 | 107 |
| 107 void SigninErrorController::RemoveObserver(Observer* observer) { | 108 void SigninErrorController::RemoveObserver(Observer* observer) { |
| 108 observer_list_.RemoveObserver(observer); | 109 observer_list_.RemoveObserver(observer); |
| 109 } | 110 } |
| OLD | NEW |