Index: chrome/browser/ui/autofill/autofill_dialog_models.cc |
diff --git a/chrome/browser/ui/autofill/autofill_dialog_models.cc b/chrome/browser/ui/autofill/autofill_dialog_models.cc |
index 7c1e6714d6cbe6bf81f8e152bd3ea2e8d3088476..004d1fe24250e1b2d15c3284b1648c79600da633 100644 |
--- a/chrome/browser/ui/autofill/autofill_dialog_models.cc |
+++ b/chrome/browser/ui/autofill/autofill_dialog_models.cc |
@@ -81,7 +81,7 @@ std::string SuggestionsMenuModel::GetItemKeyForCheckedItem() const { |
} |
void SuggestionsMenuModel::SetCheckedItem(const std::string& item_key) { |
- checked_item_ = GetItemIndex(item_key); |
+ SetCheckedItemNthWithKey(item_key, 1); |
} |
void SuggestionsMenuModel::SetCheckedIndex(size_t index) { |
@@ -89,6 +89,17 @@ void SuggestionsMenuModel::SetCheckedIndex(size_t index) { |
checked_item_ = index; |
} |
+void SuggestionsMenuModel::SetCheckedItemNthWithKey(const std::string& item_key, |
+ size_t n) { |
+ for (size_t i = 0; i < items_.size(); ++i) { |
+ if (items_[i].key == item_key) { |
+ checked_item_ = i; |
+ if (n-- <= 1) |
+ return; |
+ } |
+ } |
+} |
+ |
void SuggestionsMenuModel::SetEnabled(const std::string& item_key, |
bool enabled) { |
items_[GetItemIndex(item_key)].enabled = enabled; |