| Index: chrome/browser/extensions/menu_manager.cc
|
| diff --git a/chrome/browser/extensions/menu_manager.cc b/chrome/browser/extensions/menu_manager.cc
|
| index 95993c9906ec963d80a5a8d44210152a3ea07fcf..ca0437ec9601254313703ab2dcaee88858d6796c 100644
|
| --- a/chrome/browser/extensions/menu_manager.cc
|
| +++ b/chrome/browser/extensions/menu_manager.cc
|
| @@ -883,25 +883,54 @@ void MenuManager::RemoveAllIncognitoContextItems() {
|
| RemoveContextMenuItem(*remove_iter);
|
| }
|
|
|
| -MenuItem::ExtensionKey::ExtensionKey() : webview_instance_id(0) {}
|
| +MenuItem::ExtensionKey::ExtensionKey()
|
| + : webview_embedder_process_id(0), webview_instance_id(0) {}
|
|
|
| -MenuItem::ExtensionKey::ExtensionKey(const std::string& extension_id,
|
| +MenuItem::ExtensionKey::ExtensionKey(const std::string& extension_id)
|
| + : extension_id(extension_id),
|
| + webview_embedder_process_id(0),
|
| + webview_instance_id(0) {
|
| + DCHECK(!extension_id.empty());
|
| +}
|
| +
|
| +MenuItem::ExtensionKey::ExtensionKey(int webview_embedder_process_id,
|
| int webview_instance_id)
|
| - : extension_id(extension_id), webview_instance_id(webview_instance_id) {}
|
| + : ExtensionKey("", webview_embedder_process_id, webview_instance_id) {}
|
|
|
| -MenuItem::ExtensionKey::ExtensionKey(const std::string& extension_id)
|
| - : extension_id(extension_id), webview_instance_id(0) {}
|
| +MenuItem::ExtensionKey::ExtensionKey(const std::string& extension_id,
|
| + int webview_embedder_process_id,
|
| + int webview_instance_id)
|
| + : extension_id(extension_id),
|
| + webview_embedder_process_id(webview_embedder_process_id),
|
| + webview_instance_id(webview_instance_id) {
|
| + DCHECK(webview_embedder_process_id && webview_instance_id);
|
| +}
|
|
|
| bool MenuItem::ExtensionKey::operator==(const ExtensionKey& other) const {
|
| - return extension_id == other.extension_id &&
|
| - webview_instance_id == other.webview_instance_id;
|
| + bool webview_ids_match = webview_instance_id == other.webview_instance_id &&
|
| + webview_embedder_process_id == other.webview_embedder_process_id;
|
| +
|
| + // If either extension ID is empty, then these ExtensionKeys will be matched
|
| + // only based on the other IDs.
|
| + if (extension_id.empty() || other.extension_id.empty())
|
| + return webview_ids_match;
|
| +
|
| + return extension_id == other.extension_id && webview_ids_match;
|
| }
|
|
|
| bool MenuItem::ExtensionKey::operator<(const ExtensionKey& other) const {
|
| - if (extension_id != other.extension_id)
|
| - return extension_id < other.extension_id;
|
| + if (webview_embedder_process_id != other.webview_embedder_process_id)
|
| + return webview_embedder_process_id < other.webview_embedder_process_id;
|
| +
|
| + if (webview_instance_id != other.webview_instance_id)
|
| + return webview_instance_id < other.webview_instance_id;
|
| +
|
| + // If either extension ID is empty, then these ExtensionKeys will be compared
|
| + // only based on the other IDs.
|
| + if (extension_id.empty() || other.extension_id.empty())
|
| + return false;
|
|
|
| - return webview_instance_id < other.webview_instance_id;
|
| + return extension_id < other.extension_id;
|
| }
|
|
|
| bool MenuItem::ExtensionKey::operator!=(const ExtensionKey& other) const {
|
| @@ -909,7 +938,8 @@ bool MenuItem::ExtensionKey::operator!=(const ExtensionKey& other) const {
|
| }
|
|
|
| bool MenuItem::ExtensionKey::empty() const {
|
| - return extension_id.empty() && !webview_instance_id;
|
| + return extension_id.empty() && !webview_embedder_process_id &&
|
| + !webview_instance_id;
|
| }
|
|
|
| MenuItem::Id::Id() : incognito(false), uid(0) {}
|
|
|