Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2357)

Unified Diff: chrome/browser/signin/local_auth.cc

Issue 497783002: Disable lock if no credentials are present (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Better variable name Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/signin/local_auth.cc
diff --git a/chrome/browser/signin/local_auth.cc b/chrome/browser/signin/local_auth.cc
index 55b955e25fd7a467bac1959d3637ea8ddec4ad32..0362afe3830fa7fec8eca48a03ad055a13c8ad0a 100644
--- a/chrome/browser/signin/local_auth.cc
+++ b/chrome/browser/signin/local_auth.cc
@@ -198,4 +198,28 @@ bool ValidateLocalAuthCredentials(const Profile* profile,
return ValidateLocalAuthCredentials(info_index, password);
}
+bool LocalAuthCredentialsExist(size_t profile_info_index) {
+ ProfileInfoCache& info =
+ g_browser_process->profile_manager()->GetProfileInfoCache();
+
+ std::string encodedhash =
+ info.GetLocalAuthCredentialsOfProfileAtIndex(profile_info_index);
+
+ return !encodedhash.empty();
+}
+
+bool LocalAuthCredentialsExist(const Profile* profile) {
+ DCHECK(profile);
+
+ ProfileInfoCache& info =
+ g_browser_process->profile_manager()->GetProfileInfoCache();
+ size_t info_index = info.GetIndexOfProfileWithPath(profile->GetPath());
+ 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.
+ NOTREACHED(); // This should never happen but fail safely if it does.
+ return false;
+ }
+ return LocalAuthCredentialsExist(info_index);
+
msw 2014/08/22 21:46:48 nit: remove blank line.
Mike Lerman 2014/08/25 14:44:30 Done.
+}
+
} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698