[email protected] | e52bc1e0 | 2009-12-17 22:45:27 | [diff] [blame] | 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 | |||||
[email protected] | 8d21ff3b | 2010-02-25 00:31:47 | [diff] [blame] | 5 | #include <set> |
[email protected] | e52bc1e0 | 2009-12-17 22:45:27 | [diff] [blame] | 6 | #include "chrome/browser/webdata/autofill_entry.h" |
7 | |||||
8 | bool AutofillKey::operator==(const AutofillKey& key) const { | ||||
9 | return name_ == key.name() && value_ == key.value(); | ||||
10 | } | ||||
[email protected] | f2fe1ca87 | 2010-02-10 23:29:36 | [diff] [blame] | 11 | |
[email protected] | 8b3b23a | 2010-03-01 22:06:21 | [diff] [blame^] | 12 | bool 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] | f2fe1ca87 | 2010-02-10 23:29:36 | [diff] [blame] | 23 | bool AutofillEntry::operator==(const AutofillEntry& entry) const { |
[email protected] | 8d21ff3b | 2010-02-25 00:31:47 | [diff] [blame] | 24 | if (!(key_ == entry.key())) |
25 | return false; | ||||
[email protected] | f2fe1ca87 | 2010-02-10 23:29:36 | [diff] [blame] | 26 | |
[email protected] | 8d21ff3b | 2010-02-25 00:31:47 | [diff] [blame] | 27 | 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] | 8b3b23a | 2010-03-01 22:06:21 | [diff] [blame^] | 39 | |
40 | bool AutofillEntry::operator<(const AutofillEntry& entry) const { | ||||
41 | return key_ < entry.key(); | ||||
42 | } |