1 // Copyright 2013 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.
5 #include "components/autofill/core/browser/webdata/autofill_entry.h"
7 #include "base/strings/utf_string_conversions.h"
11 AutofillKey::AutofillKey() {}
13 AutofillKey::AutofillKey(const base::string16
& name
,
14 const base::string16
& value
)
19 AutofillKey::AutofillKey(const char* name
, const char* value
)
20 : name_(base::UTF8ToUTF16(name
)),
21 value_(base::UTF8ToUTF16(value
)) {
24 AutofillKey::AutofillKey(const AutofillKey
& key
)
29 AutofillKey::~AutofillKey() {}
31 bool AutofillKey::operator==(const AutofillKey
& key
) const {
32 return name_
== key
.name() && value_
== key
.value();
35 bool AutofillKey::operator<(const AutofillKey
& key
) const {
36 int diff
= name_
.compare(key
.name());
41 return value_
.compare(key
.value()) < 0;
46 AutofillEntry::AutofillEntry(const AutofillKey
& key
,
47 const base::Time
& date_created
,
48 const base::Time
& date_last_used
)
50 date_created_(date_created
),
51 date_last_used_(date_last_used
) {}
53 AutofillEntry::~AutofillEntry() {}
55 bool AutofillEntry::operator==(const AutofillEntry
& entry
) const {
56 return key() == entry
.key() &&
57 date_created() == entry
.date_created() &&
58 date_last_used() == entry
.date_last_used();
61 bool AutofillEntry::operator<(const AutofillEntry
& entry
) const {
62 return key_
< entry
.key();
65 } // namespace autofill