Some cleanup of the extensions context menu API.
This CL contains the following:
-Use lower case names for enum values in the create/update properties (eg 'page' instead of 'PAGE')
-Make the top-level API name plural (contextMenus instead of contextMenu)
-Don't fire onclick handlers for a parent menu item when one of its children is clicked on.
-Remove the enabledContexts property for now, to eventually be replaced with a way to programmatically enable/disable.
There are a few more things in the bug that I'll be doing in subsequent CL's.
BUG=48198
TEST=Extensions using the context menu API should work with the changes described above.
Review URL: http://codereview.chromium.org/2887013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51970 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extension_menu_manager.h b/chrome/browser/extensions/extension_menu_manager.h
index c3f82c5..98752f8 100644
--- a/chrome/browser/extensions/extension_menu_manager.h
+++ b/chrome/browser/extensions/extension_menu_manager.h
@@ -32,8 +32,7 @@
// A list of ExtensionMenuItem's.
typedef std::vector<ExtensionMenuItem*> List;
- // For context menus, these are the contexts where an item can appear and
- // potentially be enabled.
+ // For context menus, these are the contexts where an item can appear.
enum Context {
ALL = 1,
PAGE = 2,
@@ -53,7 +52,7 @@
SEPARATOR
};
- // A list of Contexts for an item (where it should be shown/enabled).
+ // A list of Contexts for an item.
class ContextList {
public:
ContextList() : value_(0) {}
@@ -85,8 +84,7 @@
};
ExtensionMenuItem(const std::string& extension_id, std::string title,
- bool checked, Type type, const ContextList& contexts,
- const ContextList& enabled_contexts);
+ bool checked, Type type, const ContextList& contexts);
virtual ~ExtensionMenuItem();
// Simple accessor methods.
@@ -97,14 +95,12 @@
int parent_id() const { return parent_id_; }
int child_count() const { return children_.size(); }
ContextList contexts() const { return contexts_; }
- ContextList enabled_contexts() const { return enabled_contexts_; }
Type type() const { return type_; }
bool checked() const { return checked_; }
// Simple mutator methods.
void set_title(std::string new_title) { title_ = new_title; }
void set_contexts(ContextList contexts) { contexts_ = contexts; }
- void set_enabled_contexts(ContextList contexts) { contexts_ = contexts; }
void set_type(Type type) { type_ = type; }
// Returns the title with any instances of %s replaced by |selection|.
@@ -155,10 +151,6 @@
// In what contexts should the item be shown?
ContextList contexts_;
- // In what contexts should the item be enabled (i.e. not greyed out). This
- // should be a subset of contexts_.
- ContextList enabled_contexts_;
-
// If this item is a child of another item, the unique id of its parent. If
// this is a top-level item with no parent, this will be 0.
int parent_id_;