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/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" |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 return false; | 325 return false; |
326 | 326 |
327 if (requirements & REQUIRE_AUTOCOMPLETE && !element.autoComplete()) | 327 if (requirements & REQUIRE_AUTOCOMPLETE && !element.autoComplete()) |
328 return false; | 328 return false; |
329 | 329 |
330 form->name = element.name(); | 330 form->name = element.name(); |
331 form->method = element.method(); | 331 form->method = element.method(); |
332 form->origin = frame->url(); | 332 form->origin = frame->url(); |
333 form->action = frame->document().completeURL(element.action()); | 333 form->action = frame->document().completeURL(element.action()); |
334 form->user_submitted = element.wasUserSubmitted(); | 334 form->user_submitted = element.wasUserSubmitted(); |
| 335 form->locale = UTF16ToUTF8(element.computeInheritedLanguage()); |
335 | 336 |
336 // If the completed URL is not valid, just use the action we get from | 337 // If the completed URL is not valid, just use the action we get from |
337 // WebKit. | 338 // WebKit. |
338 if (!form->action.is_valid()) | 339 if (!form->action.is_valid()) |
339 form->action = GURL(element.action()); | 340 form->action = GURL(element.action()); |
340 | 341 |
341 // A map from a FormField's name to the FormField itself. | 342 // A map from a FormField's name to the FormField itself. |
342 std::map<string16, FormField*> name_map; | 343 std::map<string16, FormField*> name_map; |
343 | 344 |
344 // The extracted FormFields. We use pointers so we can store them in | 345 // The extracted FormFields. We use pointers so we can store them in |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 return; | 895 return; |
895 | 896 |
896 WebInputElement input_element = field->to<WebInputElement>(); | 897 WebInputElement input_element = field->to<WebInputElement>(); |
897 | 898 |
898 // If the maxlength attribute contains a negative value, maxLength() | 899 // If the maxlength attribute contains a negative value, maxLength() |
899 // returns the default maxlength value. | 900 // returns the default maxlength value. |
900 input_element.setSuggestedValue( | 901 input_element.setSuggestedValue( |
901 data->value().substr(0, input_element.maxLength())); | 902 data->value().substr(0, input_element.maxLength())); |
902 input_element.setAutofilled(true); | 903 input_element.setAutofilled(true); |
903 } | 904 } |
OLD | NEW |