Chromium Code Reviews| Index: chrome/browser/extensions/api/context_menu/context_menu_api.cc |
| diff --git a/chrome/browser/extensions/api/context_menu/context_menu_api.cc b/chrome/browser/extensions/api/context_menu/context_menu_api.cc |
| index 2976b065de8d2b24a457cc91f861996682d176b5..f318022cfdeb0b084561b131366b1ce9146b6f92 100644 |
| --- a/chrome/browser/extensions/api/context_menu/context_menu_api.cc |
| +++ b/chrome/browser/extensions/api/context_menu/context_menu_api.cc |
| @@ -21,12 +21,15 @@ const char kDocumentUrlPatternsKey[] = "documentUrlPatterns"; |
| const char kEnabledKey[] = "enabled"; |
| const char kGeneratedIdKey[] = "generatedId"; |
| const char kIdKey[] = "id"; |
| +const char kOnclickKey[] = "onclick"; |
| const char kParentIdKey[] = "parentId"; |
| const char kTargetUrlPatternsKey[] = "targetUrlPatterns"; |
| const char kTitleKey[] = "title"; |
| const char kTypeKey[] = "type"; |
| const char kCannotFindItemError[] = "Cannot find menu item with id *"; |
| +const char kOnclickDisallowedError[] = "Extensions using event pages cannot " |
| + "pass an onclick parameter to chrome.contextMenus.create"; |
|
Matt Perry
2012/06/01 01:57:15
nit: add "Use the chrome.contextMenus.onClicked ev
Yoyo Zhou
2012/06/01 18:17:52
Done.
|
| const char kCheckedError[] = |
| "Only items with type \"radio\" or \"checkbox\" can be checked"; |
| const char kDuplicateIDError[] = |
| @@ -207,6 +210,12 @@ bool CreateContextMenuFunction::RunImpl() { |
| return false; |
| } |
| + if (GetExtension()->has_lazy_background_page() && |
| + properties->HasKey(kOnclickKey)) { |
| + error_ = kOnclickDisallowedError; |
| + return false; |
| + } |
| + |
| ExtensionMenuItem::ContextList contexts(ExtensionMenuItem::PAGE); |
| if (!ParseContexts(*properties, kContextsKey, &contexts)) |
| return false; |