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

Unified Diff: chrome/browser/autofill/autofill_field.cc

Issue 355003: Implement FormStructure and an initial method, EncodeUploadRequest. This als... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autofill/autofill_field.h ('k') | chrome/browser/autofill/autofill_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/autofill_field.cc
===================================================================
--- chrome/browser/autofill/autofill_field.cc (revision 0)
+++ chrome/browser/autofill/autofill_field.cc (revision 0)
@@ -0,0 +1,37 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/autofill/autofill_field.h"
+
+#include "base/logging.h"
+#include "base/sha1.h"
+#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
+
+namespace {
+
+static std::string Hash32Bit(const std::string& str) {
+ std::string hash_bin = base::SHA1HashString(str);
+ DCHECK(hash_bin.length() == 20);
+
+ uint32 hash32 = ((hash_bin[0] & 0xFF) << 24) |
+ ((hash_bin[1] & 0xFF) << 16) |
+ ((hash_bin[2] & 0xFF) << 8) |
+ (hash_bin[3] & 0xFF);
+
+ return UintToString(hash32);
+}
+
+} // namespace
+
+AutoFillField::AutoFillField(const webkit_glue::FormField& field)
+ : webkit_glue::FormField(field) {
+}
+
+std::string AutoFillField::FieldSignature() const {
+ std::string field_name = UTF16ToUTF8(name());
+ std::string type = UTF16ToUTF8(html_input_type());
+ std::string field_string = field_name + "&" + type;
+ return Hash32Bit(field_string);
+}
Property changes on: chrome/browser/autofill/autofill_field.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/browser/autofill/autofill_field.h ('k') | chrome/browser/autofill/autofill_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698