| 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 ProfileInfoCache& info = | 191 ProfileInfoCache& info = |
| 192 g_browser_process->profile_manager()->GetProfileInfoCache(); | 192 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 193 size_t info_index = info.GetIndexOfProfileWithPath(profile->GetPath()); | 193 size_t info_index = info.GetIndexOfProfileWithPath(profile->GetPath()); |
| 194 if (info_index == std::string::npos) { | 194 if (info_index == std::string::npos) { |
| 195 NOTREACHED(); // This should never happen but fail safely if it does. | 195 NOTREACHED(); // This should never happen but fail safely if it does. |
| 196 return false; | 196 return false; |
| 197 } | 197 } |
| 198 return ValidateLocalAuthCredentials(info_index, password); | 198 return ValidateLocalAuthCredentials(info_index, password); |
| 199 } | 199 } |
| 200 | 200 |
| 201 bool LocalAuthCredentialsExist(size_t info_index) { |
| 202 ProfileInfoCache& info = |
| 203 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 204 |
| 205 std::string encodedhash = |
| 206 info.GetLocalAuthCredentialsOfProfileAtIndex(info_index); |
| 207 |
| 208 return !encodedhash.empty(); |
| 209 } |
| 210 |
| 211 bool LocalAuthCredentialsExist(const Profile* profile) { |
| 212 DCHECK(profile); |
| 213 |
| 214 ProfileInfoCache& info = |
| 215 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 216 size_t info_index = info.GetIndexOfProfileWithPath(profile->GetPath()); |
| 217 if (info_index == std::string::npos) { |
| 218 NOTREACHED(); // This should never happen but fail safely if it does. |
| 219 return false; |
| 220 } |
| 221 return LocalAuthCredentialsExist(info_index); |
| 222 |
| 223 } |
| 224 |
| 201 } // namespace chrome | 225 } // namespace chrome |
| OLD | NEW |