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 "components/autofill/core/browser/form_group.h"
17 // This class is an interface for the primary data models that back Autofill.
18 // The information in objects of this class is managed by the
19 // PersonalDataManager.
20 class AutofillDataModel
: public FormGroup
{
22 AutofillDataModel(const std::string
& guid
, const std::string
& origin
);
23 ~AutofillDataModel() override
;
25 // Returns the string that should be auto-filled into a text field given the
26 // |type| of that field, localized to the given |app_locale| if appropriate.
27 // If the data model supports multiple values for the given |type|, returns
28 // the |variant|th value for the |type|.
29 virtual base::string16
GetInfoForVariant(const AutofillType
& type
,
31 const std::string
& app_locale
) const;
33 // Returns true if the data in this model was entered directly by the user,
34 // rather than automatically aggregated.
35 bool IsVerified() const;
37 std::string
guid() const { return guid_
; }
38 void set_guid(const std::string
& guid
) { guid_
= guid
; }
40 std::string
origin() const { return origin_
; }
41 void set_origin(const std::string
& origin
) { origin_
= origin
; }
44 // A globally unique ID for this object.
47 // The origin of this data. This should be
48 // (a) a web URL for the domain of the form from which the data was
49 // automatically aggregated, e.g. https://www.example.com/register,
50 // (b) some other non-empty string, which cannot be interpreted as a web
51 // URL, identifying the origin for non-aggregated data, or
52 // (c) an empty string, indicating that the origin for this data is unknown.
56 } // namespace autofill
58 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DATA_MODEL_H_