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

Unified Diff: chrome/browser/extensions/menu_manager.cc

Issue 1181263007: WebView context menu cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. Rebased. Created 5 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/menu_manager.cc
diff --git a/chrome/browser/extensions/menu_manager.cc b/chrome/browser/extensions/menu_manager.cc
index 95993c9906ec963d80a5a8d44210152a3ea07fcf..6fccd4f8772b4352bb8b95c26a63245e462e5522 100644
--- a/chrome/browser/extensions/menu_manager.cc
+++ b/chrome/browser/extensions/menu_manager.cc
@@ -883,25 +883,37 @@ void MenuManager::RemoveAllIncognitoContextItems() {
RemoveContextMenuItem(*remove_iter);
}
-MenuItem::ExtensionKey::ExtensionKey() : webview_instance_id(0) {}
-
-MenuItem::ExtensionKey::ExtensionKey(const std::string& extension_id,
- int webview_instance_id)
- : extension_id(extension_id), webview_instance_id(webview_instance_id) {}
+MenuItem::ExtensionKey::ExtensionKey()
+ : webview_embedder_process_id(0), webview_instance_id(0) {}
MenuItem::ExtensionKey::ExtensionKey(const std::string& extension_id)
- : extension_id(extension_id), webview_instance_id(0) {}
+ : 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)
+ : 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;
+ webview_instance_id == other.webview_instance_id &&
+ webview_embedder_process_id == other.webview_embedder_process_id;
}
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;
- return webview_instance_id < other.webview_instance_id;
+ return extension_id < other.extension_id;
}
bool MenuItem::ExtensionKey::operator!=(const ExtensionKey& other) const {
@@ -909,7 +921,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) {}

Powered by Google App Engine
This is Rietveld 408576698