Chromium Code Reviews| Index: chrome/common/extensions/api/autofill_private.idl |
| diff --git a/chrome/common/extensions/api/autofill_private.idl b/chrome/common/extensions/api/autofill_private.idl |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8209ea3ffcf6dccd4dc901c5b8ea55d00db9df77 |
| --- /dev/null |
| +++ b/chrome/common/extensions/api/autofill_private.idl |
| @@ -0,0 +1,168 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// Use the <code>chrome.autofillPrivate</code> API to add, remove, or update |
| +// autofill data from the settings UI. |
| +namespace autofillPrivate { |
| + // Fields used as part of an address. |
| + enum AddressField { |
|
not at google - send to devlin
2015/04/22 22:24:42
Not used
Kyle Horimoto
2015/04/22 23:27:02
Sorry, I forgot to add in the AddressComponent dic
|
| + FULL_NAME, |
| + COMPANY_NAME, |
| + ADDRESS_LINES, |
| + ADDRESS_LEVEL1, |
| + ADDRESS_LEVEL2, |
| + ADDRESS_LEVEL3, |
| + ADDRESS_LEVEL4, |
| + POSTAL_CODE, |
| + SORTING_CODE, |
| + COUNTRY_CODE |
| + }; |
| + |
| + // Metadata about an autofill entry (address or credit card) which is used to |
| + // render a summary list of all entries. |
| + dictionary AutofillMetadata { |
| + // Short summary of the address which is displalyed in the UI; an |
|
not at google - send to devlin
2015/04/22 22:24:42
displayed
Kyle Horimoto
2015/04/22 23:27:02
Done.
|
| + // undefined value means that this entry has just been created on the client |
| + // and has not yet been given a summary. |
| + DOMString summaryLabel; |
| + |
| + // Short, secondary summary of the address which is displalyed in the UI; an |
| + // undefined value means that this entry has just been created on the client |
| + // and has not yet been given a summary. |
| + DOMString summarySublabel; |
|
not at google - send to devlin
2015/04/22 22:24:42
Will there always be a sublabel?
Kyle Horimoto
2015/04/22 23:27:02
Made it optional.
|
| + |
| + // Whether the entry is locally owned by Chrome (as opposed to being a |
| + // profile synced down from the server). Non-local entries may not be |
| + // editable. |
| + boolean? isLocal; |
| + |
| + // For credit cards, whether this is a full copy of the card |
| + boolean? isCached; |
| + }; |
| + |
| + // An address entry which can be saved in the autofill section of the |
| + // settings UI. |
| + dictionary AddressEntry { |
| + // Globally unique identifier for this entry. |
| + DOMString guid; |
| + |
| + DOMString[] fullNames; |
| + |
| + DOMString companyName; |
|
not at google - send to devlin
2015/04/22 22:24:42
Should some of these entries be optional?
Kyle Horimoto
2015/04/22 23:27:02
You're right - in fact, all of them should be opti
|
| + |
| + // The street address, which may take multiple lines. |
| + DOMString addressLines; |
| + |
| + // The biggest address level (in USA, the state). |
| + DOMString addressLevel1; |
| + |
| + // The 2nd-biggest level (in USA, the city). |
| + DOMString addressLevel2; |
| + |
| + // The 3rd-biggest level (not used in USA). |
| + DOMString addressLevel3; |
| + |
| + // The 4th-biggest level (not used in USA). |
| + DOMString addressLevel4; |
| + |
| + DOMString postalCode; |
| + |
| + DOMString sortingCode; |
| + |
| + DOMString country; |
| + |
| + DOMString[] phoneNumbers; |
| + |
| + DOMString[] emailAddresses; |
| + |
| + DOMString languageCode; |
| + |
| + AutofillMetadata metadata; |
| + }; |
| + |
| + // A credit card entry which can be saved in the autofill section of the |
| + // settings UI. |
| + dictionary CreditCardEntry { |
| + // Globally unique identifier for this entry. |
| + DOMString guid; |
| + |
| + DOMString cardNumber; |
| + |
| + long expirationMonth; |
| + |
| + long expirationYear; |
| + |
| + AutofillMetadata metadata; |
| + }; |
| + |
| + callback GetAddressComponentsCallback = |
| + void(AddressComponents[][] components); |
| + callback ValidatePhoneNumbersCallback = |
| + void(DOMString[] validatedPhoneNumbers); |
| + |
| + interface Functions { |
| + // Saves the given address. If |entry| has an empty string as its ID, it |
| + // will be assigned a new one and added as a new entry. |
| + // |
| + // |entry|: The entry to save. |
| + static void saveAddress(AddressEntry entry); |
| + |
| + // Gets the address components for a given country code. This function |
| + // invokes the callback with an array of arrays of AddressComponents. Each |
| + // entry in the top-level array constitutes a row in the UI, while each |
| + // inner array/ contains the list of components to use in that row. For |
| + // example, city, state, and zip code are all included on the same line for |
| + // US addresses. |
| + // |
| + // |countryCode|: The country code for which to fetch the components. |
| + // |callback|: Callback which will be called with components. |
| + static void getAddressComponents(DOMString countryCode, |
| + GetAddressComponentsCallback callback); |
| + |
| + // Saves the given credit card. If |entry| has an empty string as its |
| + // ID, it will be assigned a new one and added as a new entry. |
| + // |
| + // |entry|: The entry to save. |
| + static void saveCreditCard(CreditCardEntry entry); |
| + |
| + // Removes the entry (address or credit card) with the given ID. |
| + // |
| + // |guid|: ID of the entry to remove. |
| + static void removeEntry(DOMString guid); |
| + |
| + // Validates a newly-added phone number and invokes the callback with a list |
| + // of validated numbers. Note that if the newly-added number was invalid, it |
| + // will not be returned in the list of valid numbers. |
| + // |
| + // |phoneNumbers|: The phone numbers to validate. |
| + // |indexOfNewNumber|: The index into |phoneNumbers| at which the new number |
| + // has been added. |
| + // |countryCode|: The country code for the numbers. |
| + // |callback|: Callback which will be called with validated phone numbers. |
| + static DOMString[] validatePhoneNumbers(DOMString[] phoneNumbers, |
|
not at google - send to devlin
2015/04/22 22:24:42
For large numbers of arguments, better to pass in
Kyle Horimoto
2015/04/22 23:27:02
Done.
|
| + long indexOfNewNumber, DOMString countryCode, |
| + ValidatePhoneNumbersCallback callback); |
| + |
| + // Clears the data associated with a wallet card which was saved |
| + // locally so that the saved copy is masked (e.g., "Card ending |
| + // in 1234"). |
| + // |
| + // |guid|: ID of the entry to mask. |
| + static void maskCreditCard(DOMString guid); |
| + }; |
| + |
| + interface Events { |
| + // Fired when the address list has changed, meaning that an entry has been |
| + // added, removed, or changed. |
| + // |
| + // |entries| The updated list of entries. |
| + static void onAddressListChanged(AddressEntry[] entries); |
| + |
| + // Fired when the credit card list has changed, meaning that an entry has |
| + // been added, removed, or changed. |
| + // |
| + // |entries| The updated list of entries. |
| + static void onAddressListChanged(CreditCardEntry[] entries); |
|
Dan Beam
2015/04/22 22:13:56
nit: onCreditCardListChanged ;)
Kyle Horimoto
2015/04/22 22:19:37
Done.
|
| + }; |
| +}; |