[email protected] | 7dddebc3 | 2012-01-11 22:01:03 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MENU_MANAGER_H_ |
| 6 | #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MENU_MANAGER_H_ |
[email protected] | 32b76ef | 2010-07-26 23:08:24 | [diff] [blame] | 7 | #pragma once |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 8 | |
| 9 | #include <map> |
| 10 | #include <set> |
| 11 | #include <string> |
| 12 | #include <vector> |
| 13 | |
| 14 | #include "base/basictypes.h" |
[email protected] | 1790275 | 2011-08-31 22:52:54 | [diff] [blame] | 15 | #include "base/compiler_specific.h" |
[email protected] | 2b07c93f | 2010-08-02 23:13:04 | [diff] [blame] | 16 | #include "base/gtest_prod_util.h" |
[email protected] | 3b63f8f4 | 2011-03-28 01:54:15 | [diff] [blame] | 17 | #include "base/memory/scoped_ptr.h" |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 18 | #include "base/string16.h" |
[email protected] | b671760b | 2010-07-15 21:13:47 | [diff] [blame] | 19 | #include "chrome/browser/extensions/extension_icon_manager.h" |
[email protected] | cced75a | 2011-05-20 08:31:12 | [diff] [blame] | 20 | #include "chrome/common/extensions/url_pattern_set.h" |
[email protected] | 6c2381d | 2011-10-19 02:52:53 | [diff] [blame] | 21 | #include "content/public/browser/notification_observer.h" |
| 22 | #include "content/public/browser/notification_registrar.h" |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 23 | |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 24 | |
[email protected] | 052c9270 | 2010-06-25 07:25:52 | [diff] [blame] | 25 | class Extension; |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 26 | class Profile; |
[email protected] | b671760b | 2010-07-15 21:13:47 | [diff] [blame] | 27 | class SkBitmap; |
[email protected] | ea049a0 | 2011-12-25 21:37:09 | [diff] [blame] | 28 | |
| 29 | namespace content { |
| 30 | class WebContents; |
[email protected] | 35be7ec | 2012-02-12 20:42:51 | [diff] [blame] | 31 | struct ContextMenuParams; |
[email protected] | ea049a0 | 2011-12-25 21:37:09 | [diff] [blame] | 32 | } |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 33 | |
| 34 | // Represents a menu item added by an extension. |
| 35 | class ExtensionMenuItem { |
| 36 | public: |
[email protected] | 63a414b5 | 2010-06-03 23:20:49 | [diff] [blame] | 37 | // A list of ExtensionMenuItem's. |
| 38 | typedef std::vector<ExtensionMenuItem*> List; |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 39 | |
[email protected] | 5a7b5eaf | 2010-11-02 20:52:19 | [diff] [blame] | 40 | // An Id uniquely identifies a context menu item registered by an extension. |
| 41 | struct Id { |
| 42 | Id(); |
[email protected] | 3a1275d | 2011-03-28 18:49:58 | [diff] [blame] | 43 | Id(Profile* profile, const std::string& extension_id, int uid); |
[email protected] | 5a7b5eaf | 2010-11-02 20:52:19 | [diff] [blame] | 44 | ~Id(); |
| 45 | |
| 46 | bool operator==(const Id& other) const; |
| 47 | bool operator!=(const Id& other) const; |
| 48 | bool operator<(const Id& other) const; |
| 49 | |
| 50 | Profile* profile; |
| 51 | std::string extension_id; |
| 52 | int uid; |
| 53 | }; |
[email protected] | 9e9d791 | 2010-07-18 21:05:28 | [diff] [blame] | 54 | |
[email protected] | a11fa34 | 2010-07-09 16:56:00 | [diff] [blame] | 55 | // For context menus, these are the contexts where an item can appear. |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 56 | enum Context { |
| 57 | ALL = 1, |
| 58 | PAGE = 2, |
| 59 | SELECTION = 4, |
| 60 | LINK = 8, |
| 61 | EDITABLE = 16, |
| 62 | IMAGE = 32, |
| 63 | VIDEO = 64, |
| 64 | AUDIO = 128, |
[email protected] | 0e5e8d5 | 2011-04-06 21:02:51 | [diff] [blame] | 65 | FRAME = 256, |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 66 | }; |
| 67 | |
| 68 | // An item can be only one of these types. |
| 69 | enum Type { |
| 70 | NORMAL, |
| 71 | CHECKBOX, |
| 72 | RADIO, |
| 73 | SEPARATOR |
| 74 | }; |
| 75 | |
[email protected] | a11fa34 | 2010-07-09 16:56:00 | [diff] [blame] | 76 | // A list of Contexts for an item. |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 77 | class ContextList { |
| 78 | public: |
| 79 | ContextList() : value_(0) {} |
| 80 | explicit ContextList(Context context) : value_(context) {} |
| 81 | ContextList(const ContextList& other) : value_(other.value_) {} |
| 82 | |
| 83 | void operator=(const ContextList& other) { |
| 84 | value_ = other.value_; |
| 85 | } |
| 86 | |
[email protected] | 66dbfb2c | 2010-05-12 20:20:15 | [diff] [blame] | 87 | bool operator==(const ContextList& other) const { |
| 88 | return value_ == other.value_; |
| 89 | } |
| 90 | |
| 91 | bool operator!=(const ContextList& other) const { |
| 92 | return !(*this == other); |
| 93 | } |
| 94 | |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 95 | bool Contains(Context context) const { |
| 96 | return (value_ & context) > 0; |
| 97 | } |
| 98 | |
| 99 | void Add(Context context) { |
| 100 | value_ |= context; |
| 101 | } |
| 102 | |
| 103 | private: |
| 104 | uint32 value_; // A bitmask of Context values. |
| 105 | }; |
| 106 | |
[email protected] | 3a1275d | 2011-03-28 18:49:58 | [diff] [blame] | 107 | ExtensionMenuItem(const Id& id, |
| 108 | const std::string& title, |
| 109 | bool checked, |
[email protected] | d4a8b7a | 2012-04-03 07:27:13 | [diff] [blame^] | 110 | bool enabled, |
[email protected] | 3a1275d | 2011-03-28 18:49:58 | [diff] [blame] | 111 | Type type, |
[email protected] | f4f0459 | 2010-07-14 20:40:13 | [diff] [blame] | 112 | const ContextList& contexts); |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 113 | virtual ~ExtensionMenuItem(); |
| 114 | |
| 115 | // Simple accessor methods. |
[email protected] | 5a7b5eaf | 2010-11-02 20:52:19 | [diff] [blame] | 116 | const std::string& extension_id() const { return id_.extension_id; } |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 117 | const std::string& title() const { return title_; } |
[email protected] | 63a414b5 | 2010-06-03 23:20:49 | [diff] [blame] | 118 | const List& children() { return children_; } |
[email protected] | f4f0459 | 2010-07-14 20:40:13 | [diff] [blame] | 119 | const Id& id() const { return id_; } |
| 120 | Id* parent_id() const { return parent_id_.get(); } |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 121 | int child_count() const { return children_.size(); } |
| 122 | ContextList contexts() const { return contexts_; } |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 123 | Type type() const { return type_; } |
| 124 | bool checked() const { return checked_; } |
[email protected] | d4a8b7a | 2012-04-03 07:27:13 | [diff] [blame^] | 125 | bool enabled() const { return enabled_; } |
[email protected] | cced75a | 2011-05-20 08:31:12 | [diff] [blame] | 126 | const URLPatternSet& document_url_patterns() const { |
[email protected] | 9e9d791 | 2010-07-18 21:05:28 | [diff] [blame] | 127 | return document_url_patterns_; |
| 128 | } |
[email protected] | cced75a | 2011-05-20 08:31:12 | [diff] [blame] | 129 | const URLPatternSet& target_url_patterns() const { |
[email protected] | 9e9d791 | 2010-07-18 21:05:28 | [diff] [blame] | 130 | return target_url_patterns_; |
| 131 | } |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 132 | |
[email protected] | 66dbfb2c | 2010-05-12 20:20:15 | [diff] [blame] | 133 | // Simple mutator methods. |
[email protected] | 48329f9 | 2011-03-28 19:38:22 | [diff] [blame] | 134 | void set_title(const std::string& new_title) { title_ = new_title; } |
[email protected] | 66dbfb2c | 2010-05-12 20:20:15 | [diff] [blame] | 135 | void set_contexts(ContextList contexts) { contexts_ = contexts; } |
[email protected] | 66dbfb2c | 2010-05-12 20:20:15 | [diff] [blame] | 136 | void set_type(Type type) { type_ = type; } |
[email protected] | d4a8b7a | 2012-04-03 07:27:13 | [diff] [blame^] | 137 | void set_enabled(bool enabled) { enabled_ = enabled; } |
[email protected] | cced75a | 2011-05-20 08:31:12 | [diff] [blame] | 138 | void set_document_url_patterns(const URLPatternSet& patterns) { |
[email protected] | 9e9d791 | 2010-07-18 21:05:28 | [diff] [blame] | 139 | document_url_patterns_ = patterns; |
| 140 | } |
[email protected] | cced75a | 2011-05-20 08:31:12 | [diff] [blame] | 141 | void set_target_url_patterns(const URLPatternSet& patterns) { |
[email protected] | 9e9d791 | 2010-07-18 21:05:28 | [diff] [blame] | 142 | target_url_patterns_ = patterns; |
| 143 | } |
[email protected] | 66dbfb2c | 2010-05-12 20:20:15 | [diff] [blame] | 144 | |
[email protected] | 745feedb | 2010-08-02 04:08:07 | [diff] [blame] | 145 | // Returns the title with any instances of %s replaced by |selection|. The |
| 146 | // result will be no longer than |max_length|. |
| 147 | string16 TitleWithReplacement(const string16& selection, |
| 148 | size_t max_length) const; |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 149 | |
[email protected] | 66dbfb2c | 2010-05-12 20:20:15 | [diff] [blame] | 150 | // Set the checked state to |checked|. Returns true if successful. |
| 151 | bool SetChecked(bool checked); |
| 152 | |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 153 | protected: |
| 154 | friend class ExtensionMenuManager; |
| 155 | |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 156 | // Takes ownership of |item| and sets its parent_id_. |
| 157 | void AddChild(ExtensionMenuItem* item); |
| 158 | |
[email protected] | 66dbfb2c | 2010-05-12 20:20:15 | [diff] [blame] | 159 | // Takes the child item from this parent. The item is returned and the caller |
| 160 | // then owns the pointer. |
[email protected] | f4f0459 | 2010-07-14 20:40:13 | [diff] [blame] | 161 | ExtensionMenuItem* ReleaseChild(const Id& child_id, bool recursive); |
[email protected] | 66dbfb2c | 2010-05-12 20:20:15 | [diff] [blame] | 162 | |
| 163 | // Recursively removes all descendant items (children, grandchildren, etc.), |
| 164 | // returning the ids of the removed items. |
[email protected] | f4f0459 | 2010-07-14 20:40:13 | [diff] [blame] | 165 | std::set<Id> RemoveAllDescendants(); |
[email protected] | 66dbfb2c | 2010-05-12 20:20:15 | [diff] [blame] | 166 | |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 167 | private: |
[email protected] | f4f0459 | 2010-07-14 20:40:13 | [diff] [blame] | 168 | // The unique id for this item. |
| 169 | Id id_; |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 170 | |
| 171 | // What gets shown in the menu for this item. |
| 172 | std::string title_; |
| 173 | |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 174 | Type type_; |
| 175 | |
| 176 | // This should only be true for items of type CHECKBOX or RADIO. |
| 177 | bool checked_; |
| 178 | |
[email protected] | d4a8b7a | 2012-04-03 07:27:13 | [diff] [blame^] | 179 | // If the item is enabled or not. |
| 180 | bool enabled_; |
| 181 | |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 182 | // In what contexts should the item be shown? |
| 183 | ContextList contexts_; |
| 184 | |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 185 | // If this item is a child of another item, the unique id of its parent. If |
[email protected] | f4f0459 | 2010-07-14 20:40:13 | [diff] [blame] | 186 | // this is a top-level item with no parent, this will be NULL. |
| 187 | scoped_ptr<Id> parent_id_; |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 188 | |
[email protected] | 9e9d791 | 2010-07-18 21:05:28 | [diff] [blame] | 189 | // Patterns for restricting what documents this item will appear for. This |
| 190 | // applies to the frame where the click took place. |
[email protected] | cced75a | 2011-05-20 08:31:12 | [diff] [blame] | 191 | URLPatternSet document_url_patterns_; |
[email protected] | 9e9d791 | 2010-07-18 21:05:28 | [diff] [blame] | 192 | |
| 193 | // Patterns for restricting where items appear based on the src/href |
| 194 | // attribute of IMAGE/AUDIO/VIDEO/LINK tags. |
[email protected] | cced75a | 2011-05-20 08:31:12 | [diff] [blame] | 195 | URLPatternSet target_url_patterns_; |
[email protected] | 9e9d791 | 2010-07-18 21:05:28 | [diff] [blame] | 196 | |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 197 | // Any children this item may have. |
| 198 | List children_; |
| 199 | |
| 200 | DISALLOW_COPY_AND_ASSIGN(ExtensionMenuItem); |
| 201 | }; |
| 202 | |
| 203 | // This class keeps track of menu items added by extensions. |
[email protected] | 6c2381d | 2011-10-19 02:52:53 | [diff] [blame] | 204 | class ExtensionMenuManager : public content::NotificationObserver { |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 205 | public: |
[email protected] | 8b28030 | 2011-10-13 22:22:23 | [diff] [blame] | 206 | explicit ExtensionMenuManager(Profile* profile); |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 207 | virtual ~ExtensionMenuManager(); |
| 208 | |
| 209 | // Returns the ids of extensions which have menu items registered. |
| 210 | std::set<std::string> ExtensionIds(); |
| 211 | |
| 212 | // Returns a list of all the *top-level* menu items (added via AddContextItem) |
| 213 | // for the given extension id, *not* including child items (added via |
| 214 | // AddChildItem); although those can be reached via the top-level items' |
[email protected] | 63a414b5 | 2010-06-03 23:20:49 | [diff] [blame] | 215 | // children. A view can then decide how to display these, including whether to |
| 216 | // put them into a submenu if there are more than 1. |
| 217 | const ExtensionMenuItem::List* MenuItems(const std::string& extension_id); |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 218 | |
[email protected] | 052c9270 | 2010-06-25 07:25:52 | [diff] [blame] | 219 | // Adds a top-level menu item for an extension, requiring the |extension| |
| 220 | // pointer so it can load the icon for the extension. Takes ownership of |
[email protected] | f4f0459 | 2010-07-14 20:40:13 | [diff] [blame] | 221 | // |item|. Returns a boolean indicating success or failure. |
[email protected] | 9adb969 | 2010-10-29 23:14:02 | [diff] [blame] | 222 | bool AddContextItem(const Extension* extension, ExtensionMenuItem* item); |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 223 | |
| 224 | // Add an item as a child of another item which has been previously added, and |
[email protected] | f4f0459 | 2010-07-14 20:40:13 | [diff] [blame] | 225 | // takes ownership of |item|. Returns a boolean indicating success or failure. |
| 226 | bool AddChildItem(const ExtensionMenuItem::Id& parent_id, |
| 227 | ExtensionMenuItem* child); |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 228 | |
[email protected] | 66dbfb2c | 2010-05-12 20:20:15 | [diff] [blame] | 229 | // Makes existing item with |child_id| a child of the item with |parent_id|. |
| 230 | // If the child item was already a child of another parent, this will remove |
| 231 | // it from that parent first. It is an error to try and move an item to be a |
[email protected] | f4f0459 | 2010-07-14 20:40:13 | [diff] [blame] | 232 | // child of one of its own descendants. It is legal to pass NULL for |
| 233 | // |parent_id|, which means the item should be moved to the top-level. |
| 234 | bool ChangeParent(const ExtensionMenuItem::Id& child_id, |
| 235 | const ExtensionMenuItem::Id* parent_id); |
[email protected] | 66dbfb2c | 2010-05-12 20:20:15 | [diff] [blame] | 236 | |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 237 | // Removes a context menu item with the given id (whether it is a top-level |
| 238 | // item or a child of some other item), returning true if the item was found |
| 239 | // and removed or false otherwise. |
[email protected] | f4f0459 | 2010-07-14 20:40:13 | [diff] [blame] | 240 | bool RemoveContextMenuItem(const ExtensionMenuItem::Id& id); |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 241 | |
[email protected] | 66dbfb2c | 2010-05-12 20:20:15 | [diff] [blame] | 242 | // Removes all items for the given extension id. |
[email protected] | 48329f9 | 2011-03-28 19:38:22 | [diff] [blame] | 243 | void RemoveAllContextItems(const std::string& extension_id); |
[email protected] | 66dbfb2c | 2010-05-12 20:20:15 | [diff] [blame] | 244 | |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 245 | // Returns the item with the given |id| or NULL. |
[email protected] | f4f0459 | 2010-07-14 20:40:13 | [diff] [blame] | 246 | ExtensionMenuItem* GetItemById(const ExtensionMenuItem::Id& id) const; |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 247 | |
[email protected] | 7dddebc3 | 2012-01-11 22:01:03 | [diff] [blame] | 248 | // Notify the ExtensionMenuManager that an item has been updated not through |
| 249 | // an explicit call into ExtensionMenuManager. For example, if an item is |
| 250 | // acquired by a call to GetItemById and changed, then this should be called. |
| 251 | // Returns true if the item was found or false otherwise. |
| 252 | bool ItemUpdated(const ExtensionMenuItem::Id& id); |
| 253 | |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 254 | // Called when a menu item is clicked on by the user. |
[email protected] | ea049a0 | 2011-12-25 21:37:09 | [diff] [blame] | 255 | void ExecuteCommand(Profile* profile, content::WebContents* web_contents, |
[email protected] | 35be7ec | 2012-02-12 20:42:51 | [diff] [blame] | 256 | const content::ContextMenuParams& params, |
[email protected] | f4f0459 | 2010-07-14 20:40:13 | [diff] [blame] | 257 | const ExtensionMenuItem::Id& menuItemId); |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 258 | |
[email protected] | f23a8c1 | 2011-03-15 14:43:43 | [diff] [blame] | 259 | // This returns a bitmap of width/height kFaviconSize, loaded either from an |
[email protected] | 052c9270 | 2010-06-25 07:25:52 | [diff] [blame] | 260 | // entry specified in the extension's 'icon' section of the manifest, or a |
| 261 | // default extension icon. |
| 262 | const SkBitmap& GetIconForExtension(const std::string& extension_id); |
| 263 | |
[email protected] | 6c2381d | 2011-10-19 02:52:53 | [diff] [blame] | 264 | // Implements the content::NotificationObserver interface. |
| 265 | virtual void Observe(int type, const content::NotificationSource& source, |
| 266 | const content::NotificationDetails& details) OVERRIDE; |
[email protected] | 052c9270 | 2010-06-25 07:25:52 | [diff] [blame] | 267 | |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 268 | private: |
[email protected] | 2b07c93f | 2010-08-02 23:13:04 | [diff] [blame] | 269 | FRIEND_TEST_ALL_PREFIXES(ExtensionMenuManagerTest, DeleteParent); |
[email protected] | f50da859 | 2010-10-28 23:39:32 | [diff] [blame] | 270 | FRIEND_TEST_ALL_PREFIXES(ExtensionMenuManagerTest, RemoveOneByOne); |
[email protected] | 2b07c93f | 2010-08-02 23:13:04 | [diff] [blame] | 271 | |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 272 | // This is a helper function which takes care of de-selecting any other radio |
| 273 | // items in the same group (i.e. that are adjacent in the list). |
| 274 | void RadioItemSelected(ExtensionMenuItem* item); |
| 275 | |
[email protected] | 7dddebc3 | 2012-01-11 22:01:03 | [diff] [blame] | 276 | // Make sure that there is only one radio item selected at once in any run. |
| 277 | // If there are no radio items selected, then the first item in the run |
| 278 | // will get selected. If there are multiple radio items selected, then only |
| 279 | // the last one will get selcted. |
| 280 | void SanitizeRadioList(const ExtensionMenuItem::List& item_list); |
| 281 | |
[email protected] | 66dbfb2c | 2010-05-12 20:20:15 | [diff] [blame] | 282 | // Returns true if item is a descendant of an item with id |ancestor_id|. |
[email protected] | f4f0459 | 2010-07-14 20:40:13 | [diff] [blame] | 283 | bool DescendantOf(ExtensionMenuItem* item, |
| 284 | const ExtensionMenuItem::Id& ancestor_id); |
[email protected] | 66dbfb2c | 2010-05-12 20:20:15 | [diff] [blame] | 285 | |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 286 | // We keep items organized by mapping an extension id to a list of items. |
| 287 | typedef std::map<std::string, ExtensionMenuItem::List> MenuItemMap; |
| 288 | MenuItemMap context_items_; |
| 289 | |
| 290 | // This lets us make lookup by id fast. It maps id to ExtensionMenuItem* for |
| 291 | // all items the menu manager knows about, including all children of top-level |
| 292 | // items. |
[email protected] | f4f0459 | 2010-07-14 20:40:13 | [diff] [blame] | 293 | std::map<ExtensionMenuItem::Id, ExtensionMenuItem*> items_by_id_; |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 294 | |
[email protected] | 6c2381d | 2011-10-19 02:52:53 | [diff] [blame] | 295 | content::NotificationRegistrar registrar_; |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 296 | |
[email protected] | b671760b | 2010-07-15 21:13:47 | [diff] [blame] | 297 | ExtensionIconManager icon_manager_; |
[email protected] | 052c9270 | 2010-06-25 07:25:52 | [diff] [blame] | 298 | |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 299 | DISALLOW_COPY_AND_ASSIGN(ExtensionMenuManager); |
| 300 | }; |
| 301 | |
| 302 | #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MENU_MANAGER_H_ |