Chromium Code Reviews| Index: chrome/browser/extensions/menu_manager.cc |
| diff --git a/chrome/browser/extensions/menu_manager.cc b/chrome/browser/extensions/menu_manager.cc |
| index 11acf54ca5d1458c8ee8c4ea7ee8248ce2157998..4f021eb6ad16bada7a3e8200ccc59c8ef470ecbe 100644 |
| --- a/chrome/browser/extensions/menu_manager.cc |
| +++ b/chrome/browser/extensions/menu_manager.cc |
| @@ -626,7 +626,6 @@ void MenuManager::ExecuteCommand(content::BrowserContext* context, |
| if (item->type() == MenuItem::RADIO) |
| RadioItemSelected(item); |
| - std::unique_ptr<base::ListValue> args(new base::ListValue()); |
| std::unique_ptr<base::DictionaryValue> properties( |
| new base::DictionaryValue()); |
| @@ -665,8 +664,14 @@ void MenuManager::ExecuteCommand(content::BrowserContext* context, |
| webview_guest->view_instance_id()); |
| } |
| - base::DictionaryValue* raw_properties = properties.get(); |
| + std::unique_ptr<base::ListValue> args(new base::ListValue()); |
|
Devlin
2017/03/30 22:44:59
nit: prefer base::MakeUnique<>.
jdoerrie
2017/04/07 13:56:17
Done.
|
| + args->Reserve(2); |
| args->Append(std::move(properties)); |
| + // |properties| is invalidated at this time, which is why |args| needs to be |
| + // queried for the pointer. The obtained pointer is guaranteed to stay valid |
| + // even after further Appends, because enough storage was reserved above. |
| + base::DictionaryValue* raw_properties = nullptr; |
| + args->GetDictionary(0, &raw_properties); |
| // Add the tab info to the argument list. |
| // No tab info in a platform app. |