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

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

Issue 877033005: Use a stable device-user identifier for CryptAuth enrollments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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/easy_unlock_service.cc
diff --git a/chrome/browser/signin/easy_unlock_service.cc b/chrome/browser/signin/easy_unlock_service.cc
index a9005303ae869e556cc34f16dbd9b4dad49002fa..0e25be41f159149d3da0808810787319da69682c 100644
--- a/chrome/browser/signin/easy_unlock_service.cc
+++ b/chrome/browser/signin/easy_unlock_service.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/command_line.h"
+#include "base/guid.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/prefs/pref_registry_simple.h"
@@ -240,8 +241,9 @@ void EasyUnlockService::RegisterProfilePrefs(
// static
void EasyUnlockService::RegisterPrefs(PrefRegistrySimple* registry) {
- registry->RegisterDictionaryPref(prefs::kEasyUnlockLocalStateUserPrefs);
+ registry->RegisterStringPref(prefs::kEasyUnlockDeviceId, std::string());
registry->RegisterDictionaryPref(prefs::kEasyUnlockHardlockState);
+ registry->RegisterDictionaryPref(prefs::kEasyUnlockLocalStateUserPrefs);
#if defined(OS_CHROMEOS)
EasyUnlockTpmKeyManager::RegisterLocalStatePrefs(registry);
#endif
@@ -290,6 +292,21 @@ EasyUnlockService::UserSettings EasyUnlockService::GetUserSettings(
return user_settings;
}
+// static
+std::string EasyUnlockService::GetDeviceId() {
+ PrefService* local_state = GetLocalState();
+ if (!local_state)
+ return std::string();
+
+ std::string device_id =
+ local_state->GetString(prefs::kEasyUnlockDeviceId);
+ if (device_id.empty()) {
+ device_id = base::GenerateGUID();
+ local_state->SetString(prefs::kEasyUnlockDeviceId, device_id);
+ }
+ return device_id;
+}
+
bool EasyUnlockService::IsAllowed() {
if (shut_down_)
return false;

Powered by Google App Engine
This is Rietveld 408576698