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

Unified Diff: chrome/renderer/autofill/autofill_agent.cc

Issue 7514003: Show display warning if the form is autocomplete off. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 5 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/autofill/autofill_agent.cc
diff --git a/chrome/renderer/autofill/autofill_agent.cc b/chrome/renderer/autofill/autofill_agent.cc
index 72110d0e41d54f1471a36c24144eaf555e7287ba..1c63db2c1da16c258bcebb49ede18c2b0c77bd44 100644
--- a/chrome/renderer/autofill/autofill_agent.cc
+++ b/chrome/renderer/autofill/autofill_agent.cc
@@ -234,7 +234,14 @@ void AutofillAgent::OnSuggestionsReturned(int query_id,
std::vector<int> ids(unique_ids);
int separator_index = -1;
- if (ids[0] < 0 && ids.size() > 1) {
+ if (display_warning_if_disabled_) {
Ilya Sherman 2011/07/26 09:01:55 If display_warning_if_disabled_ is true, that does
honten.org 2011/07/27 03:29:37 I needed a couple of cast, so I made a function.
+ // If autofill is disabled and we had suggestions, show a warning instead.
+ v.assign(1,
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_FORM_DISABLED));
+ l.assign(1, string16());
+ i.assign(1, string16());
+ ids.assign(1, -1);
+ } else if (ids[0] < 0 && ids.size() > 1) {
// If we received a warning instead of suggestions from autofill but regular
// suggestions from autocomplete, don't show the autofill warning.
v.erase(v.begin());
@@ -320,7 +327,9 @@ void AutofillAgent::ShowSuggestions(const WebInputElement& element,
bool autofill_on_empty_values,
bool requires_caret_at_end,
bool display_warning_if_disabled) {
- if (!element.isEnabled() || element.isReadOnly() || !element.autoComplete() ||
+ const WebFormElement form = element.form();
+ if (!element.isEnabled() || element.isReadOnly() ||
+ (!element.autoComplete() && form.autoComplete()) ||
!element.isTextField() || element.isPasswordField() ||
!element.suggestedValue().isEmpty())
return;
@@ -342,7 +351,8 @@ void AutofillAgent::ShowSuggestions(const WebInputElement& element,
element.selectionEnd() != static_cast<int>(value.length())))
return;
- QueryAutofillSuggestions(element, display_warning_if_disabled);
+ QueryAutofillSuggestions(element,
+ display_warning_if_disabled && !form.autoComplete());
Ilya Sherman 2011/07/26 09:01:55 Does this not prevent other warnings from ever dis
honten.org 2011/07/27 03:29:37 I don't need this check anymore. On 2011/07/26 09
}
void AutofillAgent::QueryAutofillSuggestions(const WebNode& node,
« 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