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

Unified Diff: chrome/browser/extensions/menu_manager.cc

Issue 2823073003: Make Use of Value::GetList API
Patch Set: Further Usages 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
« no previous file with comments | « no previous file | chrome/browser/net/predictor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/menu_manager.cc
diff --git a/chrome/browser/extensions/menu_manager.cc b/chrome/browser/extensions/menu_manager.cc
index 7bfaf2d878036e95e6b304c81feb3af05259602f..78f5766ef1dcbd8836e5fdf9b285c6a0815a1b4d 100644
--- a/chrome/browser/extensions/menu_manager.cc
+++ b/chrome/browser/extensions/menu_manager.cc
@@ -663,14 +663,14 @@ void MenuManager::ExecuteCommand(content::BrowserContext* context,
webview_guest->view_instance_id());
}
- auto args = base::MakeUnique<base::ListValue>();
- args->Reserve(2);
- args->Append(std::move(properties));
+ auto args = base::MakeUnique<base::Value>();
+ args->GetList().reserve(2);
+ args->GetList().push_back(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);
+ base::DictionaryValue* raw_properties =
+ static_cast<base::DictionaryValue*>(&args->GetList()[0]);
// Add the tab info to the argument list.
// No tab info in a platform app.
@@ -681,9 +681,10 @@ void MenuManager::ExecuteCommand(content::BrowserContext* context,
if (frame_id != ExtensionApiFrameIdMap::kInvalidFrameId)
raw_properties->SetInteger("frameId", frame_id);
- args->Append(ExtensionTabUtil::CreateTabObject(web_contents)->ToValue());
+ args->GetList().push_back(
+ *ExtensionTabUtil::CreateTabObject(web_contents)->ToValue());
} else {
- args->Append(base::MakeUnique<base::DictionaryValue>());
+ args->GetList().push_back(base::DictionaryValue());
}
}
@@ -718,7 +719,7 @@ void MenuManager::ExecuteCommand(content::BrowserContext* context,
new Event(webview_guest ? events::WEB_VIEW_INTERNAL_CONTEXT_MENUS
: events::CONTEXT_MENUS,
webview_guest ? kOnWebviewContextMenus : kOnContextMenus,
- std::unique_ptr<base::ListValue>(args->DeepCopy())));
+ base::ListValue::From(args->CreateDeepCopy())));
event->restrict_to_browser_context = context;
event->user_gesture = EventRouter::USER_GESTURE_ENABLED;
event_router->DispatchEventToExtension(item->extension_id(),
@@ -731,7 +732,7 @@ void MenuManager::ExecuteCommand(content::BrowserContext* context,
: events::CONTEXT_MENUS_ON_CLICKED,
webview_guest ? api::chrome_web_view_internal::OnClicked::kEventName
: api::context_menus::OnClicked::kEventName,
- std::move(args)));
+ base::ListValue::From(std::move(args))));
event->restrict_to_browser_context = context;
event->user_gesture = EventRouter::USER_GESTURE_ENABLED;
if (webview_guest)
« no previous file with comments | « no previous file | chrome/browser/net/predictor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698