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

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: Addressed the comments 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 last of the timestamps are older than ExpirationTime().
50 bool IsExpired() const;
51
52 // The entries last accessed before this time should expire.
53 static base::Time ExpirationTime();
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 oldest and most recent. This is a
54 // Result is stored in |result|. If the original vtor's size is less 61 // precursor to getting rid of the timestamps db altogether. (Issue #118696)
Ilya Sherman 2012/03/19 21:12:51 nit: Please include a link to the issue, i.e. http
GeorgeY 2012/03/20 20:47:58 Done.
55 // than kMaxAutofillTimeStamps then false is returned. Otherwise true is 62 // |source| is expected to be sorted from oldest to newest.
56 // returned. Note: source and result should be DIFFERENT vectors.
57 static bool CullTimeStamps(const std::vector<base::Time>& source, 63 static bool CullTimeStamps(const std::vector<base::Time>& source,
58 std::vector<base::Time>* result); 64 std::vector<base::Time>* result);
59 65
60 AutofillKey key_; 66 AutofillKey key_;
61 std::vector<base::Time> timestamps_; 67 std::vector<base::Time> timestamps_;
62 bool timestamps_culled_; 68 bool timestamps_culled_;
69
70 // The period after which Autofill entries should expire in days.
71 static const int64 kExpirationPeriodInDays = 60;
Ilya Sherman 2012/03/19 21:12:51 nit: Let's tuck this into the implementation file
GeorgeY 2012/03/20 20:47:58 Done.
63 }; 72 };
64 73
65 // TODO(lipalani): Move this inside the class defintion.
66 const unsigned int kMaxAutofillTimeStamps = 50;
67 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_ENTRY_H__ 74 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_ENTRY_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698