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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 // The index into |phoneNumbers| at which the newly-added/edited phone | 159 // The index into |phoneNumbers| at which the newly-added/edited phone |
160 // number resides. | 160 // number resides. |
161 long indexOfNewNumber; | 161 long indexOfNewNumber; |
162 | 162 |
163 // A two-character string representing the address' country. See | 163 // A two-character string representing the address' country. See |
164 // autofill_country.cc for a list of valid codes. | 164 // autofill_country.cc for a list of valid codes. |
165 DOMString countryCode; | 165 DOMString countryCode; |
166 }; | 166 }; |
167 | 167 |
168 callback GetAddressComponentsCallback = | 168 callback GetAddressComponentsCallback = void(AddressComponents components); |
169 void(AddressComponents components); | 169 callback GetAddressListCallback = void(AddressEntry[] entries); |
170 callback ValidatePhoneNumbersCallback = | 170 callback ValidatePhoneNumbersCallback = |
171 void(DOMString[] validatedPhoneNumbers); | 171 void(DOMString[] validatedPhoneNumbers); |
| 172 callback GetCreditCardListCallback = void(CreditCardEntry[] entries); |
172 | 173 |
173 interface Functions { | 174 interface Functions { |
174 // Saves the given address. If |address| has an empty string as its ID, it | 175 // Saves the given address. If |address| has an empty string as its ID, it |
175 // will be assigned a new one and added as a new entry. | 176 // will be assigned a new one and added as a new entry. |
176 // | 177 // |
177 // |address|: The address entry to save. | 178 // |address|: The address entry to save. |
178 static void saveAddress(AddressEntry address); | 179 static void saveAddress(AddressEntry address); |
179 | 180 |
180 // Gets the address components for a given country code. | 181 // Gets the address components for a given country code. |
181 // | 182 // |
182 // |countryCode|: A two-character string representing the address' country | 183 // |countryCode|: A two-character string representing the address' country |
183 // whose components should be returned. See autofill_country.cc for a | 184 // whose components should be returned. See autofill_country.cc for a |
184 // list of valid codes. | 185 // list of valid codes. |
185 // |callback|: Callback which will be called with components. | 186 // |callback|: Callback which will be called with components. |
186 static void getAddressComponents(DOMString countryCode, | 187 static void getAddressComponents(DOMString countryCode, |
187 GetAddressComponentsCallback callback); | 188 GetAddressComponentsCallback callback); |
188 | 189 |
| 190 // Gets the list of addresses. |
| 191 // |callback|: Callback which will be called with the list of addresses. |
| 192 static void getAddressList(GetAddressListCallback callback); |
| 193 |
189 // Saves the given credit card. If |card| has an empty string as its | 194 // Saves the given credit card. If |card| has an empty string as its |
190 // ID, it will be assigned a new one and added as a new entry. | 195 // ID, it will be assigned a new one and added as a new entry. |
191 // | 196 // |
192 // |card|: The card entry to save. | 197 // |card|: The card entry to save. |
193 static void saveCreditCard(CreditCardEntry card); | 198 static void saveCreditCard(CreditCardEntry card); |
194 | 199 |
195 // Removes the entry (address or credit card) with the given ID. | 200 // Removes the entry (address or credit card) with the given ID. |
196 // | 201 // |
197 // |guid|: ID of the entry to remove. | 202 // |guid|: ID of the entry to remove. |
198 static void removeEntry(DOMString guid); | 203 static void removeEntry(DOMString guid); |
199 | 204 |
200 // Validates a newly-added phone number and invokes the callback with a list | 205 // Validates a newly-added phone number and invokes the callback with a list |
201 // of validated numbers. Note that if the newly-added number was invalid, it | 206 // of validated numbers. Note that if the newly-added number was invalid, it |
202 // will not be returned in the list of valid numbers. | 207 // will not be returned in the list of valid numbers. |
203 // | 208 // |
204 // |params|: The parameters to this function. | 209 // |params|: The parameters to this function. |
205 // |callback|: Callback which will be called with validated phone numbers. | 210 // |callback|: Callback which will be called with validated phone numbers. |
206 static void validatePhoneNumbers(ValidatePhoneParams params, | 211 static void validatePhoneNumbers(ValidatePhoneParams params, |
207 ValidatePhoneNumbersCallback callback); | 212 ValidatePhoneNumbersCallback callback); |
208 | 213 |
| 214 // Gets the list of credit cards. |
| 215 // |callback|: Callback which will be called with the list of credit cards. |
| 216 static void getCreditCardList(GetCreditCardListCallback callback); |
| 217 |
209 // Clears the data associated with a wallet card which was saved | 218 // Clears the data associated with a wallet card which was saved |
210 // locally so that the saved copy is masked (e.g., "Card ending | 219 // locally so that the saved copy is masked (e.g., "Card ending |
211 // in 1234"). | 220 // in 1234"). |
212 // | 221 // |
213 // |guid|: GUID of the credit card to mask. | 222 // |guid|: GUID of the credit card to mask. |
214 static void maskCreditCard(DOMString guid); | 223 static void maskCreditCard(DOMString guid); |
215 }; | 224 }; |
216 | 225 |
217 interface Events { | 226 interface Events { |
218 // Fired when the address list has changed, meaning that an entry has been | 227 // Fired when the address list has changed, meaning that an entry has been |
219 // added, removed, or changed. | 228 // added, removed, or changed. |
220 // | 229 // |
221 // |entries| The updated list of entries. | 230 // |entries| The updated list of entries. |
222 static void onAddressListChanged(AddressEntry[] entries); | 231 static void onAddressListChanged(AddressEntry[] entries); |
223 | 232 |
224 // Fired when the credit card list has changed, meaning that an entry has | 233 // Fired when the credit card list has changed, meaning that an entry has |
225 // been added, removed, or changed. | 234 // been added, removed, or changed. |
226 // | 235 // |
227 // |entries| The updated list of entries. | 236 // |entries| The updated list of entries. |
228 static void onCreditCardListChanged(CreditCardEntry[] entries); | 237 static void onCreditCardListChanged(CreditCardEntry[] entries); |
229 }; | 238 }; |
230 }; | 239 }; |
OLD | NEW |