| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/renderer/autofill/autofill_agent.h" | 5 #include "chrome/renderer/autofill/autofill_agent.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/common/autofill_messages.h" | 9 #include "chrome/common/autofill_messages.h" |
| 10 #include "chrome/common/chrome_constants.h" | 10 #include "chrome/common/chrome_constants.h" |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 } | 303 } |
| 304 autofill_action_ = AUTOFILL_NONE; | 304 autofill_action_ = AUTOFILL_NONE; |
| 305 Send(new AutofillHostMsg_DidFillAutofillFormData(routing_id())); | 305 Send(new AutofillHostMsg_DidFillAutofillFormData(routing_id())); |
| 306 } | 306 } |
| 307 | 307 |
| 308 void AutofillAgent::ShowSuggestions(const WebInputElement& element, | 308 void AutofillAgent::ShowSuggestions(const WebInputElement& element, |
| 309 bool autofill_on_empty_values, | 309 bool autofill_on_empty_values, |
| 310 bool requires_caret_at_end, | 310 bool requires_caret_at_end, |
| 311 bool display_warning_if_disabled) { | 311 bool display_warning_if_disabled) { |
| 312 if (!element.isEnabled() || element.isReadOnly() || !element.autoComplete() || | 312 if (!element.isEnabled() || element.isReadOnly() || !element.autoComplete() || |
| 313 !element.isTextField() || element.isPasswordField()) | 313 !element.isTextField() || element.isPasswordField() || |
| 314 !element.suggestedValue().isEmpty()) |
| 314 return; | 315 return; |
| 315 | 316 |
| 316 // If the field has no name, then we won't have values. | 317 // If the field has no name, then we won't have values. |
| 317 if (element.nameForAutofill().isEmpty()) | 318 if (element.nameForAutofill().isEmpty()) |
| 318 return; | 319 return; |
| 319 | 320 |
| 320 // Don't attempt to autofill with values that are too large. | 321 // Don't attempt to autofill with values that are too large. |
| 321 WebString value = element.value(); | 322 WebString value = element.value(); |
| 322 if (value.length() > kMaximumTextSizeForAutofill) | 323 if (value.length() > kMaximumTextSizeForAutofill) |
| 323 return; | 324 return; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 // WebFormControlElementToFormField does not scrape the DOM for the field | 396 // WebFormControlElementToFormField does not scrape the DOM for the field |
| 396 // label, so find the label here. | 397 // label, so find the label here. |
| 397 // TODO(jhawkins): Add form and field identities so we can use the cached form | 398 // TODO(jhawkins): Add form and field identities so we can use the cached form |
| 398 // data in FormManager. | 399 // data in FormManager. |
| 399 field->label = FormManager::LabelForElement(element); | 400 field->label = FormManager::LabelForElement(element); |
| 400 | 401 |
| 401 return true; | 402 return true; |
| 402 } | 403 } |
| 403 | 404 |
| 404 } // namespace autofill | 405 } // namespace autofill |
| OLD | NEW |