blob: d0f8913d1db573e63ed0a425a41560cf48de225a [file] [log] [blame]
[email protected]e52bc1e02009-12-17 22:45:271// 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
[email protected]8d21ff3b2010-02-25 00:31:475#include <set>
[email protected]e52bc1e02009-12-17 22:45:276#include "chrome/browser/webdata/autofill_entry.h"
7
8bool AutofillKey::operator==(const AutofillKey& key) const {
9 return name_ == key.name() && value_ == key.value();
10}
[email protected]f2fe1ca872010-02-10 23:29:3611
[email protected]8b3b23a2010-03-01 22:06:2112bool AutofillKey::operator<(const AutofillKey& key) const {
13 int diff = name_.compare(key.name());
14 if (diff < 0) {
15 return true;
16 } else if (diff == 0) {
17 return value_.compare(key.value()) < 0;
18 } else {
19 return false;
20 }
21}
22
[email protected]f2fe1ca872010-02-10 23:29:3623bool AutofillEntry::operator==(const AutofillEntry& entry) const {
[email protected]8d21ff3b2010-02-25 00:31:4724 if (!(key_ == entry.key()))
25 return false;
[email protected]f2fe1ca872010-02-10 23:29:3626
[email protected]8d21ff3b2010-02-25 00:31:4727 if (timestamps_.size() != entry.timestamps().size())
28 return false;
29
30 std::set<base::Time> other_timestamps(entry.timestamps().begin(),
31 entry.timestamps().end());
32 for (size_t i = 0; i < timestamps_.size(); i++) {
33 if (other_timestamps.count(timestamps_[i]) == 0)
34 return false;
35 }
36
37 return true;
38}
[email protected]8b3b23a2010-03-01 22:06:2139
40bool AutofillEntry::operator<(const AutofillEntry& entry) const {
41 return key_ < entry.key();
42}