Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: chrome/browser/webdata/autofill_entry.h

Issue 9585020: Cull autofill entries older than 60 days. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix spelling Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 any of the timestamps are older than |time|.
50 bool HasTimestampsOlder(base::Time time) const;
51
52 // Culls the |timestamps_| by expiring all prior to |expire_before|. Returns
53 // true if culling occured (and sets |timestamps_culled_|). Warning:
54 // |timestamps_| could become empty after this call.
55 bool CullExpiredTimeStamps(base::Time expire_before);
56
57 // The period after which Autofill entries should expire in days.
58 static const int64 kExpirationPeriodInDays = 60;
Ilya Sherman 2012/03/06 08:48:35 nit: This should be defined wherever it is used, r
GeorgeY 2012/03/09 20:14:24 It is used in two completely different places, thi
59
49 private: 60 private:
50 FRIEND_TEST_ALL_PREFIXES(AutofillEntryTest, NoCulling); 61 FRIEND_TEST_ALL_PREFIXES(AutofillEntryTest, NoCulling);
51 FRIEND_TEST_ALL_PREFIXES(AutofillEntryTest, Culling); 62 FRIEND_TEST_ALL_PREFIXES(AutofillEntryTest, Culling);
63 FRIEND_TEST_ALL_PREFIXES(AutofillEntryTest, CullByTime);
52 64
53 // Culls the list of timestamps to |kMaxAutofillTimeStamps| latest timestamps. 65 // Culls the list of timestamps to |kMaxAutofillTimeStamps| latest timestamps.
54 // Result is stored in |result|. If the original vtor's size is less 66 // Result is stored in |result|. If the original vtor's size is less
55 // than kMaxAutofillTimeStamps then false is returned. Otherwise true is 67 // than kMaxAutofillTimeStamps then false is returned. Otherwise true is
56 // returned. Note: source and result should be DIFFERENT vectors. 68 // returned. Note: source and result should be DIFFERENT vectors.
57 static bool CullTimeStamps(const std::vector<base::Time>& source, 69 static bool CullTimeStamps(const std::vector<base::Time>& source,
58 std::vector<base::Time>* result); 70 std::vector<base::Time>* result);
59 71
60 AutofillKey key_; 72 AutofillKey key_;
61 std::vector<base::Time> timestamps_; 73 std::vector<base::Time> timestamps_;
62 bool timestamps_culled_; 74 bool timestamps_culled_;
63 }; 75 };
64 76
65 // TODO(lipalani): Move this inside the class defintion. 77 // TODO(lipalani): Move this inside the class defintion.
66 const unsigned int kMaxAutofillTimeStamps = 50; 78 const unsigned int kMaxAutofillTimeStamps = 50;
67 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_ENTRY_H__ 79 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_ENTRY_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698