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..4133a6c7c7f0ce9003a90a4ea2862e5faf9176e3 |
--- /dev/null |
+++ b/chrome/common/extensions/api/autofill_private.idl |
@@ -0,0 +1,190 @@ |
+// 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 { |
+ 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 displayed 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 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; |
+ |
+ // 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; |
+ |
+ // 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 component to be shown in an address editor. Different countries have |
+ // different components to their addresses. |
+ dictionary AddressComponent { |
+ // The type of field that this is. |
+ AddressField field; |
+ |
+ // The name of the field. |
+ DOMString fieldName; |
+ |
+ // A hint for the UI regarding whether the input is likely to be long. |
+ boolean isLongField; |
+ }; |
+ |
+ // 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; |
+ }; |
+ |
+ // Parameters to be passed to validatePhoneNumbers(). |
+ dictionary ValidatePhoneParams { |
+ // The phone numbers to validate. |
+ DOMString[] phoneNumbers; |
+ |
+ // The index into |phoneNumbers| at which the newly-added/edited phone |
+ // number resides. |
+ long indexOfNewNumber; |
+ |
+ // The country code for the numbers. |
+ DOMString countryCode; |
+ }; |
+ |
+ callback GetAddressComponentsCallback = |
+ void(AddressComponent[][] components); |
+ callback ValidatePhoneNumbersCallback = |
+ void(DOMString[] validatedPhoneNumbers); |
+ |
+ interface Functions { |
+ // Saves the given address. If |address| has an empty string as its ID, it |
+ // will be assigned a new one and added as a new entry. |
+ // |
+ // |address|: The address entry to save. |
+ static void saveAddress(AddressEntry address); |
+ |
+ // 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 |card| has an empty string as its |
+ // ID, it will be assigned a new one and added as a new entry. |
+ // |
+ // |card|: The card entry to save. |
+ static void saveCreditCard(CreditCardEntry card); |
+ |
+ // 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. |
+ // |
+ // |params|: The parameters to this function. |
+ // |callback|: Callback which will be called with validated phone numbers. |
+ static DOMString[] validatePhoneNumbers(ValidatePhoneParams params, |
+ 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|: GUID of the credit card 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 onCreditCardListChanged(CreditCardEntry[] entries); |
+ }; |
+}; |