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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 if (!frame) | 287 if (!frame) |
288 return false; | 288 return false; |
289 | 289 |
290 if (requirements & REQUIRE_AUTOCOMPLETE && !element.autoComplete()) | 290 if (requirements & REQUIRE_AUTOCOMPLETE && !element.autoComplete()) |
291 return false; | 291 return false; |
292 | 292 |
293 form->name = element.name(); | 293 form->name = element.name(); |
294 form->method = element.method(); | 294 form->method = element.method(); |
295 form->origin = frame->url(); | 295 form->origin = frame->url(); |
296 form->action = frame->document().completeURL(element.action()); | 296 form->action = frame->document().completeURL(element.action()); |
| 297 form->user_submitted = element.wasUserSubmitted(); |
297 | 298 |
298 // If the completed URL is not valid, just use the action we get from | 299 // If the completed URL is not valid, just use the action we get from |
299 // WebKit. | 300 // WebKit. |
300 if (!form->action.is_valid()) | 301 if (!form->action.is_valid()) |
301 form->action = GURL(element.action()); | 302 form->action = GURL(element.action()); |
302 | 303 |
303 // A map from a FormField's name to the FormField itself. | 304 // A map from a FormField's name to the FormField itself. |
304 std::map<string16, FormField*> name_map; | 305 std::map<string16, FormField*> name_map; |
305 | 306 |
306 // The extracted FormFields. We use pointers so we can store them in | 307 // 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... |
856 return; | 857 return; |
857 | 858 |
858 WebInputElement input_element = field->to<WebInputElement>(); | 859 WebInputElement input_element = field->to<WebInputElement>(); |
859 | 860 |
860 // If the maxlength attribute contains a negative value, maxLength() | 861 // If the maxlength attribute contains a negative value, maxLength() |
861 // returns the default maxlength value. | 862 // returns the default maxlength value. |
862 input_element.setSuggestedValue( | 863 input_element.setSuggestedValue( |
863 data->value().substr(0, input_element.maxLength())); | 864 data->value().substr(0, input_element.maxLength())); |
864 input_element.setAutofilled(true); | 865 input_element.setAutofilled(true); |
865 } | 866 } |
OLD | NEW |