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

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

Issue 17392006: In components/autofill, move browser/ to core/browser/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to fix conflicts Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/browser/autofill_field.cc
diff --git a/components/autofill/browser/autofill_field.cc b/components/autofill/browser/autofill_field.cc
deleted file mode 100644
index 3adf024b2f99f2fa38991427a33b1ec977e3e0f9..0000000000000000000000000000000000000000
--- a/components/autofill/browser/autofill_field.cc
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (c) 2011 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 "components/autofill/browser/autofill_field.h"
-
-#include "base/logging.h"
-#include "base/sha1.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/utf_string_conversions.h"
-
-namespace {
-
-static std::string Hash32Bit(const std::string& str) {
- std::string hash_bin = base::SHA1HashString(str);
- DCHECK_EQ(20U, hash_bin.length());
-
- uint32 hash32 = ((hash_bin[0] & 0xFF) << 24) |
- ((hash_bin[1] & 0xFF) << 16) |
- ((hash_bin[2] & 0xFF) << 8) |
- (hash_bin[3] & 0xFF);
-
- return base::UintToString(hash32);
-}
-
-} // namespace
-
-namespace autofill {
-
-AutofillField::AutofillField()
- : server_type_(NO_SERVER_DATA),
- heuristic_type_(UNKNOWN_TYPE),
- phone_part_(IGNORED) {
-}
-
-AutofillField::AutofillField(const FormFieldData& field,
- const base::string16& unique_name)
- : FormFieldData(field),
- unique_name_(unique_name),
- server_type_(NO_SERVER_DATA),
- heuristic_type_(UNKNOWN_TYPE),
- phone_part_(IGNORED) {
-}
-
-AutofillField::~AutofillField() {}
-
-void AutofillField::set_heuristic_type(AutofillFieldType type) {
- if (type >= 0 && type < MAX_VALID_FIELD_TYPE &&
- type != FIELD_WITH_DEFAULT_VALUE) {
- heuristic_type_ = type;
- } else {
- NOTREACHED();
- // This case should not be reachable; but since this has potential
- // implications on data uploaded to the server, better safe than sorry.
- heuristic_type_ = UNKNOWN_TYPE;
- }
-}
-
-void AutofillField::set_server_type(AutofillFieldType type) {
- // Chrome no longer supports fax numbers, but the server still does.
- if (type >= PHONE_FAX_NUMBER && type <= PHONE_FAX_WHOLE_NUMBER)
- return;
-
- server_type_ = type;
-}
-
-AutofillFieldType AutofillField::type() const {
- if (server_type_ != NO_SERVER_DATA)
- return server_type_;
-
- return heuristic_type_;
-}
-
-bool AutofillField::IsEmpty() const {
- return value.empty();
-}
-
-std::string AutofillField::FieldSignature() const {
- std::string field_name = UTF16ToUTF8(name);
- std::string field_string = field_name + "&" + form_control_type;
- return Hash32Bit(field_string);
-}
-
-bool AutofillField::IsFieldFillable() const {
- return type() != UNKNOWN_TYPE;
-}
-
-} // namespace autofill
« no previous file with comments | « components/autofill/browser/autofill_field.h ('k') | components/autofill/browser/autofill_field_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698