| 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 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 // If the user is clearing the token service from the command line, then | 35 // If the user is clearing the token service from the command line, then |
| 36 // clear their login info also (not valid to be logged in without any | 36 // clear their login info also (not valid to be logged in without any |
| 37 // tokens). | 37 // tokens). |
| 38 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 38 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 39 if (cmd_line->HasSwitch(switches::kClearTokenService)) | 39 if (cmd_line->HasSwitch(switches::kClearTokenService)) |
| 40 client_->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername); | 40 client_->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername); |
| 41 | 41 |
| 42 std::string user = | 42 std::string user = |
| 43 client_->GetPrefs()->GetString(prefs::kGoogleServicesUsername); | 43 client_->GetPrefs()->GetString(prefs::kGoogleServicesUsername); |
| 44 if (!user.empty()) | 44 if (!user.empty()) { |
| 45 #if defined(OS_IOS) |
| 46 // Prior to M38, Chrome on iOS did not normalize the email before setting |
| 47 // it in SigninManager. |AccountReconcilor| expects the authenticated email |
| 48 // to be normalized as it used as an account identifier and is compared |
| 49 // to the accounts available in the cookies. |
| 50 user = gaia::CanonicalizeEmail(gaia::SanitizeEmail(user)); |
| 51 #endif |
| 45 SetAuthenticatedUsername(user); | 52 SetAuthenticatedUsername(user); |
| 53 } |
| 46 } | 54 } |
| 47 | 55 |
| 48 bool SigninManagerBase::IsInitialized() const { return initialized_; } | 56 bool SigninManagerBase::IsInitialized() const { return initialized_; } |
| 49 | 57 |
| 50 bool SigninManagerBase::IsSigninAllowed() const { | 58 bool SigninManagerBase::IsSigninAllowed() const { |
| 51 return client_->GetPrefs()->GetBoolean(prefs::kSigninAllowed); | 59 return client_->GetPrefs()->GetBoolean(prefs::kSigninAllowed); |
| 52 } | 60 } |
| 53 | 61 |
| 54 const std::string& SigninManagerBase::GetAuthenticatedUsername() const { | 62 const std::string& SigninManagerBase::GetAuthenticatedUsername() const { |
| 55 return authenticated_username_; | 63 return authenticated_username_; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 NotifySigninValueChanged(field, value)); | 137 NotifySigninValueChanged(field, value)); |
| 130 } | 138 } |
| 131 | 139 |
| 132 void SigninManagerBase::NotifyDiagnosticsObservers( | 140 void SigninManagerBase::NotifyDiagnosticsObservers( |
| 133 const TimedSigninStatusField& field, | 141 const TimedSigninStatusField& field, |
| 134 const std::string& value) { | 142 const std::string& value) { |
| 135 FOR_EACH_OBSERVER(SigninDiagnosticsObserver, | 143 FOR_EACH_OBSERVER(SigninDiagnosticsObserver, |
| 136 signin_diagnostics_observers_, | 144 signin_diagnostics_observers_, |
| 137 NotifySigninValueChanged(field, value)); | 145 NotifySigninValueChanged(field, value)); |
| 138 } | 146 } |
| OLD | NEW |