Index: chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.cc |
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.cc b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.cc |
index 43b72890b144aaf3e8df9b175a1362166c39dd8a..ba548ad7883954f429fb7bc55938fd8dc9457ce0 100644 |
--- a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.cc |
+++ b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.cc |
@@ -49,9 +49,9 @@ void SampleValidationFailure(ValidationFailure sample) { |
VALIDATION_FAILURE_SIZE); |
} |
-// Extracts the domain name from the passed username. |
-std::string ExtractDomain(const std::string& username) { |
- return gaia::ExtractDomainName(gaia::CanonicalizeEmail(username)); |
+// Extracts the domain name from the passed user_email. |
+std::string ExtractDomain(const std::string& user_email) { |
+ return gaia::ExtractDomainName(gaia::CanonicalizeEmail(user_email)); |
} |
} // namespace |
@@ -174,14 +174,14 @@ UserCloudPolicyStoreChromeOS::UserCloudPolicyStoreChromeOS( |
chromeos::CryptohomeClient* cryptohome_client, |
chromeos::SessionManagerClient* session_manager_client, |
scoped_refptr<base::SequencedTaskRunner> background_task_runner, |
- const std::string& username, |
+ const user_manager::UserID& user_id, |
const base::FilePath& user_policy_key_dir, |
const base::FilePath& legacy_token_cache_file, |
const base::FilePath& legacy_policy_cache_file) |
: UserCloudPolicyStoreBase(background_task_runner), |
cryptohome_client_(cryptohome_client), |
session_manager_client_(session_manager_client), |
- username_(username), |
+ user_id_(user_id), |
user_policy_key_dir_(user_policy_key_dir), |
legacy_cache_dir_(legacy_token_cache_file.DirName()), |
legacy_loader_(new LegacyPolicyCacheLoader(legacy_token_cache_file, |
@@ -209,7 +209,7 @@ void UserCloudPolicyStoreChromeOS::Load() { |
// Cancel all pending requests. |
weak_factory_.InvalidateWeakPtrs(); |
session_manager_client_->RetrievePolicyForUser( |
- username_, |
+ user_id_, |
base::Bind(&UserCloudPolicyStoreChromeOS::OnPolicyRetrieved, |
weak_factory_.GetWeakPtr())); |
} |
@@ -224,7 +224,7 @@ void UserCloudPolicyStoreChromeOS::LoadImmediately() { |
// Profile initialization never sees unmanaged prefs, which would lead to |
// data loss. http://crbug.com/263061 |
std::string policy_blob = |
- session_manager_client_->BlockingRetrievePolicyForUser(username_); |
+ session_manager_client_->BlockingRetrievePolicyForUser(user_id_); |
if (policy_blob.empty()) { |
// The session manager doesn't have policy, or the call failed. |
// Just notify that the load is done, and don't bother with the legacy |
@@ -241,7 +241,7 @@ void UserCloudPolicyStoreChromeOS::LoadImmediately() { |
} |
std::string sanitized_username = |
- cryptohome_client_->BlockingGetSanitizedUsername(username_); |
+ cryptohome_client_->BlockingGetSanitizedUsername(user_id_); |
if (sanitized_username.empty()) { |
status_ = STATUS_LOAD_ERROR; |
NotifyStoreError(); |
@@ -265,15 +265,15 @@ void UserCloudPolicyStoreChromeOS::ValidatePolicyForStore( |
scoped_ptr<UserCloudPolicyValidator> validator = |
CreateValidator(policy.Pass(), |
CloudPolicyValidatorBase::TIMESTAMP_REQUIRED); |
- validator->ValidateUsername(username_, true); |
+ validator->ValidateUsername(user_id_, true); |
if (policy_key_.empty()) { |
validator->ValidateInitialKey(GetPolicyVerificationKey(), |
- ExtractDomain(username_)); |
+ ExtractDomain(user_id_.GetUserEmail())); |
} else { |
const bool allow_rotation = true; |
validator->ValidateSignature(policy_key_, |
GetPolicyVerificationKey(), |
- ExtractDomain(username_), |
+ ExtractDomain(user_id_.GetUserEmail()), |
allow_rotation); |
} |
@@ -307,7 +307,7 @@ void UserCloudPolicyStoreChromeOS::OnPolicyToStoreValidated( |
} |
session_manager_client_->StorePolicyForUser( |
- username_, |
+ user_id_, |
policy_blob, |
base::Bind(&UserCloudPolicyStoreChromeOS::OnPolicyStored, |
weak_factory_.GetWeakPtr())); |
@@ -415,7 +415,7 @@ void UserCloudPolicyStoreChromeOS::OnLegacyLoadFinished( |
scoped_ptr<UserCloudPolicyValidator> validator = |
CreateValidator(policy.Pass(), |
CloudPolicyValidatorBase::TIMESTAMP_REQUIRED); |
- validator->ValidateUsername(username_, true); |
+ validator->ValidateUsername(user_id_, true); |
validator.release()->StartValidation( |
base::Bind(&UserCloudPolicyStoreChromeOS::OnLegacyPolicyValidated, |
weak_factory_.GetWeakPtr(), |
@@ -527,7 +527,7 @@ void UserCloudPolicyStoreChromeOS::EnsurePolicyKeyLoaded( |
} else { |
// Get the hashed username that's part of the key's path, to determine |
// |policy_key_path_|. |
- cryptohome_client_->GetSanitizedUsername(username_, |
+ cryptohome_client_->GetSanitizedUsername(user_id_, |
base::Bind(&UserCloudPolicyStoreChromeOS::OnGetSanitizedUsername, |
weak_factory_.GetWeakPtr(), |
callback)); |
@@ -554,7 +554,7 @@ UserCloudPolicyStoreChromeOS::CreateValidatorForLoad( |
scoped_ptr<em::PolicyFetchResponse> policy) { |
scoped_ptr<UserCloudPolicyValidator> validator = CreateValidator( |
policy.Pass(), CloudPolicyValidatorBase::TIMESTAMP_NOT_BEFORE); |
- validator->ValidateUsername(username_, true); |
+ validator->ValidateUsername(user_id_, true); |
const bool allow_rotation = false; |
const std::string empty_key = std::string(); |
// The policy loaded from session manager need not be validated using the |
@@ -562,7 +562,7 @@ UserCloudPolicyStoreChromeOS::CreateValidatorForLoad( |
// data that was stored without a verification key. Hence passing an empty |
// value for the verification key. |
validator->ValidateSignature( |
- policy_key_, empty_key, ExtractDomain(username_), allow_rotation); |
+ policy_key_, empty_key, ExtractDomain(user_id_.GetUserEmail()), allow_rotation); |
return validator.Pass(); |
} |
} // namespace policy |