| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // Use the <code>chrome.autofillPrivate</code> API to add, remove, or update | 5 // Use the <code>chrome.autofillPrivate</code> API to add, remove, or update |
| 6 // autofill data from the settings UI. | 6 // autofill data from the settings UI. |
| 7 namespace autofillPrivate { | 7 namespace autofillPrivate { |
| 8 // Fields used as part of an address. | 8 // Fields used as part of an address. |
| 9 enum AddressField { | 9 enum AddressField { |
| 10 FULL_NAME, | 10 FULL_NAME, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 DOMString[]? phoneNumbers; | 87 DOMString[]? phoneNumbers; |
| 88 | 88 |
| 89 DOMString[]? emailAddresses; | 89 DOMString[]? emailAddresses; |
| 90 | 90 |
| 91 DOMString? languageCode; | 91 DOMString? languageCode; |
| 92 | 92 |
| 93 AutofillMetadata? metadata; | 93 AutofillMetadata? metadata; |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 // An entry representing a country and its code. |
| 97 dictionary CountryEntry { |
| 98 // The internationalized name of the country. |
| 99 DOMString? name; |
| 100 |
| 101 // A two-character string representing the country. |
| 102 DOMString? countryCode; |
| 103 }; |
| 104 |
| 96 // A component to be shown in an address editor. Different countries have | 105 // A component to be shown in an address editor. Different countries have |
| 97 // different components to their addresses. | 106 // different components to their addresses. |
| 98 dictionary AddressComponent { | 107 dictionary AddressComponent { |
| 99 // The field type. | 108 // The field type. |
| 100 AddressField field; | 109 AddressField field; |
| 101 | 110 |
| 102 // The name of the field. | 111 // The name of the field. |
| 103 DOMString fieldName; | 112 DOMString fieldName; |
| 104 | 113 |
| 105 // A hint for the UI regarding whether the input is likely to be long. | 114 // A hint for the UI regarding whether the input is likely to be long. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 167 |
| 159 // The index into |phoneNumbers| at which the newly-added/edited phone | 168 // The index into |phoneNumbers| at which the newly-added/edited phone |
| 160 // number resides. | 169 // number resides. |
| 161 long indexOfNewNumber; | 170 long indexOfNewNumber; |
| 162 | 171 |
| 163 // A two-character string representing the address' country. See | 172 // A two-character string representing the address' country. See |
| 164 // autofill_country.cc for a list of valid codes. | 173 // autofill_country.cc for a list of valid codes. |
| 165 DOMString countryCode; | 174 DOMString countryCode; |
| 166 }; | 175 }; |
| 167 | 176 |
| 177 callback GetCountryListCallback = void(CountryEntry[] countries); |
| 168 callback GetAddressComponentsCallback = void(AddressComponents components); | 178 callback GetAddressComponentsCallback = void(AddressComponents components); |
| 169 callback GetAddressListCallback = void(AddressEntry[] entries); | 179 callback GetAddressListCallback = void(AddressEntry[] entries); |
| 170 callback ValidatePhoneNumbersCallback = | 180 callback ValidatePhoneNumbersCallback = |
| 171 void(DOMString[] validatedPhoneNumbers); | 181 void(DOMString[] validatedPhoneNumbers); |
| 172 callback GetCreditCardListCallback = void(CreditCardEntry[] entries); | 182 callback GetCreditCardListCallback = void(CreditCardEntry[] entries); |
| 173 | 183 |
| 174 interface Functions { | 184 interface Functions { |
| 175 // Saves the given address. If |address| has an empty string as its ID, it | 185 // Saves the given address. If |address| has an empty string as its ID, it |
| 176 // will be assigned a new one and added as a new entry. | 186 // will be assigned a new one and added as a new entry. |
| 177 // | |
| 178 // |address|: The address entry to save. | 187 // |address|: The address entry to save. |
| 179 static void saveAddress(AddressEntry address); | 188 static void saveAddress(AddressEntry address); |
| 180 | 189 |
| 190 // Gets the list of all countries. |
| 191 // |callback|: Callback which will be called with the countries. |
| 192 static void getCountryList(GetCountryListCallback callback); |
| 193 |
| 181 // Gets the address components for a given country code. | 194 // Gets the address components for a given country code. |
| 182 // | |
| 183 // |countryCode|: A two-character string representing the address' country | 195 // |countryCode|: A two-character string representing the address' country |
| 184 // whose components should be returned. See autofill_country.cc for a | 196 // whose components should be returned. See autofill_country.cc for a |
| 185 // list of valid codes. | 197 // list of valid codes. |
| 186 // |callback|: Callback which will be called with components. | 198 // |callback|: Callback which will be called with components. |
| 187 static void getAddressComponents(DOMString countryCode, | 199 static void getAddressComponents(DOMString countryCode, |
| 188 GetAddressComponentsCallback callback); | 200 GetAddressComponentsCallback callback); |
| 189 | 201 |
| 190 // Gets the list of addresses. | 202 // Gets the list of addresses. |
| 191 // |callback|: Callback which will be called with the list of addresses. | 203 // |callback|: Callback which will be called with the list of addresses. |
| 192 static void getAddressList(GetAddressListCallback callback); | 204 static void getAddressList(GetAddressListCallback callback); |
| 193 | 205 |
| 194 // Saves the given credit card. If |card| has an empty string as its | 206 // Saves the given credit card. If |card| has an empty string as its |
| 195 // ID, it will be assigned a new one and added as a new entry. | 207 // ID, it will be assigned a new one and added as a new entry. |
| 196 // | |
| 197 // |card|: The card entry to save. | 208 // |card|: The card entry to save. |
| 198 static void saveCreditCard(CreditCardEntry card); | 209 static void saveCreditCard(CreditCardEntry card); |
| 199 | 210 |
| 200 // Removes the entry (address or credit card) with the given ID. | 211 // Removes the entry (address or credit card) with the given ID. |
| 201 // | |
| 202 // |guid|: ID of the entry to remove. | 212 // |guid|: ID of the entry to remove. |
| 203 static void removeEntry(DOMString guid); | 213 static void removeEntry(DOMString guid); |
| 204 | 214 |
| 205 // Validates a newly-added phone number and invokes the callback with a list | 215 // Validates a newly-added phone number and invokes the callback with a list |
| 206 // of validated numbers. Note that if the newly-added number was invalid, it | 216 // of validated numbers. Note that if the newly-added number was invalid, it |
| 207 // will not be returned in the list of valid numbers. | 217 // will not be returned in the list of valid numbers. |
| 208 // | |
| 209 // |params|: The parameters to this function. | 218 // |params|: The parameters to this function. |
| 210 // |callback|: Callback which will be called with validated phone numbers. | 219 // |callback|: Callback which will be called with validated phone numbers. |
| 211 static void validatePhoneNumbers(ValidatePhoneParams params, | 220 static void validatePhoneNumbers(ValidatePhoneParams params, |
| 212 ValidatePhoneNumbersCallback callback); | 221 ValidatePhoneNumbersCallback callback); |
| 213 | 222 |
| 214 // Gets the list of credit cards. | 223 // Gets the list of credit cards. |
| 215 // |callback|: Callback which will be called with the list of credit cards. | 224 // |callback|: Callback which will be called with the list of credit cards. |
| 216 static void getCreditCardList(GetCreditCardListCallback callback); | 225 static void getCreditCardList(GetCreditCardListCallback callback); |
| 217 | 226 |
| 218 // Clears the data associated with a wallet card which was saved | 227 // Clears the data associated with a wallet card which was saved |
| 219 // locally so that the saved copy is masked (e.g., "Card ending | 228 // locally so that the saved copy is masked (e.g., "Card ending |
| 220 // in 1234"). | 229 // in 1234"). |
| 221 // | |
| 222 // |guid|: GUID of the credit card to mask. | 230 // |guid|: GUID of the credit card to mask. |
| 223 static void maskCreditCard(DOMString guid); | 231 static void maskCreditCard(DOMString guid); |
| 224 }; | 232 }; |
| 225 | 233 |
| 226 interface Events { | 234 interface Events { |
| 227 // Fired when the address list has changed, meaning that an entry has been | 235 // Fired when the address list has changed, meaning that an entry has been |
| 228 // added, removed, or changed. | 236 // added, removed, or changed. |
| 229 // | |
| 230 // |entries| The updated list of entries. | 237 // |entries| The updated list of entries. |
| 231 static void onAddressListChanged(AddressEntry[] entries); | 238 static void onAddressListChanged(AddressEntry[] entries); |
| 232 | 239 |
| 233 // Fired when the credit card list has changed, meaning that an entry has | 240 // Fired when the credit card list has changed, meaning that an entry has |
| 234 // been added, removed, or changed. | 241 // been added, removed, or changed. |
| 235 // | |
| 236 // |entries| The updated list of entries. | 242 // |entries| The updated list of entries. |
| 237 static void onCreditCardListChanged(CreditCardEntry[] entries); | 243 static void onCreditCardListChanged(CreditCardEntry[] entries); |
| 238 }; | 244 }; |
| 239 }; | 245 }; |
| OLD | NEW |