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

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

Issue 1137733002: Fix an off-by-one error in checking # of action context menu items in (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add thorough test + git cl format Created 5 years, 7 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/context_menu_matcher.cc
diff --git a/chrome/browser/extensions/context_menu_matcher.cc b/chrome/browser/extensions/context_menu_matcher.cc
index 81cb9712a037365e008541abf347eb4338ace606..8381ce6c4112129130d3bd347d179e741072a47c 100644
--- a/chrome/browser/extensions/context_menu_matcher.cc
+++ b/chrome/browser/extensions/context_menu_matcher.cc
@@ -245,8 +245,6 @@ void ContextMenuMatcher::RecursivelyAppendExtensionItems(
}
int menu_id = ConvertToExtensionsCustomCommandId(*index);
- ++(*index);
- ++num_items;
// Action context menus have a limit for top level extension items to
// prevent control items from being pushed off the screen, since extension
// items will not be placed in a submenu.
@@ -255,6 +253,9 @@ void ContextMenuMatcher::RecursivelyAppendExtensionItems(
(is_action_menu_top_level && num_items >= top_level_limit))
return;
+ ++(*index);
+ ++num_items;
+
extension_item_map_[menu_id] = item->id();
base::string16 title = item->TitleWithReplacement(selection_text,
kMaxExtensionItemTitleLength);

Powered by Google App Engine
This is Rietveld 408576698