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

Side by Side Diff: chrome/browser/autofill/form_structure.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
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/browser/autofill/form_structure.h" 5 #include "chrome/browser/autofill/form_structure.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/sha1.h" 9 #include "base/sha1.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 size_t field_size = fields_.size(); 322 size_t field_size = fields_.size();
323 return (field_size == 0) ? 0 : field_size - 1; 323 return (field_size == 0) ? 0 : field_size - 1;
324 } 324 }
325 325
326 FormData FormStructure::ConvertToFormData() const { 326 FormData FormStructure::ConvertToFormData() const {
327 FormData form; 327 FormData form;
328 form.name = form_name_; 328 form.name = form_name_;
329 form.origin = source_url_; 329 form.origin = source_url_;
330 form.action = target_url_; 330 form.action = target_url_;
331 331
332 // FormStructures can't be created by forms not submitted by the user.
333 form.user_submitted = true;
334
332 if (method_ == GET) 335 if (method_ == GET)
333 form.method = ASCIIToUTF16("GET"); 336 form.method = ASCIIToUTF16("GET");
334 else if (method_ == POST) 337 else if (method_ == POST)
335 form.method = ASCIIToUTF16("POST"); 338 form.method = ASCIIToUTF16("POST");
336 else 339 else
337 NOTREACHED(); 340 NOTREACHED();
338 341
339 for (std::vector<AutoFillField*>::const_iterator iter = fields_.begin(); 342 for (std::vector<AutoFillField*>::const_iterator iter = fields_.begin();
340 iter != fields_.end() && *iter; ++iter) { 343 iter != fields_.end() && *iter; ++iter) {
341 form.fields.push_back(static_cast<webkit_glue::FormField>(**iter)); 344 form.fields.push_back(static_cast<webkit_glue::FormField>(**iter));
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 } else { 431 } else {
429 buzz::XmlElement *field_element = new buzz::XmlElement( 432 buzz::XmlElement *field_element = new buzz::XmlElement(
430 buzz::QName(kXMLElementField)); 433 buzz::QName(kXMLElementField));
431 field_element->SetAttr(buzz::QName(kAttributeSignature), 434 field_element->SetAttr(buzz::QName(kAttributeSignature),
432 field->FieldSignature()); 435 field->FieldSignature());
433 encompassing_xml_element->AddElement(field_element); 436 encompassing_xml_element->AddElement(field_element);
434 } 437 }
435 } 438 }
436 return true; 439 return true;
437 } 440 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_manager.cc ('k') | chrome/browser/autofill/form_structure_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698