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_manager_base.h" | 5 #include "components/signin/core/browser/signin_manager_base.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 info.gaia); | 209 info.gaia); |
210 } | 210 } |
211 | 211 |
212 // Go ahead and update the last signed in account info here as well. Once a | 212 // Go ahead and update the last signed in account info here as well. Once a |
213 // user is signed in the corresponding preferences should match. Doing it here | 213 // user is signed in the corresponding preferences should match. Doing it here |
214 // as opposed to on signin allows us to catch the upgrade scenario. | 214 // as opposed to on signin allows us to catch the upgrade scenario. |
215 client_->GetPrefs()->SetString(prefs::kGoogleServicesLastAccountId, | 215 client_->GetPrefs()->SetString(prefs::kGoogleServicesLastAccountId, |
216 account_id); | 216 account_id); |
217 client_->GetPrefs()->SetString(prefs::kGoogleServicesLastUsername, | 217 client_->GetPrefs()->SetString(prefs::kGoogleServicesLastUsername, |
218 info.email); | 218 info.email); |
| 219 |
| 220 // Commit authenticated account info immediately so that it does not get lost |
| 221 // if Chrome crashes before the next commit interval. |
| 222 client_->GetPrefs()->CommitPendingWrite(); |
219 } | 223 } |
220 | 224 |
221 bool SigninManagerBase::IsAuthenticated() const { | 225 bool SigninManagerBase::IsAuthenticated() const { |
222 return !authenticated_account_id_.empty(); | 226 return !authenticated_account_id_.empty(); |
223 } | 227 } |
224 | 228 |
225 bool SigninManagerBase::AuthInProgress() const { | 229 bool SigninManagerBase::AuthInProgress() const { |
226 // SigninManagerBase never kicks off auth processes itself. | 230 // SigninManagerBase never kicks off auth processes itself. |
227 return false; | 231 return false; |
228 } | 232 } |
(...skipping 17 matching lines...) Expand all Loading... |
246 SigninDiagnosticsObserver* observer) { | 250 SigninDiagnosticsObserver* observer) { |
247 signin_diagnostics_observers_.RemoveObserver(observer); | 251 signin_diagnostics_observers_.RemoveObserver(observer); |
248 } | 252 } |
249 | 253 |
250 void SigninManagerBase::NotifyDiagnosticsObservers( | 254 void SigninManagerBase::NotifyDiagnosticsObservers( |
251 const TimedSigninStatusField& field, | 255 const TimedSigninStatusField& field, |
252 const std::string& value) { | 256 const std::string& value) { |
253 for (auto& observer : signin_diagnostics_observers_) | 257 for (auto& observer : signin_diagnostics_observers_) |
254 observer.NotifySigninValueChanged(field, value); | 258 observer.NotifySigninValueChanged(field, value); |
255 } | 259 } |
OLD | NEW |