summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-04 23:30:37 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-04 23:30:37 +0000
commit7a9b0ba5648b9ea893f4f49dc332f3011ebee2d9 (patch)
tree1042d4981dfac4628d661a91337cc86181cbf182 /chrome/browser/autofill
parente7e993263d1994d2aae4394e2eb220a8ce2b68e3 (diff)
downloadchromium_src-7a9b0ba5648b9ea893f4f49dc332f3011ebee2d9.zip
chromium_src-7a9b0ba5648b9ea893f4f49dc332f3011ebee2d9.tar.gz
chromium_src-7a9b0ba5648b9ea893f4f49dc332f3011ebee2d9.tar.bz2
autofill: Implement a TODO.
Avoids 3 conversions to UTF8 by converting |form_name_| from std::string to string16. Patch from Thiago Farina <thiago.farina@gmail.com> Review URL: http://codereview.chromium.org/1845001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46410 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill')
-rw-r--r--chrome/browser/autofill/form_structure.cc8
-rw-r--r--chrome/browser/autofill/form_structure.h3
2 files changed, 5 insertions, 6 deletions
diff --git a/chrome/browser/autofill/form_structure.cc b/chrome/browser/autofill/form_structure.cc
index 460557e..c67b95f 100644
--- a/chrome/browser/autofill/form_structure.cc
+++ b/chrome/browser/autofill/form_structure.cc
@@ -57,7 +57,7 @@ static std::string Hash64Bit(const std::string& str) {
} // namespace
FormStructure::FormStructure(const FormData& form)
- : form_name_(UTF16ToUTF8(form.name)),
+ : form_name_(form.name),
source_url_(form.origin),
target_url_(form.action),
autofill_count_(0) {
@@ -165,7 +165,7 @@ std::string FormStructure::FormSignature() const {
"://" +
target_url_.host() +
"&" +
- form_name_ +
+ UTF16ToUTF8(form_name_) +
form_signature_field_names_;
return Hash64Bit(form_string);
@@ -216,7 +216,7 @@ size_t FormStructure::field_count() const {
FormData FormStructure::ConvertToFormData() const {
FormData form;
- form.name = UTF8ToUTF16(form_name_);
+ form.name = form_name_;
form.origin = source_url_;
form.action = target_url_;
@@ -237,7 +237,7 @@ FormData FormStructure::ConvertToFormData() const {
bool FormStructure::operator==(const FormData& form) const {
// TODO(jhawkins): Is this enough to differentiate a form?
- if (UTF8ToUTF16(form_name_) == form.name &&
+ if (form_name_ == form.name &&
source_url_ == form.origin &&
target_url_ == form.action) {
return true;
diff --git a/chrome/browser/autofill/form_structure.h b/chrome/browser/autofill/form_structure.h
index f429c3c..c9a4856 100644
--- a/chrome/browser/autofill/form_structure.h
+++ b/chrome/browser/autofill/form_structure.h
@@ -102,8 +102,7 @@ class FormStructure {
buzz::XmlElement* encompassing_xml_element) const;
// The name of the form.
- // TODO(jhawkins): string16
- std::string form_name_;
+ string16 form_name_;
// The source URL.
GURL source_url_;