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

Unified Diff: chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.cc

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.cc
diff --git a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.cc b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.cc
index cb389ed55e4673aad7b1bad6772e3bd82d9964d5..3c59fb07e065e582dbb1311d2e6b7912a28f06dc 100644
--- a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.cc
+++ b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.cc
@@ -184,7 +184,7 @@ void EasyUnlockTpmKeyManager::RegisterLocalStatePrefs(
// static
void EasyUnlockTpmKeyManager::ResetLocalStateForUser(
- const std::string& user_id) {
+ const user_manager::UserID& user_id) {
if (!g_browser_process)
return;
PrefService* local_state = g_browser_process->local_state();
@@ -192,11 +192,11 @@ void EasyUnlockTpmKeyManager::ResetLocalStateForUser(
return;
DictionaryPrefUpdate update(local_state, prefs::kEasyUnlockLocalStateTpmKeys);
- update->RemoveWithoutPathExpansion(user_id, NULL);
+ update->RemoveWithoutPathExpansion(user_id.GetUserEmail(), NULL);
}
EasyUnlockTpmKeyManager::EasyUnlockTpmKeyManager(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
const std::string& username_hash,
PrefService* local_state)
: user_id_(user_id),
@@ -257,21 +257,21 @@ bool EasyUnlockTpmKeyManager::StartGetSystemSlotTimeoutMs(size_t timeout_ms) {
}
std::string EasyUnlockTpmKeyManager::GetPublicTpmKey(
- const std::string& user_id) {
+ const user_manager::UserID& user_id) {
if (!local_state_)
return std::string();
const base::DictionaryValue* dict =
local_state_->GetDictionary(prefs::kEasyUnlockLocalStateTpmKeys);
std::string key;
if (dict)
- dict->GetStringWithoutPathExpansion(user_id, &key);
+ dict->GetStringWithoutPathExpansion(user_id.GetUserEmail(), &key);
std::string decoded;
base::Base64Decode(key, &decoded);
return decoded;
}
void EasyUnlockTpmKeyManager::SignUsingTpmKey(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
const std::string& data,
const base::Callback<void(const std::string& data)> callback) {
std::string key = GetPublicTpmKey(user_id);
@@ -298,7 +298,7 @@ bool EasyUnlockTpmKeyManager::StartedCreatingTpmKeys() const {
create_tpm_key_state_ == CREATE_TPM_KEY_DONE;
}
-void EasyUnlockTpmKeyManager::SetKeyInLocalState(const std::string& user_id,
+void EasyUnlockTpmKeyManager::SetKeyInLocalState(const user_manager::UserID& user_id,
const std::string& value) {
if (!local_state_)
return;
@@ -307,7 +307,7 @@ void EasyUnlockTpmKeyManager::SetKeyInLocalState(const std::string& user_id,
base::Base64Encode(value, &encoded);
DictionaryPrefUpdate update(local_state_,
prefs::kEasyUnlockLocalStateTpmKeys);
- update->SetStringWithoutPathExpansion(user_id, encoded);
+ update->SetStringWithoutPathExpansion(user_id.GetUserEmail(), encoded);
}
void EasyUnlockTpmKeyManager::OnUserTPMInitialized(

Powered by Google App Engine
This is Rietveld 408576698