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