Chromium Code Reviews| Index: chrome/browser/webdata/autofill_entry.cc |
| diff --git a/chrome/browser/webdata/autofill_entry.cc b/chrome/browser/webdata/autofill_entry.cc |
| index fe874a58cd8c4da8be15155a99f5e15ed43ace29..ad3632fd0c82b5a1e54b013468b6c93ed2551507 100644 |
| --- a/chrome/browser/webdata/autofill_entry.cc |
| +++ b/chrome/browser/webdata/autofill_entry.cc |
| @@ -1,12 +1,12 @@ |
| // 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 "chrome/browser/webdata/autofill_entry.h" |
| #include <algorithm> |
| #include <set> |
| #include "base/logging.h" |
| -#include "chrome/browser/webdata/autofill_entry.h" |
| #include "base/utf_string_conversions.h" |
| AutofillKey::AutofillKey() {} |
| @@ -72,6 +72,31 @@ bool AutofillEntry::operator<(const AutofillEntry& entry) const { |
| return key_ < entry.key(); |
| } |
| +bool AutofillEntry::HasTimestampsOlder(base::Time time) const { |
| + for (size_t i = 0; i < timestamps_.size(); ++i) |
|
Ilya Sherman
2012/03/06 08:48:35
nit: The loop body is more than one line, so pleas
GeorgeY
2012/03/09 20:14:24
Done.
|
| + if (timestamps_[i] < time) |
| + return true; |
| + return false; |
| +} |
| + |
| +bool AutofillEntry::CullExpiredTimeStamps(base::Time expire_before) { |
| + std::vector<base::Time> new_timestamps; |
| + new_timestamps.reserve(timestamps_.size()); |
| + |
| + for (size_t i = 0; i < timestamps_.size(); ++i) { |
| + if (timestamps_[i] >= expire_before) { |
| + new_timestamps.push_back(timestamps_[i]); |
| + } |
|
Ilya Sherman
2012/03/06 08:48:35
nit: One-line if-stmt, so no need for curlys.
GeorgeY
2012/03/09 20:14:24
Done.
|
| + } |
| + |
| + if (timestamps_.size() == new_timestamps.size()) |
| + return false; |
| + |
| + timestamps_.swap(new_timestamps); |
| + timestamps_culled_ = true; |
|
Ilya Sherman
2012/03/06 08:48:35
It seems a little odd to me that we're using times
GeorgeY
2012/03/09 20:14:24
Because the original culling just limits the numbe
|
| + return true; |
| +} |
| + |
| // Culls the list of timestamps to the most recent |kMaxAutofillTimeStamps|. |
| // If sync is enabled, at every browser restart, sync will do a match up of all |
| // autofill items on the server with all items on the web db. When webdb loads |