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

Unified Diff: chrome/browser/extensions/api/commands/command_service.cc

Issue 2777063003: Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Fix SupervisedUserWhitelistInstaller Created 3 years, 8 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/extensions/api/commands/command_service.cc
diff --git a/chrome/browser/extensions/api/commands/command_service.cc b/chrome/browser/extensions/api/commands/command_service.cc
index 772a9390f938b71a251fe5bfb85c27f23d023904..31649d53265b8ef6049537d1d0e3babd16f32be1 100644
--- a/chrome/browser/extensions/api/commands/command_service.cc
+++ b/chrome/browser/extensions/api/commands/command_service.cc
@@ -277,12 +277,12 @@ bool CommandService::AddKeybindingPref(
RemoveKeybindingPrefs(extension_id, command_name);
// Set the keybinding pref.
- base::DictionaryValue* keybinding = new base::DictionaryValue();
+ auto keybinding = base::MakeUnique<base::DictionaryValue>();
keybinding->SetString(kExtension, extension_id);
keybinding->SetString(kCommandName, command_name);
keybinding->SetBoolean(kGlobal, global);
- bindings->Set(key, keybinding);
+ bindings->Set(key, std::move(keybinding));
// Set the was_assigned pref for the suggested key.
std::unique_ptr<base::DictionaryValue> command_keys(
@@ -290,7 +290,7 @@ bool CommandService::AddKeybindingPref(
command_keys->SetBoolean(kSuggestedKeyWasAssigned, true);
std::unique_ptr<base::DictionaryValue> suggested_key_prefs(
new base::DictionaryValue);
- suggested_key_prefs->Set(command_name, command_keys.release());
+ suggested_key_prefs->Set(command_name, std::move(command_keys));
MergeSuggestedKeyPrefs(extension_id, ExtensionPrefs::Get(profile_),
std::move(suggested_key_prefs));
@@ -646,7 +646,7 @@ void CommandService::UpdateExtensionSuggestedCommandPrefs(
command_keys->SetString(
kSuggestedKey,
Command::AcceleratorToString(command.accelerator()));
- suggested_key_prefs->Set(command.command_name(), command_keys.release());
+ suggested_key_prefs->Set(command.command_name(), std::move(command_keys));
}
}
@@ -663,7 +663,7 @@ void CommandService::UpdateExtensionSuggestedCommandPrefs(
kSuggestedKey,
Command::AcceleratorToString(browser_action_command->accelerator()));
suggested_key_prefs->Set(browser_action_command->command_name(),
- command_keys.release());
+ std::move(command_keys));
}
const Command* page_action_command =
@@ -675,7 +675,7 @@ void CommandService::UpdateExtensionSuggestedCommandPrefs(
kSuggestedKey,
Command::AcceleratorToString(page_action_command->accelerator()));
suggested_key_prefs->Set(page_action_command->command_name(),
- command_keys.release());
+ std::move(command_keys));
}
// Merge into current prefs, if present.

Powered by Google App Engine
This is Rietveld 408576698