| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 index == static_cast<unsigned>(suggestions_clear_index_)) { | 134 index == static_cast<unsigned>(suggestions_clear_index_)) { |
| 135 // User selected 'Clear form'. | 135 // User selected 'Clear form'. |
| 136 form_manager_.ClearFormWithNode(node); | 136 form_manager_.ClearFormWithNode(node); |
| 137 } else if (!unique_id) { | 137 } else if (!unique_id) { |
| 138 // User selected an Autocomplete entry, so we fill directly. | 138 // User selected an Autocomplete entry, so we fill directly. |
| 139 WebInputElement element = node.toConst<WebInputElement>(); | 139 WebInputElement element = node.toConst<WebInputElement>(); |
| 140 | 140 |
| 141 string16 substring = value; | 141 string16 substring = value; |
| 142 substring = substring.substr(0, element.maxLength()); | 142 substring = substring.substr(0, element.maxLength()); |
| 143 element.setValue(substring, true); | 143 element.setValue(substring, true); |
| 144 | |
| 145 WebFrame* webframe = node.document().frame(); | |
| 146 if (webframe) | |
| 147 webframe->notifiyPasswordListenerOfAutocomplete(element); | |
| 148 } else { | 144 } else { |
| 149 // Fill the values for the whole form. | 145 // Fill the values for the whole form. |
| 150 FillAutofillFormData(node, unique_id, AUTOFILL_FILL); | 146 FillAutofillFormData(node, unique_id, AUTOFILL_FILL); |
| 151 } | 147 } |
| 152 | 148 |
| 153 suggestions_clear_index_ = -1; | 149 suggestions_clear_index_ = -1; |
| 154 suggestions_options_index_ = -1; | 150 suggestions_options_index_ = -1; |
| 155 } | 151 } |
| 156 | 152 |
| 157 void AutofillAgent::didSelectAutofillSuggestion(const WebNode& node, | 153 void AutofillAgent::didSelectAutofillSuggestion(const WebNode& node, |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 // WebFormControlElementToFormField does not scrape the DOM for the field | 407 // WebFormControlElementToFormField does not scrape the DOM for the field |
| 412 // label, so find the label here. | 408 // label, so find the label here. |
| 413 // TODO(isherman): Add form and field identities so we can use the cached form | 409 // TODO(isherman): Add form and field identities so we can use the cached form |
| 414 // data in FormManager. | 410 // data in FormManager. |
| 415 field->label = FormManager::LabelForElement(element); | 411 field->label = FormManager::LabelForElement(element); |
| 416 | 412 |
| 417 return true; | 413 return true; |
| 418 } | 414 } |
| 419 | 415 |
| 420 } // namespace autofill | 416 } // namespace autofill |
| OLD | NEW |