| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/local_auth.h" | 5 #include "chrome/browser/signin/local_auth.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 return crypto::SecureMemEqual(password_saved, password_check, | 191 return crypto::SecureMemEqual(password_saved, password_check, |
| 192 password_length); | 192 password_length); |
| 193 } | 193 } |
| 194 | 194 |
| 195 bool ValidateLocalAuthCredentials(const Profile* profile, | 195 bool ValidateLocalAuthCredentials(const Profile* profile, |
| 196 const std::string& password) { | 196 const std::string& password) { |
| 197 return ValidateLocalAuthCredentials(GetProfileInfoIndexOfProfile(profile), | 197 return ValidateLocalAuthCredentials(GetProfileInfoIndexOfProfile(profile), |
| 198 password); | 198 password); |
| 199 } | 199 } |
| 200 | 200 |
| 201 bool LocalAuthCredentialsExist(size_t profile_info_index) { | |
| 202 if (profile_info_index == std::string::npos) { | |
| 203 NOTREACHED(); | |
| 204 return false; | |
| 205 } | |
| 206 | |
| 207 ProfileInfoCache& info = | |
| 208 g_browser_process->profile_manager()->GetProfileInfoCache(); | |
| 209 | |
| 210 std::string encodedhash = | |
| 211 info.GetLocalAuthCredentialsOfProfileAtIndex(profile_info_index); | |
| 212 | |
| 213 return !encodedhash.empty(); | |
| 214 } | |
| 215 | |
| 216 bool LocalAuthCredentialsExist(const Profile* profile) { | |
| 217 return LocalAuthCredentialsExist(GetProfileInfoIndexOfProfile(profile)); | |
| 218 } | |
| 219 | |
| 220 } // namespace chrome | 201 } // namespace chrome |
| OLD | NEW |