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

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

Issue 8935016: Contributed by Eriq Augustine <eriq.augustine@gmail.com> (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 8 years, 12 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_context_menu_api.cc
===================================================================
--- chrome/browser/extensions/extension_context_menu_api.cc (revision 116264)
+++ chrome/browser/extensions/extension_context_menu_api.cc (working copy)
@@ -269,6 +269,7 @@
}
bool UpdateContextMenuFunction::RunImpl() {
+ bool radioItemUpdated = false;
ExtensionMenuItem::Id item_id(profile(), extension_id(), 0);
EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &item_id.uid));
@@ -281,19 +282,21 @@
return false;
}
- DictionaryValue *properties = NULL;
+ DictionaryValue* properties = NULL;
EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &properties));
EXTENSION_FUNCTION_VALIDATE(properties != NULL);
- ExtensionMenuManager* menu_manager =
- profile()->GetExtensionService()->menu_manager();
-
// Type.
ExtensionMenuItem::Type type;
if (!ParseType(*properties, item->type(), &type))
return false;
- if (type != item->type())
+ if (type != item->type()) {
+ if (type == ExtensionMenuItem::RADIO ||
+ item->type() == ExtensionMenuItem::RADIO) {
+ radioItemUpdated = true;
+ }
item->set_type(type);
+ }
// Title.
if (properties->HasKey(kTitleKey)) {
@@ -313,6 +316,7 @@
if (checked != item->checked()) {
if (!item->SetChecked(checked))
return false;
+ radioItemUpdated = true;
}
// Contexts.
@@ -324,14 +328,19 @@
// Parent id.
ExtensionMenuItem* parent = NULL;
- if (!GetParent(*properties, *menu_manager, &parent))
+ if (!GetParent(*properties, *manager, &parent))
return false;
- if (parent && !menu_manager->ChangeParent(item->id(), &parent->id()))
+ if (parent && !manager->ChangeParent(item->id(), &parent->id()))
return false;
if (!SetURLPatterns(*properties, item))
return false;
+ // There is no need to call ItemUpdated if ChangeParent is called because
+ // all sanitation is taken care of in ChangeParent.
+ if (!parent && radioItemUpdated && !manager->ItemUpdated(item->id()))
+ return false;
+
return true;
}
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_menu_manager.h » ('j') | chrome/browser/extensions/extension_menu_manager.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698