| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/signin/signin_manager_base.h" | 5 #include "chrome/browser/signin/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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // gaia::AreEmailsSame() but not the same as given by std::string::op==(), | 82 // gaia::AreEmailsSame() but not the same as given by std::string::op==(), |
| 83 // make sure to set the authenticated name below. | 83 // make sure to set the authenticated name below. |
| 84 if (!gaia::AreEmailsSame(username, authenticated_username_) || | 84 if (!gaia::AreEmailsSame(username, authenticated_username_) || |
| 85 username == authenticated_username_) { | 85 username == authenticated_username_) { |
| 86 return; | 86 return; |
| 87 } | 87 } |
| 88 #else | 88 #else |
| 89 return; | 89 return; |
| 90 #endif | 90 #endif |
| 91 } | 91 } |
| 92 std::string pref_username = profile_->GetPrefs()->GetString( |
| 93 prefs::kGoogleServicesUsername); |
| 94 DCHECK(pref_username.empty() || |
| 95 gaia::AreEmailsSame(username, pref_username)); |
| 92 authenticated_username_ = username; | 96 authenticated_username_ = username; |
| 93 // TODO(tim): We could go further in ensuring kGoogleServicesUsername and | 97 profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername, username); |
| 94 // authenticated_username_ are consistent once established (e.g. remove | |
| 95 // authenticated_username_ altogether). Bug 107160. | |
| 96 | |
| 97 NotifyDiagnosticsObservers(USERNAME, username); | 98 NotifyDiagnosticsObservers(USERNAME, username); |
| 98 | 99 |
| 99 // Go ahead and update the last signed in username here as well. Once a | 100 // Go ahead and update the last signed in username here as well. Once a |
| 100 // user is signed in the two preferences should match. Doing it here as | 101 // user is signed in the two preferences should match. Doing it here as |
| 101 // opposed to on signin allows us to catch the upgrade scenario. | 102 // opposed to on signin allows us to catch the upgrade scenario. |
| 102 profile_->GetPrefs()->SetString(prefs::kGoogleServicesLastUsername, username); | 103 profile_->GetPrefs()->SetString(prefs::kGoogleServicesLastUsername, username); |
| 103 } | 104 } |
| 104 | 105 |
| 105 void SigninManagerBase::clear_authenticated_username() { | 106 void SigninManagerBase::clear_authenticated_username() { |
| 106 authenticated_username_.clear(); | 107 authenticated_username_.clear(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 NotifySigninValueChanged(field, value)); | 141 NotifySigninValueChanged(field, value)); |
| 141 } | 142 } |
| 142 | 143 |
| 143 void SigninManagerBase::NotifyDiagnosticsObservers( | 144 void SigninManagerBase::NotifyDiagnosticsObservers( |
| 144 const TimedSigninStatusField& field, | 145 const TimedSigninStatusField& field, |
| 145 const std::string& value) { | 146 const std::string& value) { |
| 146 FOR_EACH_OBSERVER(SigninDiagnosticsObserver, | 147 FOR_EACH_OBSERVER(SigninDiagnosticsObserver, |
| 147 signin_diagnostics_observers_, | 148 signin_diagnostics_observers_, |
| 148 NotifySigninValueChanged(field, value)); | 149 NotifySigninValueChanged(field, value)); |
| 149 } | 150 } |
| OLD | NEW |