class ExtensionAction;
class Profile;
+namespace content {
+class WebContents;
+}
+
namespace extensions {
class Extension;
+class ContextMenuMatcher;
+class ExtensionContextMenuModelTest;
}
// The context menu model for extension icons.
HIDE,
UNINSTALL,
MANAGE,
- INSPECT_POPUP
+ INSPECT_POPUP,
+ ALWAYS_RUN
};
+ // Type of action the extension icon represents.
+ enum ActionType { NO_ACTION = 0, BROWSER_ACTION, PAGE_ACTION };
+
// Delegate to handle showing an ExtensionAction popup.
class PopupDelegate {
public:
// Called when the user selects the menu item which requests that the
// popup be shown and inspected.
- virtual void InspectPopup(ExtensionAction* action) = 0;
+ // The delegate should know which popup to display.
+ virtual void InspectPopup() = 0;
protected:
virtual ~PopupDelegate() {}
private:
friend class base::RefCounted<ExtensionContextMenuModel>;
+ friend class extensions::ExtensionContextMenuModelTest;
+
virtual ~ExtensionContextMenuModel();
void InitMenu(const extensions::Extension* extension);
// extension has been uninstalled and no longer exists.
const extensions::Extension* GetExtension() const;
+ // Returns the active web contents.
+ content::WebContents* GetActiveWebContents() const;
+
+ // Appends the extension's context menu items.
+ void AppendExtensionItems();
+
// A copy of the extension's id.
std::string extension_id_;
// The delegate which handles the 'inspect popup' menu command (or NULL).
PopupDelegate* delegate_;
+ // The type of extension action to which this context menu is attached.
+ ActionType action_type_;
+
// Keeps track of the extension uninstall dialog.
scoped_ptr<extensions::ExtensionUninstallDialog> extension_uninstall_dialog_;
+ // Menu matcher for context menu items specified by the extension.
+ scoped_ptr<extensions::ContextMenuMatcher> extension_items_;
+
+ // Number of extension items in this menu. Used for testing.
+ int extension_items_count_;
+
DISALLOW_COPY_AND_ASSIGN(ExtensionContextMenuModel);
};