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

Unified Diff: chrome/browser/autofill/autofill_external_delegate.cc

Issue 10408070: Upgrade Seperator in New Autofill UI (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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 | « no previous file | chrome/browser/autofill/autofill_popup_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/autofill_external_delegate.cc
diff --git a/chrome/browser/autofill/autofill_external_delegate.cc b/chrome/browser/autofill/autofill_external_delegate.cc
index a675a299caf1dc619148ed68848eb39f63729063..1a7d2e56c42dcd5a72c4140fe6b34194719a982c 100644
--- a/chrome/browser/autofill/autofill_external_delegate.cc
+++ b/chrome/browser/autofill/autofill_external_delegate.cc
@@ -36,6 +36,7 @@ AutofillExternalDelegate::AutofillExternalDelegate(
void AutofillExternalDelegate::SelectAutofillSuggestionAtIndex(int unique_id) {
if (unique_id == WebAutofillClient::MenuItemIDAutofillOptions ||
unique_id == WebAutofillClient::MenuItemIDClearForm ||
+ unique_id == WebAutofillClient::MenuItemIDSeparator ||
unique_id == WebAutofillClient::MenuItemIDWarningMessage)
return;
@@ -80,6 +81,12 @@ void AutofillExternalDelegate::OnSuggestionsReturned(
std::vector<string16> i(icons);
std::vector<int> ids(unique_ids);
+ // Add a separator to go between the values and menu items.
+ v.push_back(string16());
+ l.push_back(string16());
+ i.push_back(string16());
+ ids.push_back(WebAutofillClient::MenuItemIDSeparator);
+
DCHECK_GT(ids.size(), 0U);
if (!autofill_query_field_.should_autocomplete) {
// If autofill is disabled and we had suggestions, show a warning instead.
@@ -127,6 +134,14 @@ void AutofillExternalDelegate::OnSuggestionsReturned(
ids.push_back(WebAutofillClient::MenuItemIDAutofillOptions);
}
+ // Remove the separator if it is the last element.
+ if (*(ids.rbegin()) == WebAutofillClient::MenuItemIDSeparator) {
+ v.pop_back();
+ l.pop_back();
+ i.pop_back();
+ ids.pop_back();
+ }
+
// Send to display.
if (!v.empty() && autofill_query_field_.is_focusable)
ApplyAutofillSuggestions(v, l, i, ids);
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_popup_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698