1/*
2 * Copyright (C) 2016 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#pragma once
27
28#include <wtf/text/AtomString.h>
29#include <wtf/text/WTFString.h>
30
31namespace WebCore {
32
33enum class AutofillMantle {
34 Expectation,
35 Anchor
36};
37
38enum class AutofillFieldName {
39 None,
40 Name,
41 HonorificPrefix,
42 GivenName,
43 AdditionalName,
44 FamilyName,
45 HonorificSuffix,
46 Nickname,
47 Username,
48 NewPassword,
49 CurrentPassword,
50 OrganizationTitle,
51 Organization,
52 StreetAddress,
53 AddressLine1,
54 AddressLine2,
55 AddressLine3,
56 AddressLevel4,
57 AddressLevel3,
58 AddressLevel2,
59 AddressLevel1,
60 Country,
61 CountryName,
62 PostalCode,
63 CcName,
64 CcGivenName,
65 CcAdditionalName,
66 CcFamilyName,
67 CcNumber,
68 CcExp,
69 CcExpMonth,
70 CcExpYear,
71 CcCsc,
72 CcType,
73 TransactionCurrency,
74 TransactionAmount,
75 Language,
76 Bday,
77 BdayDay,
78 BdayMonth,
79 BdayYear,
80 Sex,
81 URL,
82 Photo,
83 Tel,
84 TelCountryCode,
85 TelNational,
86 TelAreaCode,
87 TelLocal,
88 TelLocalPrefix,
89 TelLocalSuffix,
90 TelExtension,
91 Email,
92 Impp
93};
94
95WEBCORE_EXPORT AutofillFieldName toAutofillFieldName(const AtomString&);
96
97class HTMLFormControlElement;
98
99class AutofillData {
100public:
101 static AutofillData createFromHTMLFormControlElement(const HTMLFormControlElement&);
102
103 AutofillData(const AtomString& fieldName, const String& idlExposedValue)
104 : fieldName(fieldName)
105 , idlExposedValue(idlExposedValue)
106 {
107 }
108
109 // We could add support for hint tokens and scope tokens if those ever became useful to anyone.
110
111 AtomString fieldName;
112 String idlExposedValue;
113};
114
115} // namespace WebCore
116