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

Unified Diff: chrome/browser/ui/autofill/autofill_dialog_models.cc

Issue 15500008: Persist the choice of AutofillDataModel when using the requestAutocomplete dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix bad merge resolution Created 7 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
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_models.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_models.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698