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

Unified Diff: chrome/renderer/autofill_helper.cc

Issue 5263007: Should not show autofill drop-down for a user/pw form (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years, 1 month 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/autofill_helper.cc
diff --git a/chrome/renderer/autofill_helper.cc b/chrome/renderer/autofill_helper.cc
index 8441f75fb6c32aa38f44e5bdfc7117ddd3afb4bc..d140f9463d24e79136f1a8f6fd14161c99f42af9 100644
--- a/chrome/renderer/autofill_helper.cc
+++ b/chrome/renderer/autofill_helper.cc
@@ -92,9 +92,20 @@ void AutoFillHelper::SuggestionsReceived(int query_id,
if (ids[0] < 0 && !display_warning_if_disabled_)
return;
+ // Only include "AutoFill Options" special menu item if we have AutoFill
+ // items, identified by |unique_ids| having at least one valid value.
+ bool has_autofill_item = false;
+ for (size_t i = 0; i < ids.size(); ++i) {
+ if (ids[i] > 0) {
+ has_autofill_item = true;
+ break;
+ }
+ }
+
// The form has been auto-filled, so give the user the chance to clear the
// form. Append the 'Clear form' menu item.
- if (form_manager_.FormWithNodeIsAutoFilled(autofill_query_node_)) {
+ if (has_autofill_item &&
+ form_manager_.FormWithNodeIsAutoFilled(autofill_query_node_)) {
v.push_back(l10n_util::GetStringUTF16(IDS_AUTOFILL_CLEAR_FORM_MENU_ITEM));
l.push_back(string16());
i.push_back(string16());
@@ -103,16 +114,7 @@ void AutoFillHelper::SuggestionsReceived(int query_id,
separator_index = v.size() - 1;
}
- // Only include "AutoFill Options" special menu item if we have AutoFill
- // items, identified by |unique_ids| having at least one valid value.
- bool show_options = false;
- for (size_t i = 0; i < ids.size(); ++i) {
- if (ids[i] > 0) {
- show_options = true;
- break;
- }
- }
- if (show_options) {
+ if (has_autofill_item) {
// Append the 'Chrome Autofill options' menu item;
v.push_back(l10n_util::GetStringFUTF16(IDS_AUTOFILL_OPTIONS_POPUP,
WideToUTF16(chrome::kBrowserAppName)));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698