Chromium Code Reviews| Index: chrome/browser/extensions/api/context_menus/context_menus_api_helpers.h |
| diff --git a/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.h b/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.h |
| index 773bd6249014a07855af73cdd2f518564e0e2e9c..b6e5d9ae95db0430c2b8b10aaa9b3e21b4cc0bdb 100644 |
| --- a/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.h |
| +++ b/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.h |
| @@ -43,6 +43,7 @@ extern const char kCheckedError[]; |
| extern const char kDuplicateIDError[]; |
| extern const char kGeneratedIdKey[]; |
| extern const char kLauncherNotAllowedError[]; |
| +extern const char kActionNotAllowedError[]; |
| extern const char kOnclickDisallowedError[]; |
| extern const char kParentsMustBeNormalError[]; |
| extern const char kTitleNeededError[]; |
| @@ -89,6 +90,14 @@ MenuItem::ContextList GetContexts(const PropertyWithEnumT& property) { |
| // Not available for <webview>. |
| contexts.Add(extensions::MenuItem::LAUNCHER); |
| break; |
| + case PropertyWithEnumT::CONTEXTS_TYPE_BROWSER_ACTION: |
| + // Not available for <webview>. |
| + contexts.Add(extensions::MenuItem::BROWSER_ACTION); |
| + break; |
| + case PropertyWithEnumT::CONTEXTS_TYPE_PAGE_ACTION: |
| + // Not available for <webview>. |
| + contexts.Add(extensions::MenuItem::PAGE_ACTION); |
| + break; |
| case PropertyWithEnumT::CONTEXTS_TYPE_NONE: |
| NOTREACHED(); |
| } |
| @@ -151,6 +160,15 @@ bool CreateMenuItem(const PropertyWithEnumT& create_properties, |
| } |
| } |
| + if (contexts.Contains(MenuItem::BROWSER_ACTION) || |
| + contexts.Contains(MenuItem::PAGE_ACTION)) { |
| + // Action items are not allowed for <webview>. |
| + if (!extension->is_platform_app() || is_webview) { |
|
Yoyo Zhou
2014/07/24 00:17:58
Actually, the comment above is not really clear. L
gpdavis
2014/07/24 00:23:32
Ah, I see. I should have paid more attention to b
|
| + *error = kActionNotAllowedError; |
| + return false; |
| + } |
| + } |
| + |
| // Title. |
| std::string title; |
| if (create_properties.title.get()) |