| 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" |
| 8 |
| 7 namespace { | 9 namespace { |
| 8 | 10 |
| 9 typedef std::set<const SigninErrorController::AuthStatusProvider*> | 11 typedef std::set<const SigninErrorController::AuthStatusProvider*> |
| 10 AuthStatusProviderSet; | 12 AuthStatusProviderSet; |
| 11 | 13 |
| 12 } // namespace | 14 } // namespace |
| 13 | 15 |
| 14 SigninErrorController::AuthStatusProvider::AuthStatusProvider() { | 16 SigninErrorController::AuthStatusProvider::AuthStatusProvider() { |
| 15 } | 17 } |
| 16 | 18 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 87 |
| 86 if (!error_changed && prev_state != GoogleServiceAuthError::NONE) { | 88 if (!error_changed && prev_state != GoogleServiceAuthError::NONE) { |
| 87 // No provider reported an error, so clear the error we have now. | 89 // No provider reported an error, so clear the error we have now. |
| 88 auth_error_ = GoogleServiceAuthError::AuthErrorNone(); | 90 auth_error_ = GoogleServiceAuthError::AuthErrorNone(); |
| 89 error_account_id_.clear(); | 91 error_account_id_.clear(); |
| 90 error_username_.clear(); | 92 error_username_.clear(); |
| 91 error_changed = true; | 93 error_changed = true; |
| 92 } | 94 } |
| 93 | 95 |
| 94 if (error_changed) { | 96 if (error_changed) { |
| 97 signin_metrics::LogAuthError(auth_error_.state()); |
| 95 FOR_EACH_OBSERVER(Observer, observer_list_, OnErrorChanged()); | 98 FOR_EACH_OBSERVER(Observer, observer_list_, OnErrorChanged()); |
| 96 } | 99 } |
| 97 } | 100 } |
| 98 | 101 |
| 99 bool SigninErrorController::HasError() const { | 102 bool SigninErrorController::HasError() const { |
| 100 return auth_error_.state() != GoogleServiceAuthError::NONE && | 103 return auth_error_.state() != GoogleServiceAuthError::NONE && |
| 101 auth_error_.state() != GoogleServiceAuthError::CONNECTION_FAILED; | 104 auth_error_.state() != GoogleServiceAuthError::CONNECTION_FAILED; |
| 102 } | 105 } |
| 103 | 106 |
| 104 void SigninErrorController::AddObserver(Observer* observer) { | 107 void SigninErrorController::AddObserver(Observer* observer) { |
| 105 observer_list_.AddObserver(observer); | 108 observer_list_.AddObserver(observer); |
| 106 } | 109 } |
| 107 | 110 |
| 108 void SigninErrorController::RemoveObserver(Observer* observer) { | 111 void SigninErrorController::RemoveObserver(Observer* observer) { |
| 109 observer_list_.RemoveObserver(observer); | 112 observer_list_.RemoveObserver(observer); |
| 110 } | 113 } |
| OLD | NEW |