Chromium Code Reviews| 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 profile_info_index) { | |
| 202 ProfileInfoCache& info = | |
| 203 g_browser_process->profile_manager()->GetProfileInfoCache(); | |
| 204 | |
| 205 std::string encodedhash = | |
| 206 info.GetLocalAuthCredentialsOfProfileAtIndex(profile_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) { | |
|
msw
2014/08/22 21:46:48
Should this logic be in the |profile_info_index| f
Mike Lerman
2014/08/25 14:44:30
I turned the NOTREACHED into a DCHECK and put it o
msw
2014/08/25 17:39:54
I appreciate the cleanup, but you've removed the "
Mike Lerman
2014/08/25 18:11:37
Did I? The DCHECK(profile) is now in the common me
msw
2014/08/25 18:54:03
The early return [false] statements. The old code
Mike Lerman
2014/08/25 19:05:11
Gotcha, done.
| |
| 218 NOTREACHED(); // This should never happen but fail safely if it does. | |
| 219 return false; | |
| 220 } | |
| 221 return LocalAuthCredentialsExist(info_index); | |
| 222 | |
|
msw
2014/08/22 21:46:48
nit: remove blank line.
Mike Lerman
2014/08/25 14:44:30
Done.
| |
| 223 } | |
| 224 | |
| 201 } // namespace chrome | 225 } // namespace chrome |
| OLD | NEW |