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

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: if (!RemoveFormElementForID(pair_id)) 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.
55 // than kMaxAutofillTimeStamps then false is returned. Otherwise true is 62 // See http://crbug.com/118696.
56 // returned. Note: source and result should be DIFFERENT vectors. 63 // |source| is expected to be sorted from oldest to newest.
57 static bool CullTimeStamps(const std::vector<base::Time>& source, 64 static bool CullTimeStamps(const std::vector<base::Time>& source,
58 std::vector<base::Time>* result); 65 std::vector<base::Time>* result);
59 66
60 AutofillKey key_; 67 AutofillKey key_;
61 std::vector<base::Time> timestamps_; 68 std::vector<base::Time> timestamps_;
62 bool timestamps_culled_; 69 bool timestamps_culled_;
63 }; 70 };
64 71
65 // TODO(lipalani): Move this inside the class defintion.
66 const unsigned int kMaxAutofillTimeStamps = 50;
67 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_ENTRY_H__ 72 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_ENTRY_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698