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

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: Added context strings, page action implementation 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..ef18d1cbc6aadbb5909655d5979d16874c507af3 100644
--- a/chrome/browser/extensions/extension_context_menu_model.h
+++ b/chrome/browser/extensions/extension_context_menu_model.h
@@ -8,7 +8,9 @@
#include <string>
#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/extensions/context_menu_matcher.h"
#include "chrome/browser/extensions/extension_uninstall_dialog.h"
+#include "chrome/browser/extensions/menu_manager.h"
#include "ui/base/models/simple_menu_model.h"
class Browser;
@@ -35,6 +37,11 @@ class ExtensionContextMenuModel
INSPECT_POPUP
};
+ enum ActionType {
Yoyo Zhou 2014/06/27 23:37:57 This should definitely have a default 'none' (NO_A
gpdavis 2014/06/28 00:05:41 I was under the impression that this class was spe
gpdavis 2014/06/30 21:11:11 Ah, you're right. The second constructor is calle
+ BROWSER_ACTION = 0,
+ PAGE_ACTION
+ };
+
// Delegate to handle showing an ExtensionAction popup.
class PopupDelegate {
public:
@@ -95,9 +102,24 @@ 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 extensions context menu items.
Yoyo Zhou 2014/06/27 23:37:57 This should be more specific - these are the ones
gpdavis 2014/06/30 21:11:11 Done.
+ extensions::ContextMenuMatcher extension_items_;
+
+ void AppendExtensionItems();
Yoyo Zhou 2014/06/27 23:37:57 Private functions should go above members.
gpdavis 2014/06/30 21:11:11 Done.
+
+ // Determines whether this context menu was created for a browser action or
+ // a page action.
+ ActionType GetActionType(const extensions::Extension* extension);
+
+ // Matches extensions menu items by ActionType.
+ static bool MenuItemMatchesContext(ActionType type,
+ const extensions::MenuItem* item);
+
DISALLOW_COPY_AND_ASSIGN(ExtensionContextMenuModel);
};

Powered by Google App Engine
This is Rietveld 408576698