1 // Copyright 2013 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.
5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DATA_MODEL_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DATA_MODEL_H_
10 #include "base/strings/string16.h"
11 #include "base/time/time.h"
12 #include "components/autofill/core/browser/form_group.h"
18 // This class is an interface for the primary data models that back Autofill.
19 // The information in objects of this class is managed by the
20 // PersonalDataManager.
21 class AutofillDataModel
: public FormGroup
{
23 AutofillDataModel(const std::string
& guid
, const std::string
& origin
);
24 ~AutofillDataModel() override
;
26 // Returns true if the data in this model was entered directly by the user,
27 // rather than automatically aggregated.
28 bool IsVerified() const;
30 // Called to update |use_count_| and |use_date_| when this data model is
31 // the subject of user interaction (usually, when it's used to fill a form).
34 std::string
guid() const { return guid_
; }
35 void set_guid(const std::string
& guid
) { guid_
= guid
; }
37 std::string
origin() const { return origin_
; }
38 void set_origin(const std::string
& origin
) { origin_
= origin
; }
40 size_t use_count() const { return use_count_
; }
41 void set_use_count(size_t count
) { use_count_
= count
; }
43 const base::Time
& use_date() const { return use_date_
; }
44 void set_use_date(const base::Time
& time
) { use_date_
= time
; }
46 const base::Time
& modification_date() const { return modification_date_
; }
47 // This should only be called from database code.
48 void set_modification_date(const base::Time
& time
) {
49 modification_date_
= time
;
53 // A globally unique ID for this object.
56 // The origin of this data. This should be
57 // (a) a web URL for the domain of the form from which the data was
58 // automatically aggregated, e.g. https://www.example.com/register,
59 // (b) some other non-empty string, which cannot be interpreted as a web
60 // URL, identifying the origin for non-aggregated data, or
61 // (c) an empty string, indicating that the origin for this data is unknown.
64 // The number of times this model has been used.
67 // The last time the model was used.
70 // The last time data in the model was modified.
71 base::Time modification_date_
;
74 } // namespace autofill
76 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DATA_MODEL_H_