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

Unified Diff: chrome/browser/ui/webui/options/create_profile_handler.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/ui/webui/options/create_profile_handler.cc
diff --git a/chrome/browser/ui/webui/options/create_profile_handler.cc b/chrome/browser/ui/webui/options/create_profile_handler.cc
index ef749c8c69427164ee11fb01c391cceed8586c15..ce490c27be0b851bfc54fc7976aff14d93887a88 100644
--- a/chrome/browser/ui/webui/options/create_profile_handler.cc
+++ b/chrome/browser/ui/webui/options/create_profile_handler.cc
@@ -93,7 +93,7 @@ void CreateProfileHandler::CreateProfile(const base::ListValue* args) {
CHECK(!name.empty());
args->GetBoolean(2, &create_shortcut);
}
- std::string supervised_user_id;
+ user_manager::UserID supervised_user_id = user_manager::UserID(std::string(), std::string());
#if defined(ENABLE_SUPERVISED_USERS)
if (!ProcessSupervisedCreateProfileArgs(args, &supervised_user_id))
return;
@@ -114,7 +114,7 @@ void CreateProfileHandler::CreateProfile(const base::ListValue* args) {
void CreateProfileHandler::OnProfileCreated(
bool create_shortcut,
chrome::HostDesktopType desktop_type,
- const std::string& supervised_user_id,
+ const user_manager::UserID& supervised_user_id,
Profile* profile,
Profile::CreateStatus status) {
if (status != Profile::CREATE_STATUS_CREATED)
@@ -150,7 +150,7 @@ void CreateProfileHandler::OnProfileCreated(
void CreateProfileHandler::HandleProfileCreationSuccess(
bool create_shortcut,
chrome::HostDesktopType desktop_type,
- const std::string& supervised_user_id,
+ const user_manager::UserID& supervised_user_id,
Profile* profile) {
switch (profile_creation_type_) {
case NON_SUPERVISED_PROFILE_CREATION: {
@@ -302,14 +302,16 @@ std::string CreateProfileHandler::GetJavascriptMethodName(
#if defined(ENABLE_SUPERVISED_USERS)
bool CreateProfileHandler::ProcessSupervisedCreateProfileArgs(
- const base::ListValue* args, std::string* supervised_user_id) {
+ const base::ListValue* args, user_manager::UserID* supervised_user_id) {
bool supervised_user = false;
if (args->GetSize() >= 5) {
bool success = args->GetBoolean(3, &supervised_user);
DCHECK(success);
- success = args->GetString(4, supervised_user_id);
+ std::string supervised_user_email;
+ success = args->GetString(4, &supervised_user_email);
DCHECK(success);
+ *(supervised_user_id) = user_manager::UserID::FromUserEmail(supervised_user_email);
}
if (supervised_user) {
@@ -378,7 +380,7 @@ void CreateProfileHandler::CancelProfileRegistration(bool user_initiated) {
void CreateProfileHandler::RegisterSupervisedUser(
bool create_shortcut,
chrome::HostDesktopType desktop_type,
- const std::string& supervised_user_id,
+ const user_manager::UserID& supervised_user_id,
Profile* new_profile) {
DCHECK_EQ(profile_path_being_created_.value(),
new_profile->GetPath().value());
@@ -452,7 +454,7 @@ void CreateProfileHandler::RecordSupervisedProfileCreationMetrics(
}
bool CreateProfileHandler::IsValidExistingSupervisedUserId(
- const std::string& existing_supervised_user_id) const {
+ const user_manager::UserID& existing_supervised_user_id) const {
if (existing_supervised_user_id.empty())
return true;
@@ -460,7 +462,7 @@ bool CreateProfileHandler::IsValidExistingSupervisedUserId(
const base::DictionaryValue* dict =
SupervisedUserSyncServiceFactory::GetForProfile(profile)->
GetSupervisedUsers();
- if (!dict->HasKey(existing_supervised_user_id))
+ if (!dict->HasKey(existing_supervised_user_id.GetUserEmail()))
return false;
// Check if this supervised user already exists on this machine.

Powered by Google App Engine
This is Rietveld 408576698