Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: chrome/renderer/form_manager.cc

Issue 2842062: AutoFill: Record whether the user initiated the form submission and don't save form data if the form (Closed)
Patch Set: Relax DCHECK. Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/common/render_messages.h ('k') | webkit/glue/form_data.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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();
333 334
334 // If the completed URL is not valid, just use the action we get from 335 // If the completed URL is not valid, just use the action we get from
335 // WebKit. 336 // WebKit.
336 if (!form->action.is_valid()) 337 if (!form->action.is_valid())
337 form->action = GURL(element.action()); 338 form->action = GURL(element.action());
338 339
339 // A map from a FormField's name to the FormField itself. 340 // A map from a FormField's name to the FormField itself.
340 std::map<string16, FormField*> name_map; 341 std::map<string16, FormField*> name_map;
341 342
342 // The extracted FormFields. We use pointers so we can store them in 343 // The extracted FormFields. We use pointers so we can store them in
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 return; 893 return;
893 894
894 WebInputElement input_element = field->to<WebInputElement>(); 895 WebInputElement input_element = field->to<WebInputElement>();
895 896
896 // If the maxlength attribute contains a negative value, maxLength() 897 // If the maxlength attribute contains a negative value, maxLength()
897 // returns the default maxlength value. 898 // returns the default maxlength value.
898 input_element.setSuggestedValue( 899 input_element.setSuggestedValue(
899 data->value().substr(0, input_element.maxLength())); 900 data->value().substr(0, input_element.maxLength()));
900 input_element.setAutofilled(true); 901 input_element.setAutofilled(true);
901 } 902 }
OLDNEW
« no previous file with comments | « chrome/common/render_messages.h ('k') | webkit/glue/form_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698