Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_WEBDATA_AUTOFILL_ENTRY_H__ | 5 #ifndef CHROME_BROWSER_WEBDATA_AUTOFILL_ENTRY_H__ |
| 6 #define CHROME_BROWSER_WEBDATA_AUTOFILL_ENTRY_H__ | 6 #define CHROME_BROWSER_WEBDATA_AUTOFILL_ENTRY_H__ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 ~AutofillEntry(); | 39 ~AutofillEntry(); |
| 40 | 40 |
| 41 const AutofillKey& key() const { return key_; } | 41 const AutofillKey& key() const { return key_; } |
| 42 const std::vector<base::Time>& timestamps() const { return timestamps_; } | 42 const std::vector<base::Time>& timestamps() const { return timestamps_; } |
| 43 | 43 |
| 44 bool operator==(const AutofillEntry& entry) const; | 44 bool operator==(const AutofillEntry& entry) const; |
| 45 bool operator<(const AutofillEntry& entry) const; | 45 bool operator<(const AutofillEntry& entry) const; |
| 46 | 46 |
| 47 bool timestamps_culled() const { return timestamps_culled_; } | 47 bool timestamps_culled() const { return timestamps_culled_; } |
| 48 | 48 |
| 49 // Checks if last of the timestamps are older than |time|. | |
| 50 bool LastAccessOlder(base::Time time) const; | |
| 51 | |
| 52 // The period after which Autofill entries should expire in days. | |
| 53 static const int64 kExpirationPeriodInDays = 60; | |
| 54 | |
| 49 private: | 55 private: |
| 50 FRIEND_TEST_ALL_PREFIXES(AutofillEntryTest, NoCulling); | 56 FRIEND_TEST_ALL_PREFIXES(AutofillEntryTest, NoCulling); |
| 51 FRIEND_TEST_ALL_PREFIXES(AutofillEntryTest, Culling); | 57 FRIEND_TEST_ALL_PREFIXES(AutofillEntryTest, Culling); |
| 58 FRIEND_TEST_ALL_PREFIXES(AutofillEntryTest, CullByTime); | |
| 52 | 59 |
| 53 // Culls the list of timestamps to |kMaxAutofillTimeStamps| latest timestamps. | 60 // Culls the list of timestamps to 2 - the first and last used. This is a |
|
Ilya Sherman
2012/03/15 21:00:41
nit: Perhaps "first and last used" -> "oldest and
GeorgeY
2012/03/17 00:36:16
Done.
| |
| 54 // Result is stored in |result|. If the original vtor's size is less | 61 // precursor to getting rid of the timestamps db altogether. |
|
Ilya Sherman
2012/03/15 21:00:41
If you plan to remove the timestamps db in a separ
GeorgeY
2012/03/17 00:36:16
Done.
| |
| 55 // than kMaxAutofillTimeStamps then false is returned. Otherwise true is | |
| 56 // returned. Note: source and result should be DIFFERENT vectors. | |
| 57 static bool CullTimeStamps(const std::vector<base::Time>& source, | 62 static bool CullTimeStamps(const std::vector<base::Time>& source, |
| 58 std::vector<base::Time>* result); | 63 std::vector<base::Time>* result); |
| 59 | 64 |
| 60 AutofillKey key_; | 65 AutofillKey key_; |
| 61 std::vector<base::Time> timestamps_; | 66 std::vector<base::Time> timestamps_; |
| 62 bool timestamps_culled_; | 67 bool timestamps_culled_; |
| 63 }; | 68 }; |
| 64 | 69 |
| 65 // TODO(lipalani): Move this inside the class defintion. | |
| 66 const unsigned int kMaxAutofillTimeStamps = 50; | |
| 67 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_ENTRY_H__ | 70 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_ENTRY_H__ |
| OLD | NEW |