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

Unified Diff: chrome/browser/chromeos/policy/cloud_external_data_policy_observer.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/policy/cloud_external_data_policy_observer.cc
diff --git a/chrome/browser/chromeos/policy/cloud_external_data_policy_observer.cc b/chrome/browser/chromeos/policy/cloud_external_data_policy_observer.cc
index 2c7f590e3c421f3c204554ff3a620bf2961b3547..a4278ed5f0b3bfc6a366befe3fc02ea885400782 100644
--- a/chrome/browser/chromeos/policy/cloud_external_data_policy_observer.cc
+++ b/chrome/browser/chromeos/policy/cloud_external_data_policy_observer.cc
@@ -38,7 +38,7 @@ class CloudExternalDataPolicyObserver::PolicyServiceObserver
: public PolicyService::Observer {
public:
PolicyServiceObserver(CloudExternalDataPolicyObserver* parent,
- const std::string& user_id,
+ const user_manager::UserID& user_id,
PolicyService* policy_service);
~PolicyServiceObserver() override;
@@ -49,7 +49,7 @@ class CloudExternalDataPolicyObserver::PolicyServiceObserver
private:
CloudExternalDataPolicyObserver* parent_;
- const std::string user_id_;
+ const user_manager::UserID user_id_;
PolicyService* policy_service_;
DISALLOW_COPY_AND_ASSIGN(PolicyServiceObserver);
@@ -57,7 +57,7 @@ class CloudExternalDataPolicyObserver::PolicyServiceObserver
CloudExternalDataPolicyObserver::PolicyServiceObserver::PolicyServiceObserver(
CloudExternalDataPolicyObserver* parent,
- const std::string& user_id,
+ const user_manager::UserID& user_id,
PolicyService* policy_service)
: parent_(parent),
user_id_(user_id),
@@ -102,17 +102,17 @@ void CloudExternalDataPolicyObserver::PolicyServiceObserver::OnPolicyUpdated(
void CloudExternalDataPolicyObserver::Delegate::OnExternalDataSet(
const std::string& policy,
- const std::string& user_id) {
+ const user_manager::UserID& user_id) {
}
void CloudExternalDataPolicyObserver::Delegate::OnExternalDataCleared(
const std::string& policy,
- const std::string& user_id) {
+ const user_manager::UserID& user_id) {
}
void CloudExternalDataPolicyObserver::Delegate::OnExternalDataFetched(
const std::string& policy,
- const std::string& user_id,
+ const user_manager::UserID& user_id,
scoped_ptr<std::string> data) {
}
@@ -175,7 +175,7 @@ void CloudExternalDataPolicyObserver::Observe(
return;
}
- const std::string& user_id = user->email();
+ const user_manager::UserID& user_id = user->GetUserID();
if (ContainsKey(logged_in_user_observers_, user_id)) {
NOTREACHED();
return;
@@ -190,7 +190,7 @@ void CloudExternalDataPolicyObserver::Observe(
}
void CloudExternalDataPolicyObserver::OnPolicyUpdated(
- const std::string& user_id) {
+ const user_manager::UserID& user_id) {
if (ContainsKey(logged_in_user_observers_, user_id)) {
// When a device-local account is logged in, a policy change triggers both
// OnPolicyUpdated() and PolicyServiceObserver::OnPolicyUpdated(). Ignore
@@ -252,7 +252,7 @@ void CloudExternalDataPolicyObserver::RetrieveDeviceLocalAccounts() {
std::vector<DeviceLocalAccount> device_local_account_list =
policy::GetDeviceLocalAccounts(cros_settings_);
- std::set<std::string> device_local_accounts;
+ std::set<user_manager::UserID> device_local_accounts;
for (std::vector<DeviceLocalAccount>::const_iterator it =
device_local_account_list.begin();
it != device_local_account_list.end(); ++it) {
@@ -263,7 +263,7 @@ void CloudExternalDataPolicyObserver::RetrieveDeviceLocalAccounts() {
device_local_account_entries_.begin();
it != device_local_account_entries_.end(); ) {
if (!ContainsKey(device_local_accounts, it->first)) {
- const std::string user_id = it->first;
+ const user_manager::UserID user_id = it->first;
it->second.DeleteOwnedMembers();
device_local_account_entries_.erase(it++);
// When a device-local account whose external data reference was set is
@@ -275,14 +275,14 @@ void CloudExternalDataPolicyObserver::RetrieveDeviceLocalAccounts() {
}
}
- for (std::set<std::string>::const_iterator it = device_local_accounts.begin();
+ for (std::set<user_manager::UserID>::const_iterator it = device_local_accounts.begin();
it != device_local_accounts.end(); ++it) {
OnPolicyUpdated(*it);
}
}
void CloudExternalDataPolicyObserver::HandleExternalDataPolicyUpdate(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
const PolicyMap::Entry* entry) {
if (!entry) {
delegate_->OnExternalDataCleared(policy_, user_id);
@@ -305,7 +305,7 @@ void CloudExternalDataPolicyObserver::HandleExternalDataPolicyUpdate(
}
void CloudExternalDataPolicyObserver::OnExternalDataFetched(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
scoped_ptr<std::string> data) {
FetchWeakPtrMap::iterator it = fetch_weak_ptrs_.find(user_id);
DCHECK(it != fetch_weak_ptrs_.end());

Powered by Google App Engine
This is Rietveld 408576698