| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/form_manager.h" | 5 #include "chrome/renderer/autofill/form_manager.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/scoped_vector.h" | 8 #include "base/scoped_vector.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement
.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement
.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 option_strings->reserve(list_items.size()); | 268 option_strings->reserve(list_items.size()); |
| 269 for (size_t i = 0; i < list_items.size(); ++i) { | 269 for (size_t i = 0; i < list_items.size(); ++i) { |
| 270 if (list_items[i].hasTagName("option")) | 270 if (list_items[i].hasTagName("option")) |
| 271 option_strings->push_back(list_items[i].to<WebOptionElement>().value()); | 271 option_strings->push_back(list_items[i].to<WebOptionElement>().value()); |
| 272 } | 272 } |
| 273 } | 273 } |
| 274 } | 274 } |
| 275 | 275 |
| 276 } // namespace | 276 } // namespace |
| 277 | 277 |
| 278 namespace autofill { |
| 279 |
| 278 struct FormManager::FormElement { | 280 struct FormManager::FormElement { |
| 279 WebKit::WebFormElement form_element; | 281 WebKit::WebFormElement form_element; |
| 280 std::vector<WebKit::WebFormControlElement> control_elements; | 282 std::vector<WebKit::WebFormControlElement> control_elements; |
| 281 std::vector<string16> control_values; | 283 std::vector<string16> control_values; |
| 282 }; | 284 }; |
| 283 | 285 |
| 284 FormManager::FormManager() { | 286 FormManager::FormManager() { |
| 285 } | 287 } |
| 286 | 288 |
| 287 FormManager::~FormManager() { | 289 FormManager::~FormManager() { |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 WebInputElement input_element = field->to<WebInputElement>(); | 915 WebInputElement input_element = field->to<WebInputElement>(); |
| 914 | 916 |
| 915 // If the maxlength attribute contains a negative value, maxLength() | 917 // If the maxlength attribute contains a negative value, maxLength() |
| 916 // returns the default maxlength value. | 918 // returns the default maxlength value. |
| 917 input_element.setSuggestedValue( | 919 input_element.setSuggestedValue( |
| 918 data->value().substr(0, input_element.maxLength())); | 920 data->value().substr(0, input_element.maxLength())); |
| 919 input_element.setAutofilled(true); | 921 input_element.setAutofilled(true); |
| 920 if (is_initiating_node) | 922 if (is_initiating_node) |
| 921 input_element.setSelectionRange(0, input_element.suggestedValue().length()); | 923 input_element.setSelectionRange(0, input_element.suggestedValue().length()); |
| 922 } | 924 } |
| 925 |
| 926 } // namespace autofill |
| OLD | NEW |