diff options
-rw-r--r-- | chrome/renderer/autofill_helper.cc | 11 | ||||
-rw-r--r-- | chrome/renderer/autofill_helper.h | 6 |
2 files changed, 14 insertions, 3 deletions
diff --git a/chrome/renderer/autofill_helper.cc b/chrome/renderer/autofill_helper.cc index 8b7a1ea..d2c263e 100644 --- a/chrome/renderer/autofill_helper.cc +++ b/chrome/renderer/autofill_helper.cc @@ -52,6 +52,7 @@ AutoFillHelper::AutoFillHelper(RenderView* render_view) : render_view_(render_view), autofill_query_id_(0), autofill_action_(AUTOFILL_NONE), + display_warning_if_disabled_(false), was_query_node_autofilled_(false), suggestions_clear_index_(-1), suggestions_options_index_(-1) { @@ -118,6 +119,10 @@ void AutoFillHelper::SuggestionsReceived(int query_id, ids.erase(ids.begin()); } + // If we were about to show a warning and we shouldn't, don't. + if (ids[0] < 0 && !display_warning_if_disabled_) + return; + // 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_)) { @@ -282,13 +287,15 @@ void AutoFillHelper::ShowSuggestions(const WebInputElement& element, element.selectionEnd() != static_cast<int>(value.length()))) return; - QueryAutoFillSuggestions(element); + QueryAutoFillSuggestions(element, display_warning_if_disabled); } -void AutoFillHelper::QueryAutoFillSuggestions(const WebNode& node) { +void AutoFillHelper::QueryAutoFillSuggestions( + const WebNode& node, bool display_warning_if_disabled) { static int query_counter = 0; autofill_query_id_ = query_counter++; autofill_query_node_ = node; + display_warning_if_disabled_ = display_warning_if_disabled; const WebFormControlElement& element = node.toConst<WebFormControlElement>(); webkit_glue::FormField field; diff --git a/chrome/renderer/autofill_helper.h b/chrome/renderer/autofill_helper.h index de1c909..67b137c 100644 --- a/chrome/renderer/autofill_helper.h +++ b/chrome/renderer/autofill_helper.h @@ -116,7 +116,8 @@ class AutoFillHelper : public PageClickListener { // Queries the browser for Autocomplete and AutoFill suggestions for the given // |node|. - void QueryAutoFillSuggestions(const WebKit::WebNode& node); + void QueryAutoFillSuggestions(const WebKit::WebNode& node, + bool display_warning_if_disabled); // Queries the AutoFillManager for form data for the form containing |node|. // |value| is the current text in the field, and |unique_id| is the selected @@ -144,6 +145,9 @@ class AutoFillHelper : public PageClickListener { // The action to take when receiving AutoFill data from the AutoFillManager. AutoFillAction autofill_action_; + // Should we display a warning if autofill is disabled? + bool display_warning_if_disabled_; + // Was the query node autofilled prior to previewing the form? bool was_query_node_autofilled_; |