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

Unified Diff: chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.cc

Issue 2765363004: Stop passing raw pointers to DictionaryValue::Set, part 2 (Closed)
Patch Set: Fix comments Created 3 years, 9 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/supervised/supervised_user_creation_screen.cc
diff --git a/chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.cc b/chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.cc
index aabc0ae87b52f6d78dc381da0d467a33da8c873b..40f554fa8b0e4f9bdb5f823ac6b958e83b171cb3 100644
--- a/chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.cc
+++ b/chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.cc
@@ -529,9 +529,10 @@ void SupervisedUserCreationScreen::OnGetSupervisedUsers(
existing_users_.reset(new base::DictionaryValue());
for (base::DictionaryValue::Iterator it(*users); !it.IsAtEnd();
it.Advance()) {
+ const base::DictionaryValue* value = nullptr;
+ it.value().GetAsDictionary(&value);
// Copy that would be stored in this class.
- base::DictionaryValue* local_copy =
- static_cast<base::DictionaryValue*>(it.value().DeepCopy());
+ std::unique_ptr<base::DictionaryValue> local_copy = value->CreateDeepCopy();
// Copy that would be passed to WebUI. It has some extra values for
// displaying, but does not contain sensitive data, such as master password.
auto ui_copy = base::MakeUnique<base::DictionaryValue>();
@@ -584,7 +585,7 @@ void SupervisedUserCreationScreen::OnGetSupervisedUsers(
ui_copy->SetBoolean(kUserNeedPassword, !has_password);
ui_copy->SetString("id", it.key());
- existing_users_->Set(it.key(), local_copy);
+ existing_users_->Set(it.key(), std::move(local_copy));
ui_users->Append(std::move(ui_copy));
}
view_->ShowExistingSupervisedUsers(ui_users.get());

Powered by Google App Engine
This is Rietveld 408576698