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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/autofill/autofill_field.h ('k') | chrome/browser/autofill/autofill_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/autofill/autofill_field.h"
6
7 #include "base/logging.h"
8 #include "base/sha1.h"
9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h"
11
12 namespace {
13
14 static std::string Hash32Bit(const std::string& str) {
15 std::string hash_bin = base::SHA1HashString(str);
16 DCHECK(hash_bin.length() == 20);
17
18 uint32 hash32 = ((hash_bin[0] & 0xFF) << 24) |
19 ((hash_bin[1] & 0xFF) << 16) |
20 ((hash_bin[2] & 0xFF) << 8) |
21 (hash_bin[3] & 0xFF);
22
23 return UintToString(hash32);
24 }
25
26 } // namespace
27
28 AutoFillField::AutoFillField(const webkit_glue::FormField& field)
29 : webkit_glue::FormField(field) {
30 }
31
32 std::string AutoFillField::FieldSignature() const {
33 std::string field_name = UTF16ToUTF8(name());
34 std::string type = UTF16ToUTF8(html_input_type());
35 std::string field_string = field_name + "&" + type;
36 return Hash32Bit(field_string);
37 }
OLDNEW
« 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