diff options
author | khorimoto <khorimoto@chromium.org> | 2015-04-24 13:19:08 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-24 20:19:09 +0000 |
commit | 42f03866782cc98e745a155294d5465d91858c1f (patch) | |
tree | f043011398397fff02faf499ea3d2ca4b1725798 | |
parent | f7553583492a8ea9a54d75cd6b2d3dd83c94512c (diff) | |
download | chromium_src-42f03866782cc98e745a155294d5465d91858c1f.zip chromium_src-42f03866782cc98e745a155294d5465d91858c1f.tar.gz chromium_src-42f03866782cc98e745a155294d5465d91858c1f.tar.bz2 |
Add the IDL and stub implementation for the chrome.autofillPrivate API.
See https://docs.google.com/document/d/1AZmbifXOirRdIcAkhgXT_u1wam5FRxy-Wt7I-kv3CCg/edit?usp=sharing for details.
BUG=479306
Review URL: https://codereview.chromium.org/1099313003
Cr-Commit-Position: refs/heads/master@{#326864}
16 files changed, 656 insertions, 0 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 470a5b6..96a7b5d 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -4603,6 +4603,9 @@ Even if you have downloaded files from this website before, the website might ha <message name="IDS_EXTENSION_PROMPT_WARNING_SEARCH_ENGINES_PRIVATE" desc="Permission string for access to search engines."> Read and change default and custom search engines </message> + <message name="IDS_EXTENSION_PROMPT_WARNING_AUTOFILL_PRIVATE" desc="Permission string for access to autofill settings."> + Read and change autofill settings + </message> <!-- Extension/App error messages --> <message name="IDS_EXTENSION_CANT_GET_ABSOLUTE_PATH" desc="Warning displayed in pack dialog when the absolute path to the extension directory can not be found."> diff --git a/chrome/browser/extensions/api/autofill_private/OWNERS b/chrome/browser/extensions/api/autofill_private/OWNERS new file mode 100644 index 0000000..1100e97 --- /dev/null +++ b/chrome/browser/extensions/api/autofill_private/OWNERS @@ -0,0 +1,2 @@ +khorimoto@chromium.org +stevenjb@chromium.org diff --git a/chrome/browser/extensions/api/autofill_private/autofill_private_api.cc b/chrome/browser/extensions/api/autofill_private/autofill_private_api.cc new file mode 100644 index 0000000..6dcd5ea --- /dev/null +++ b/chrome/browser/extensions/api/autofill_private/autofill_private_api.cc @@ -0,0 +1,109 @@ +// 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. + +#include "chrome/browser/extensions/api/autofill_private/autofill_private_api.h" + +#include "base/values.h" +#include "chrome/common/extensions/api/autofill_private.h" +#include "extensions/browser/extension_function_registry.h" + +namespace extensions { + +//////////////////////////////////////////////////////////////////////////////// +// AutofillPrivateSaveAddressFunction + +AutofillPrivateSaveAddressFunction::~AutofillPrivateSaveAddressFunction() {} + +ExtensionFunction::ResponseAction AutofillPrivateSaveAddressFunction::Run() { + scoped_ptr<api::autofill_private::SaveAddress::Params> parameters = + api::autofill_private::SaveAddress::Params::Create(*args_); + EXTENSION_FUNCTION_VALIDATE(parameters.get()); + + // TODO(khorimoto): Implement. + + return RespondNow(NoArguments()); +} + +//////////////////////////////////////////////////////////////////////////////// +// AutofillPrivate*Function + +AutofillPrivateGetAddressComponentsFunction:: + ~AutofillPrivateGetAddressComponentsFunction() {} + +ExtensionFunction::ResponseAction + AutofillPrivateGetAddressComponentsFunction::Run() { + scoped_ptr<api::autofill_private::GetAddressComponents::Params> parameters = + api::autofill_private::GetAddressComponents::Params::Create(*args_); + EXTENSION_FUNCTION_VALIDATE(parameters.get()); + + // TODO(khorimoto): Implement. + + return RespondNow(NoArguments()); +} + +//////////////////////////////////////////////////////////////////////////////// +// AutofillPrivateSaveCreditCardFunction + +AutofillPrivateSaveCreditCardFunction:: + ~AutofillPrivateSaveCreditCardFunction() {} + +ExtensionFunction::ResponseAction AutofillPrivateSaveCreditCardFunction::Run() { + scoped_ptr<api::autofill_private::SaveCreditCard::Params> parameters = + api::autofill_private::SaveCreditCard::Params::Create(*args_); + EXTENSION_FUNCTION_VALIDATE(parameters.get()); + + // TODO(khorimoto): Implement. + + return RespondNow(NoArguments()); +} + +//////////////////////////////////////////////////////////////////////////////// +// AutofillPrivateRemoveEntryFunction + +AutofillPrivateRemoveEntryFunction::~AutofillPrivateRemoveEntryFunction() {} + +ExtensionFunction::ResponseAction AutofillPrivateRemoveEntryFunction::Run() { + scoped_ptr<api::autofill_private::RemoveEntry::Params> parameters = + api::autofill_private::RemoveEntry::Params::Create(*args_); + EXTENSION_FUNCTION_VALIDATE(parameters.get()); + + // TODO(khorimoto): Implement. + + return RespondNow(NoArguments()); +} + +//////////////////////////////////////////////////////////////////////////////// +// AutofillPrivateValidatePhoneNumbersFunction + +AutofillPrivateValidatePhoneNumbersFunction:: + ~AutofillPrivateValidatePhoneNumbersFunction() {} + +ExtensionFunction::ResponseAction + AutofillPrivateValidatePhoneNumbersFunction::Run() { + scoped_ptr<api::autofill_private::ValidatePhoneNumbers::Params> parameters = + api::autofill_private::ValidatePhoneNumbers::Params::Create(*args_); + EXTENSION_FUNCTION_VALIDATE(parameters.get()); + + // TODO(khorimoto): Implement. + + return RespondNow(NoArguments()); +} + +//////////////////////////////////////////////////////////////////////////////// +// AutofillPrivateMaskCreditCardFunction + +AutofillPrivateMaskCreditCardFunction:: + ~AutofillPrivateMaskCreditCardFunction() {} + +ExtensionFunction::ResponseAction AutofillPrivateMaskCreditCardFunction::Run() { + scoped_ptr<api::autofill_private::MaskCreditCard::Params> parameters = + api::autofill_private::MaskCreditCard::Params::Create(*args_); + EXTENSION_FUNCTION_VALIDATE(parameters.get()); + + // TODO(khorimoto): Implement. + + return RespondNow(NoArguments()); +} + +} // namespace extensions diff --git a/chrome/browser/extensions/api/autofill_private/autofill_private_api.h b/chrome/browser/extensions/api/autofill_private/autofill_private_api.h new file mode 100644 index 0000000..776bd3a --- /dev/null +++ b/chrome/browser/extensions/api/autofill_private/autofill_private_api.h @@ -0,0 +1,115 @@ +// 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. + +#ifndef CHROME_BROWSER_EXTENSIONS_API_AUTOFILL_PRIVATE_AUTOFILL_PRIVATE_API_H_ +#define CHROME_BROWSER_EXTENSIONS_API_AUTOFILL_PRIVATE_AUTOFILL_PRIVATE_API_H_ + +#include <string> + +#include "base/macros.h" +#include "extensions/browser/extension_function.h" + +namespace extensions { + +class AutofillPrivateSaveAddressFunction : public UIThreadExtensionFunction { + public: + AutofillPrivateSaveAddressFunction() {} + DECLARE_EXTENSION_FUNCTION("autofillPrivate.saveAddress", + AUTOFILLPRIVATE_SAVEADDRESS); + + protected: + ~AutofillPrivateSaveAddressFunction() override; + + // ExtensionFunction overrides. + ResponseAction Run() override; + + private: + DISALLOW_COPY_AND_ASSIGN(AutofillPrivateSaveAddressFunction); +}; + +class AutofillPrivateGetAddressComponentsFunction : + public UIThreadExtensionFunction { + public: + AutofillPrivateGetAddressComponentsFunction() {} + DECLARE_EXTENSION_FUNCTION("autofillPrivate.getAddressComponents", + AUTOFILLPRIVATE_GETADDRESSCOMPONENTS); + + protected: + ~AutofillPrivateGetAddressComponentsFunction() override; + + // ExtensionFunction overrides. + ResponseAction Run() override; + + private: + DISALLOW_COPY_AND_ASSIGN(AutofillPrivateGetAddressComponentsFunction); +}; + +class AutofillPrivateSaveCreditCardFunction : public UIThreadExtensionFunction { + public: + AutofillPrivateSaveCreditCardFunction() {} + DECLARE_EXTENSION_FUNCTION("autofillPrivate.saveCreditCard", + AUTOFILLPRIVATE_SAVECREDITCARD); + + protected: + ~AutofillPrivateSaveCreditCardFunction() override; + + // ExtensionFunction overrides. + ResponseAction Run() override; + + private: + DISALLOW_COPY_AND_ASSIGN(AutofillPrivateSaveCreditCardFunction); +}; + +class AutofillPrivateRemoveEntryFunction : public UIThreadExtensionFunction { + public: + AutofillPrivateRemoveEntryFunction() {} + DECLARE_EXTENSION_FUNCTION("autofillPrivate.removeEntry", + AUTOFILLPRIVATE_REMOVEENTRY); + + protected: + ~AutofillPrivateRemoveEntryFunction() override; + + // ExtensionFunction overrides. + ResponseAction Run() override; + + private: + DISALLOW_COPY_AND_ASSIGN(AutofillPrivateRemoveEntryFunction); +}; + +class AutofillPrivateValidatePhoneNumbersFunction : + public UIThreadExtensionFunction { + public: + AutofillPrivateValidatePhoneNumbersFunction() {} + DECLARE_EXTENSION_FUNCTION("autofillPrivate.validatePhoneNumbers", + AUTOFILLPRIVATE_VALIDATEPHONENUMBERS); + + protected: + ~AutofillPrivateValidatePhoneNumbersFunction() override; + + // ExtensionFunction overrides. + ResponseAction Run() override; + + private: + DISALLOW_COPY_AND_ASSIGN(AutofillPrivateValidatePhoneNumbersFunction); +}; + +class AutofillPrivateMaskCreditCardFunction : public UIThreadExtensionFunction { + public: + AutofillPrivateMaskCreditCardFunction() {} + DECLARE_EXTENSION_FUNCTION("autofillPrivate.maskCreditCard", + AUTOFILLPRIVATE_MASKCREDITCARD); + + protected: + ~AutofillPrivateMaskCreditCardFunction() override; + + // ExtensionFunction overrides. + ResponseAction Run() override; + + private: + DISALLOW_COPY_AND_ASSIGN(AutofillPrivateMaskCreditCardFunction); +}; + +} // namespace extensions + +#endif // CHROME_BROWSER_EXTENSIONS_API_AUTOFILL_PRIVATE_AUTOFILL_PRIVATE_API_H_ diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi index 0fe207e..ecd4264 100644 --- a/chrome/chrome_browser_extensions.gypi +++ b/chrome/chrome_browser_extensions.gypi @@ -120,6 +120,8 @@ 'browser/extensions/api/activity_log_private/activity_log_private_api.h', 'browser/extensions/api/audio_modem/audio_modem_api.cc', 'browser/extensions/api/audio_modem/audio_modem_api.h', + 'browser/extensions/api/autofill_private/autofill_private_api.cc', + 'browser/extensions/api/autofill_private/autofill_private_api.h', 'browser/extensions/api/automation_internal/automation_action_adapter.h', 'browser/extensions/api/automation_internal/automation_internal_api.cc', 'browser/extensions/api/automation_internal/automation_internal_api.h', diff --git a/chrome/common/extensions/api/_api_features.json b/chrome/common/extensions/api/_api_features.json index 05d5811..518715b 100644 --- a/chrome/common/extensions/api/_api_features.json +++ b/chrome/common/extensions/api/_api_features.json @@ -84,6 +84,18 @@ "dependencies": ["permission:audioModem"], "contexts": ["blessed_extension"] }, + "autofillPrivate": [{ + "dependencies": ["permission:autofillPrivate"], + "contexts": ["blessed_extension"] + }, { + "channel": "trunk", + "contexts": ["webui"], + "matches": [ + "chrome://md-settings/*", + "chrome://settings/*", + "chrome://settings-frame/*" + ] + }], "automationInternal": { "internal": true, "dependencies": ["manifest:automation"], diff --git a/chrome/common/extensions/api/_permission_features.json b/chrome/common/extensions/api/_permission_features.json index 98d3799..d6eb23f 100644 --- a/chrome/common/extensions/api/_permission_features.json +++ b/chrome/common/extensions/api/_permission_features.json @@ -66,6 +66,11 @@ ] } ], + "autofillPrivate": { + "channel": "trunk", + "extension_types": ["extension", "platform_app"], + "location": "component" + }, "autotestPrivate": { "channel": "stable", "extension_types": ["extension", "legacy_packaged_app"], diff --git a/chrome/common/extensions/api/autofill_private.idl b/chrome/common/extensions/api/autofill_private.idl new file mode 100644 index 0000000..51124d9 --- /dev/null +++ b/chrome/common/extensions/api/autofill_private.idl @@ -0,0 +1,214 @@ +// 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_LEVEL_1, + ADDRESS_LEVEL_2, + ADDRESS_LEVEL_3, + 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; + + // Street address (multiple lines, newlines preserved). + DOMString? addressLines; + + // The broadest administrative level in the address, i.e. the province + // within which the locality is found; for example, in the US, this would be + // the state; in Switzerland it would be the canton; in the UK, the post + // town. + DOMString? addressLevel1; + + // The second administrative level, in addresses with two or more + // administrative levels; in the countries with two administrative levels, + // this would typically be the city, town, village, or other locality within + // which the relevant street address is found. + DOMString? addressLevel2; + + // The third administrative level, in addresses with three or more + // administrative levels. + DOMString? addressLevel3; + + // Postal code, post code, ZIP code, CEDEX code (if CEDEX, append "CEDEX", + // and the arrondissement, if relevant, to the address-level2 field). + DOMString? postalCode; + + // A sorting code is similar to a postal code. However, whereas a postal + // code normally refers to a single geographical location, a sorting code + // often does not. Instead, a sorting code is assigned to an organization, + // which might be geographically distributed. The most prominent example of + // a sorting code system is CEDEX in France. + 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; + }; + + // The address components for a given country code. Each entry in |components| + // 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. This dictionary also + // includes the associated language code. + dictionary AddressComponents { + // The components. + AddressComponent[][] components; + + // The language code. + DOMString languageCode; + }; + + // 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; + + // Name of the person who owns the credit card. + DOMString? name; + + // Credit card number. + DOMString? cardNumber; + + // Month as 2-character string ("01" = January, "12" = December). + DOMString? expirationMonth; + + // Year as a 4-character string (as in "2015"). + DOMString? 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(AddressComponents 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. + // + // |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); + }; +}; diff --git a/chrome/common/extensions/api/schemas.gypi b/chrome/common/extensions/api/schemas.gypi index f5eaf24..fddbb07 100644 --- a/chrome/common/extensions/api/schemas.gypi +++ b/chrome/common/extensions/api/schemas.gypi @@ -12,6 +12,7 @@ 'accessibility_private.json', 'activity_log_private.json', 'audio_modem.idl', + 'autofill_private.idl', 'automation.idl', 'automation_internal.idl', 'autotest_private.idl', diff --git a/chrome/common/extensions/permissions/chrome_api_permissions.cc b/chrome/common/extensions/permissions/chrome_api_permissions.cc index a30b3b0..4eb4d67 100644 --- a/chrome/common/extensions/permissions/chrome_api_permissions.cc +++ b/chrome/common/extensions/permissions/chrome_api_permissions.cc @@ -346,6 +346,11 @@ std::vector<APIPermissionInfo*> ChromeAPIPermissions::GetAllPermissions() APIPermissionInfo::kFlagCannotBeOptional, IDS_EXTENSION_PROMPT_WARNING_SEARCH_ENGINES_PRIVATE, PermissionMessage::kSearchEnginesPrivate}, + {APIPermission::kAutofillPrivate, + "autofillPrivate", + APIPermissionInfo::kFlagCannotBeOptional, + IDS_EXTENSION_PROMPT_WARNING_AUTOFILL_PRIVATE, + PermissionMessage::kAutofillPrivate}, // Full url access permissions. {APIPermission::kDebugger, diff --git a/chrome/common/extensions/permissions/chrome_permission_message_rules.cc b/chrome/common/extensions/permissions/chrome_permission_message_rules.cc index 7eb4692..f5eca76 100644 --- a/chrome/common/extensions/permissions/chrome_permission_message_rules.cc +++ b/chrome/common/extensions/permissions/chrome_permission_message_rules.cc @@ -505,6 +505,9 @@ ChromePermissionMessageRule::GetAllRules() { {IDS_EXTENSION_PROMPT_WARNING_SETTINGS_PRIVATE, {APIPermission::kSettingsPrivate}, {}}, + {IDS_EXTENSION_PROMPT_WARNING_AUTOFILL_PRIVATE, + {APIPermission::kAutofillPrivate}, + {}}, // Platform-app permission messages. diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h index 00ed443..542ce70 100644 --- a/extensions/browser/extension_function_histogram_value.h +++ b/extensions/browser/extension_function_histogram_value.h @@ -1071,6 +1071,12 @@ enum HistogramValue { FILEMANAGERPRIVATE_CONFIGUREPROVIDEDFILESYSTEM, SEARCHENGINESPRIVATE_GETDEFAULTSEARCHENGINES, SEARCHENGINESPRIVATE_SETSELECTEDSEARCHENGINE, + AUTOFILLPRIVATE_SAVEADDRESS, + AUTOFILLPRIVATE_GETADDRESSCOMPONENTS, + AUTOFILLPRIVATE_SAVECREDITCARD, + AUTOFILLPRIVATE_REMOVEENTRY, + AUTOFILLPRIVATE_VALIDATEPHONENUMBERS, + AUTOFILLPRIVATE_MASKCREDITCARD, // Last entry: Add new entries above and ensure to update // tools/metrics/histograms/histograms.xml. ENUM_BOUNDARY diff --git a/extensions/common/permissions/api_permission.h b/extensions/common/permissions/api_permission.h index 0a6114a..64187e8 100644 --- a/extensions/common/permissions/api_permission.h +++ b/extensions/common/permissions/api_permission.h @@ -56,6 +56,7 @@ class APIPermission { kAudio, kAudioCapture, kAudioModem, + kAutofillPrivate, kAutomation, kAutoTestPrivate, kBackground, diff --git a/extensions/common/permissions/permission_message.h b/extensions/common/permissions/permission_message.h index 4b81124..b24c50e 100644 --- a/extensions/common/permissions/permission_message.h +++ b/extensions/common/permissions/permission_message.h @@ -106,6 +106,7 @@ class PermissionMessage { kSettingsPrivate, kPrinterProvider, kSearchEnginesPrivate, + kAutofillPrivate, // Last entry: Add new entries above and ensure to update the // "ExtensionPermission2" enum in tools/metrics/histograms/histograms.xml. kEnumBoundary, diff --git a/third_party/closure_compiler/externs/autofill_private.js b/third_party/closure_compiler/externs/autofill_private.js new file mode 100644 index 0000000..84d2521 --- /dev/null +++ b/third_party/closure_compiler/externs/autofill_private.js @@ -0,0 +1,171 @@ +// 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. + +/** @fileoverview Externs generated from namespace: autofillPrivate */ + +/** + * @const + */ +chrome.autofillPrivate = {}; + +/** + * @enum {string} + * @see https://developer.chrome.com/extensions/autofillPrivate#type-AddressField + */ +chrome.autofillPrivate.AddressField = { + FULL_NAME: 'FULL_NAME', + COMPANY_NAME: 'COMPANY_NAME', + ADDRESS_LINES: 'ADDRESS_LINES', + ADDRESS_LEVEL_1: 'ADDRESS_LEVEL_1', + ADDRESS_LEVEL_2: 'ADDRESS_LEVEL_2', + ADDRESS_LEVEL_3: 'ADDRESS_LEVEL_3', + POSTAL_CODE: 'POSTAL_CODE', + SORTING_CODE: 'SORTING_CODE', + COUNTRY_CODE: 'COUNTRY_CODE', +}; + +/** + * @typedef {{ + * summaryLabel: string, + * summarySublabel: (string|undefined), + * isLocal: (boolean|undefined), + * isCached: (boolean|undefined) + * }} + * @see https://developer.chrome.com/extensions/autofillPrivate#type-AutofillMetadata + */ +var AutofillMetadata; + +/** + * @typedef {{ + * guid: (string|undefined), + * fullNames: (!Array<string>|undefined), + * companyName: (string|undefined), + * addressLines: (string|undefined), + * addressLevel1: (string|undefined), + * addressLevel2: (string|undefined), + * addressLevel3: (string|undefined), + * postalCode: (string|undefined), + * sortingCode: (string|undefined), + * country: (string|undefined), + * phoneNumbers: (!Array<string>|undefined), + * emailAddresses: (!Array<string>|undefined), + * languageCode: (string|undefined), + * metadata: (AutofillMetadata|undefined) + * }} + * @see https://developer.chrome.com/extensions/autofillPrivate#type-AddressEntry + */ +var AddressEntry; + +/** + * @typedef {{ + * field: !chrome.autofillPrivate.AddressField, + * fieldName: string, + * isLongField: boolean + * }} + * @see https://developer.chrome.com/extensions/autofillPrivate#type-AddressComponent + */ +var AddressComponent; + +/** + * @typedef {{ + * components: !Array<AddressComponent>, + * languageCode: string + * }} + * @see https://developer.chrome.com/extensions/autofillPrivate#type-AddressComponents + */ +var AddressComponents; + +/** + * @typedef {{ + * guid: (string|undefined), + * name: (string|undefined), + * cardNumber: (string|undefined), + * expirationMonth: (string|undefined), + * expirationYear: (string|undefined), + * metadata: (AutofillMetadata|undefined) + * }} + * @see https://developer.chrome.com/extensions/autofillPrivate#type-CreditCardEntry + */ +var CreditCardEntry; + +/** + * @typedef {{ + * phoneNumbers: !Array<string>, + * indexOfNewNumber: number, + * countryCode: string + * }} + * @see https://developer.chrome.com/extensions/autofillPrivate#type-ValidatePhoneParams + */ +var ValidatePhoneParams; + +/** + * 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. + * @param {AddressEntry} address The address entry to save. + * @see https://developer.chrome.com/extensions/autofillPrivate#method-saveAddress + */ +chrome.autofillPrivate.saveAddress = function(address) {}; + +/** + * Gets the address components for a given country code. + * @param {string} countryCode The country code for which to fetch the + * components. + * @param {function(AddressComponents):void} callback Callback which will be + * called with components. + * @see https://developer.chrome.com/extensions/autofillPrivate#method-getAddressComponents + */ +chrome.autofillPrivate.getAddressComponents = function(countryCode, 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. + * @param {CreditCardEntry} card The card entry to save. + * @see https://developer.chrome.com/extensions/autofillPrivate#method-saveCreditCard + */ +chrome.autofillPrivate.saveCreditCard = function(card) {}; + +/** + * Removes the entry (address or credit card) with the given ID. + * @param {string} guid ID of the entry to remove. + * @see https://developer.chrome.com/extensions/autofillPrivate#method-removeEntry + */ +chrome.autofillPrivate.removeEntry = function(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. + * @param {ValidatePhoneParams} params The parameters to this function. + * @param {function(!Array<string>):void} callback Callback which will be called + * with validated phone numbers. + * @return {!Array<string>} + * @see https://developer.chrome.com/extensions/autofillPrivate#method-validatePhoneNumbers + */ +chrome.autofillPrivate.validatePhoneNumbers = function(params, 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"). + * @param {string} guid GUID of the credit card to mask. + * @see https://developer.chrome.com/extensions/autofillPrivate#method-maskCreditCard + */ +chrome.autofillPrivate.maskCreditCard = function(guid) {}; + +/** + * Fired when the address list has changed, meaning that an entry has been + * added, removed, or changed. |entries| The updated list of entries. + * @type {!ChromeEvent} + * @see https://developer.chrome.com/extensions/autofillPrivate#event-onAddressListChanged + */ +chrome.autofillPrivate.onAddressListChanged; + +/** + * Fired when the credit card list has changed, meaning that an entry has been + * added, removed, or changed. |entries| The updated list of entries. + * @type {!ChromeEvent} + * @see https://developer.chrome.com/extensions/autofillPrivate#event-onCreditCardListChanged + */ +chrome.autofillPrivate.onCreditCardListChanged; + + diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index fd333aa..2c30deb 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -51305,6 +51305,12 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="1010" label="FILEMANAGERPRIVATE_CONFIGUREPROVIDEDFILESYSTEM"/> <int value="1011" label="SEARCHENGINESPRIVATE_GETDEFAULTSEARCHENGINES"/> <int value="1012" label="SEARCHENGINESPRIVATE_SETSELECTEDSEARCHENGINE"/> + <int value="1013" label="AUTOFILLPRIVATE_SAVEADDRESS"/> + <int value="1014" label="AUTOFILLPRIVATE_GETADDRESSCOMPONENTS"/> + <int value="1015" label="AUTOFILLPRIVATE_SAVECREDITCARD"/> + <int value="1016" label="AUTOFILLPRIVATE_REMOVEENTRY"/> + <int value="1017" label="AUTOFILLPRIVATE_VALIDATEPHONENUMBERS"/> + <int value="1018" label="AUTOFILLPRIVATE_MASKCREDITCARD"/> </enum> <enum name="ExtensionInstallCause" type="int"> |