Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1085)

Unified Diff: chrome/browser/extensions/extension_context_menu_model.h

Issue 359493005: Extend contextMenus API to support browser/page actions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moar minor changes Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_context_menu_model.h
diff --git a/chrome/browser/extensions/extension_context_menu_model.h b/chrome/browser/extensions/extension_context_menu_model.h
index 4685b6c9f42def7fe89997d542f87f85b64a12f7..07739a0b34bb6487facd41e9e661cce1f2c1eb23 100644
--- a/chrome/browser/extensions/extension_context_menu_model.h
+++ b/chrome/browser/extensions/extension_context_menu_model.h
@@ -9,6 +9,7 @@
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/extension_uninstall_dialog.h"
+#include "content/public/common/context_menu_params.h"
Devlin 2014/07/07 20:20:58 Do we still need this?
gpdavis 2014/07/09 02:13:54 Done.
#include "ui/base/models/simple_menu_model.h"
class Browser;
@@ -17,6 +18,8 @@ class Profile;
namespace extensions {
class Extension;
+class ContextMenuMatcher;
+class MenuManager;
Devlin 2014/07/07 20:20:58 DO we still need this?
gpdavis 2014/07/09 02:13:54 Done.
}
// The context menu model for extension icons.
@@ -35,6 +38,13 @@ class ExtensionContextMenuModel
INSPECT_POPUP
};
+ // 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:
@@ -81,6 +91,13 @@ class ExtensionContextMenuModel
// extension has been uninstalled and no longer exists.
const extensions::Extension* GetExtension() const;
+ // Appends the extension's context menu items.
+ void AppendExtensionItems();
+
+ // Determines whether this context menu was created for a browser action or
+ // a page action.
+ ActionType GetActionType(const extensions::Extension* extension);
+
// A copy of the extension's id.
std::string extension_id_;
@@ -95,9 +112,14 @@ class ExtensionContextMenuModel
// The delegate which handles the 'inspect popup' menu command (or NULL).
PopupDelegate* delegate_;
+ 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_;
+
DISALLOW_COPY_AND_ASSIGN(ExtensionContextMenuModel);
};

Powered by Google App Engine
This is Rietveld 408576698