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

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

Issue 10694085: Refactor extension event distribution to use Values instead of JSON strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Build fix. Created 8 years, 5 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/extension_menu_manager.cc
diff --git a/chrome/browser/extensions/extension_menu_manager.cc b/chrome/browser/extensions/extension_menu_manager.cc
index 48903fa19aeea6352164fbc24112a55d9644cdc4..2f7ff06fe2aabcce4aae45dd0dcea2fb3a1e5f4b 100644
--- a/chrome/browser/extensions/extension_menu_manager.cc
+++ b/chrome/browser/extensions/extension_menu_manager.cc
@@ -589,7 +589,7 @@ void ExtensionMenuManager::ExecuteCommand(
if (item->type() == ExtensionMenuItem::RADIO)
RadioItemSelected(item);
- ListValue args;
+ ListValue* args = new ListValue();
DictionaryValue* properties = new DictionaryValue();
SetIdKeyValue(properties, "menuItemId", item->id());
@@ -619,14 +619,14 @@ void ExtensionMenuManager::ExecuteCommand(
properties->SetBoolean("editable", params.is_editable);
- args.Append(properties);
+ args->Append(properties);
// Add the tab info to the argument list.
// Note: web_contents only NULL in unit tests :(
if (web_contents)
- args.Append(ExtensionTabUtil::CreateTabValue(web_contents));
+ args->Append(ExtensionTabUtil::CreateTabValue(web_contents));
else
- args.Append(new DictionaryValue());
+ args->Append(new DictionaryValue());
if (item->type() == ExtensionMenuItem::CHECKBOX ||
item->type() == ExtensionMenuItem::RADIO) {
@@ -652,16 +652,12 @@ void ExtensionMenuManager::ExecuteCommand(
GrantIfRequested(extension);
}
- std::string json_args;
- base::JSONWriter::Write(&args, &json_args);
event_router->DispatchEventToExtension(
item->extension_id(), extension_event_names::kOnContextMenus,
- json_args, profile, GURL(),
- ExtensionEventRouter::USER_GESTURE_ENABLED);
+ args, profile, GURL(), ExtensionEventRouter::USER_GESTURE_ENABLED);
event_router->DispatchEventToExtension(
item->extension_id(), extension_event_names::kOnContextMenuClicked,
- json_args, profile, GURL(),
- ExtensionEventRouter::USER_GESTURE_ENABLED);
+ args, profile, GURL(), ExtensionEventRouter::USER_GESTURE_ENABLED);
}
void ExtensionMenuManager::SanitizeRadioList(

Powered by Google App Engine
This is Rietveld 408576698