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 430a98f3671abd7370e5b052d907cbf417dbbb7a..a70603804decb19104df90895c716cd811bb2642 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" |
@@ -219,8 +220,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 |
@@ -269,6 +271,20 @@ 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; |
+} |
+ |
void EasyUnlockService::Initialize( |
scoped_ptr<EasyUnlockAppManager> app_manager) { |
app_manager_ = app_manager.Pass(); |