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

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: Addressed yoyo's comments, restricted items to relevant extension 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..b4d58d16b278cb198c551c625c397c3afd56b6f9 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"
Devlin 2014/07/01 20:54:24 Nit: prefer forward declaration instead of include
gpdavis 2014/07/02 01:17:46 Done.
#include "chrome/browser/extensions/extension_uninstall_dialog.h"
+#include "chrome/browser/extensions/menu_manager.h"
Devlin 2014/07/01 20:54:24 same here.
gpdavis 2014/07/02 01:17:46 Done.
#include "ui/base/models/simple_menu_model.h"
class Browser;
@@ -35,6 +37,12 @@ class ExtensionContextMenuModel
INSPECT_POPUP
};
+ enum ActionType {
Devlin 2014/07/01 20:54:24 Comment.
gpdavis 2014/07/02 01:17:46 Done.
+ NO_ACTION = 0,
+ BROWSER_ACTION,
+ PAGE_ACTION
+ };
+
// Delegate to handle showing an ExtensionAction popup.
class PopupDelegate {
public:
@@ -81,6 +89,17 @@ class ExtensionContextMenuModel
// extension has been uninstalled and no longer exists.
const extensions::Extension* GetExtension() const;
+ void AppendExtensionItems();
Devlin 2014/07/01 20:54:24 Comment.
gpdavis 2014/07/02 01:17:46 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 MenuItemMatchesExtension(ActionType type,
Devlin 2014/07/01 20:54:24 This should probably be an anonymous function in t
gpdavis 2014/07/02 01:17:46 Done.
+ const extensions::Extension* extension,
+ const extensions::MenuItem* item);
+
// A copy of the extension's id.
std::string extension_id_;
@@ -95,9 +114,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