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

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

Issue 13392014: Move c/b/webdata/ code to components/webdata/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pure merge Created 7 years, 8 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
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_WEBDATA_AUTOFILL_ENTRY_H__
6 #define CHROME_BROWSER_WEBDATA_AUTOFILL_ENTRY_H__
7
8 #include <stddef.h>
9 #include <vector>
10
11 #include "base/gtest_prod_util.h"
12 #include "base/string16.h"
13 #include "base/time.h"
14
15 class AutofillKey {
16 public:
17 AutofillKey();
18 AutofillKey(const string16& name, const string16& value);
19 AutofillKey(const char* name, const char* value);
20 AutofillKey(const AutofillKey& key);
21 virtual ~AutofillKey();
22
23 const string16& name() const { return name_; }
24 const string16& value() const { return value_; }
25
26 bool operator==(const AutofillKey& key) const;
27 bool operator<(const AutofillKey& key) const;
28
29 private:
30 string16 name_;
31 string16 value_;
32 };
33
34 class AutofillEntry {
35 public:
36 AutofillEntry(const AutofillKey& key,
37 const std::vector<base::Time>& timestamps);
38 ~AutofillEntry();
39
40 const AutofillKey& key() const { return key_; }
41 const std::vector<base::Time>& timestamps() const { return timestamps_; }
42
43 bool operator==(const AutofillEntry& entry) const;
44 bool operator<(const AutofillEntry& entry) const;
45
46 bool timestamps_culled() const { return timestamps_culled_; }
47
48 // Checks if last of the timestamps are older than ExpirationTime().
49 bool IsExpired() const;
50
51 // The entries last accessed before this time should expire.
52 static base::Time ExpirationTime();
53
54 private:
55 FRIEND_TEST_ALL_PREFIXES(AutofillEntryTest, NoCulling);
56 FRIEND_TEST_ALL_PREFIXES(AutofillEntryTest, Culling);
57 FRIEND_TEST_ALL_PREFIXES(AutofillEntryTest, CullByTime);
58
59 // Culls the list of timestamps to 2 - the oldest and most recent. This is a
60 // precursor to getting rid of the timestamps db altogether.
61 // See http://crbug.com/118696.
62 // |source| is expected to be sorted from oldest to newest.
63 static bool CullTimeStamps(const std::vector<base::Time>& source,
64 std::vector<base::Time>* result);
65
66 AutofillKey key_;
67 std::vector<base::Time> timestamps_;
68 bool timestamps_culled_;
69 };
70
71 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_ENTRY_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698