Fix bug with context menus in incognito mode.
If an extension uses "spanning" mode, the context menu items are shared
between profiles. If an extension uses "split" mode, the items are separate
per profile. In either case, they only appear in incognito if the extension is
enabled in incognito.
Also fixed a minor bug, so that tabs.create now can open extension URLs in
incognito if the extension uses split mode.
BUG=61147
TEST=see bug for repro steps; context menu items should work in incognito mode
Review URL: http://codereview.chromium.org/4090011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64812 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extension_menu_manager.h b/chrome/browser/extensions/extension_menu_manager.h
index 4455ee1..c8224d11 100644
--- a/chrome/browser/extensions/extension_menu_manager.h
+++ b/chrome/browser/extensions/extension_menu_manager.h
@@ -33,9 +33,20 @@
// A list of ExtensionMenuItem's.
typedef std::vector<ExtensionMenuItem*> List;
- // An Id is a pair of |extension id|, |int| where the |int| is unique per
- // extension.
- typedef std::pair<std::string, int> Id;
+ // An Id uniquely identifies a context menu item registered by an extension.
+ struct Id {
+ Id();
+ Id(Profile* profile, std::string extension_id, int uid);
+ ~Id();
+
+ bool operator==(const Id& other) const;
+ bool operator!=(const Id& other) const;
+ bool operator<(const Id& other) const;
+
+ Profile* profile;
+ std::string extension_id;
+ int uid;
+ };
// For context menus, these are the contexts where an item can appear.
enum Context {
@@ -93,7 +104,7 @@
virtual ~ExtensionMenuItem();
// Simple accessor methods.
- const std::string& extension_id() const { return id_.first; }
+ const std::string& extension_id() const { return id_.extension_id; }
const std::string& title() const { return title_; }
const List& children() { return children_; }
const Id& id() const { return id_; }