1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625
|
// Copyright 2015 The Chromium Authors
// 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 {
// Subset of properties from the user account (signin component, AccountInfo).
dictionary AccountInfo {
DOMString email;
boolean isSyncEnabledForAutofillProfiles;
boolean isEligibleForAddressAccountStorage;
// Controls whether the Autofill Sync toggle should be available (duplicated
// from the Sync Settings page) on the Autofill Settings page.
// TODO(crbug.com/40943238): Remove when toggle becomes available on the Sync
// page for non-syncing users.
boolean isAutofillSyncToggleAvailable;
// Represents the UserSelectableType::kAutofill state (enabled or not).
// TODO(crbug.com/40943238): Remove when toggle becomes available on the Sync
// page for non-syncing users.
boolean isAutofillSyncToggleEnabled;
};
// A copy of FieldType from components/autofill/core/browser/field_types.h.
enum FieldType {
NO_SERVER_DATA,
UNKNOWN_TYPE,
EMPTY_TYPE,
NAME_FIRST,
NAME_MIDDLE,
NAME_LAST,
NAME_MIDDLE_INITIAL,
NAME_FULL,
NAME_SUFFIX,
ALTERNATIVE_FULL_NAME,
ALTERNATIVE_GIVEN_NAME,
ALTERNATIVE_FAMILY_NAME,
EMAIL_ADDRESS,
PHONE_HOME_NUMBER,
PHONE_HOME_CITY_CODE,
PHONE_HOME_COUNTRY_CODE,
PHONE_HOME_CITY_AND_NUMBER,
PHONE_HOME_WHOLE_NUMBER,
ADDRESS_HOME_LINE1,
ADDRESS_HOME_LINE2,
ADDRESS_HOME_APT_NUM,
ADDRESS_HOME_CITY,
ADDRESS_HOME_STATE,
ADDRESS_HOME_ZIP,
ADDRESS_HOME_COUNTRY,
CREDIT_CARD_NAME_FULL,
CREDIT_CARD_NUMBER,
CREDIT_CARD_EXP_MONTH,
CREDIT_CARD_EXP_2_DIGIT_YEAR,
CREDIT_CARD_EXP_4_DIGIT_YEAR,
CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR,
CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR,
CREDIT_CARD_TYPE,
CREDIT_CARD_VERIFICATION_CODE,
COMPANY_NAME,
FIELD_WITH_DEFAULT_VALUE,
MERCHANT_EMAIL_SIGNUP,
MERCHANT_PROMO_CODE,
PASSWORD,
ACCOUNT_CREATION_PASSWORD,
ADDRESS_HOME_STREET_ADDRESS,
ADDRESS_HOME_SORTING_CODE,
ADDRESS_HOME_DEPENDENT_LOCALITY,
ADDRESS_HOME_LINE3,
NOT_ACCOUNT_CREATION_PASSWORD,
USERNAME,
USERNAME_AND_EMAIL_ADDRESS,
NEW_PASSWORD,
PROBABLY_NEW_PASSWORD,
NOT_NEW_PASSWORD,
CREDIT_CARD_NAME_FIRST,
CREDIT_CARD_NAME_LAST,
PHONE_HOME_EXTENSION,
CONFIRMATION_PASSWORD,
AMBIGUOUS_TYPE,
SEARCH_TERM,
PRICE,
NOT_PASSWORD,
SINGLE_USERNAME,
NOT_USERNAME,
UPI_VPA,
ADDRESS_HOME_STREET_NAME,
ADDRESS_HOME_HOUSE_NUMBER,
ADDRESS_HOME_SUBPREMISE,
ADDRESS_HOME_OTHER_SUBUNIT,
NAME_LAST_PREFIX,
NAME_LAST_CORE,
NAME_LAST_FIRST,
NAME_LAST_CONJUNCTION,
NAME_LAST_SECOND,
NAME_HONORIFIC_PREFIX,
ADDRESS_HOME_ADDRESS,
ADDRESS_HOME_ADDRESS_WITH_NAME,
ADDRESS_HOME_FLOOR,
PHONE_HOME_CITY_CODE_WITH_TRUNK_PREFIX,
PHONE_HOME_CITY_AND_NUMBER_WITHOUT_TRUNK_PREFIX,
PHONE_HOME_NUMBER_PREFIX,
PHONE_HOME_NUMBER_SUFFIX,
IBAN_VALUE,
CREDIT_CARD_STANDALONE_VERIFICATION_CODE,
NUMERIC_QUANTITY,
ONE_TIME_CODE,
DELIVERY_INSTRUCTIONS,
ADDRESS_HOME_OVERFLOW,
ADDRESS_HOME_LANDMARK,
ADDRESS_HOME_OVERFLOW_AND_LANDMARK,
ADDRESS_HOME_ADMIN_LEVEL2,
ADDRESS_HOME_STREET_LOCATION,
ADDRESS_HOME_BETWEEN_STREETS,
ADDRESS_HOME_BETWEEN_STREETS_OR_LANDMARK,
ADDRESS_HOME_STREET_LOCATION_AND_LOCALITY,
ADDRESS_HOME_STREET_LOCATION_AND_LANDMARK,
ADDRESS_HOME_DEPENDENT_LOCALITY_AND_LANDMARK,
ADDRESS_HOME_BETWEEN_STREETS_1,
ADDRESS_HOME_BETWEEN_STREETS_2,
SINGLE_USERNAME_FORGOT_PASSWORD,
ADDRESS_HOME_APT,
ADDRESS_HOME_APT_TYPE,
ADDRESS_HOME_HOUSE_NUMBER_AND_APT,
SINGLE_USERNAME_WITH_INTERMEDIATE_VALUES,
PASSPORT_NAME_TAG,
PASSPORT_NUMBER,
PASSPORT_ISSUING_COUNTRY,
PASSPORT_EXPIRATION_DATE,
PASSPORT_ISSUE_DATE,
LOYALTY_MEMBERSHIP_PROGRAM,
LOYALTY_MEMBERSHIP_PROVIDER,
LOYALTY_MEMBERSHIP_ID,
VEHICLE_OWNER_TAG,
VEHICLE_LICENSE_PLATE,
VEHICLE_VIN,
VEHICLE_MAKE,
VEHICLE_MODEL,
DRIVERS_LICENSE_NAME_TAG,
DRIVERS_LICENSE_REGION,
DRIVERS_LICENSE_NUMBER,
DRIVERS_LICENSE_EXPIRATION_DATE,
DRIVERS_LICENSE_ISSUE_DATE,
VEHICLE_YEAR,
VEHICLE_PLATE_STATE,
EMAIL_OR_LOYALTY_MEMBERSHIP_ID,
MAX_VALID_FIELD_TYPE
};
// The address record type. Describes where the address is stored.
enum AddressRecordType {
// The address is stored in the Chrome infrastructure (locally and
// possibly synced between devices).
LOCAL_OR_SYNCABLE,
// The address is stored in a third party service that is tied
// to user's account.
ACCOUNT,
ACCOUNT_HOME,
ACCOUNT_WORK
};
// The type of data that can be stored for an attribute type.
enum AttributeTypeDataType {
COUNTRY,
DATE,
STRING
};
// 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/credit card 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/credit card 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? summarySublabel;
// For addresses. Describes where the address is stored.
AddressRecordType? recordType;
// For credit cards, whether the entry is locally owned by Chrome (as opposed to
// being synced down from the server). Non-local entries may not be editable.
boolean? isLocal;
// For credit cards, whether this is migratable (both the card number and
// expiration date valid and does not have the duplicated server card).
boolean? isMigratable;
// For credit cards. Indicates whether a card is eligible for virtual cards
// enrollment.
boolean? isVirtualCardEnrollmentEligible;
// For credit cards. Indicates whether a card has been enrolled in virtual
// cards if it is eligible.
boolean? isVirtualCardEnrolled;
};
// Represents single entry of the autofill profile, containing field type and
// the corresponding field value.
dictionary AddressField {
FieldType type;
DOMString value;
};
// 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;
// Fields have to be stored in the array with every field style stored only
// once.
AddressField[] fields;
DOMString? languageCode;
AutofillMetadata? metadata;
};
// An entry representing a country and its code.
dictionary CountryEntry {
// The internationalized name of the country.
DOMString? name;
// A two-character string representing the country.
DOMString? countryCode;
};
// A component to be shown in an address editor. Different countries have
// different components to their addresses.
dictionary AddressComponent {
// The field type.
FieldType field;
// The name of the field.
DOMString fieldName;
// A hint for the UI regarding whether the input is likely to be long.
boolean isLongField;
// Whether this component is required or not.
boolean isRequired;
// A placeholder for the text field to be used when the user has not yet
// input a value for the field.
DOMString? placeholder;
};
// A row of address components. Each component in a row should be shown in the
// same row in the UI. For example, city, state, and zip code are all included
// on the same line for US addresses.
dictionary AddressComponentRow {
AddressComponent[] row;
};
// 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.
AddressComponentRow[] 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;
// The card's instrument ID from the GPay server, if applicable.
DOMString? instrumentId;
// 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;
// Credit card's nickname.
DOMString? nickname;
// Credit card's network.
DOMString? network;
// Credit card's image source.
DOMString? imageSrc;
// Credit card's masked cvc.
DOMString? cvc;
// Credit card's product terms URL.
DOMString? productTermsUrl;
AutofillMetadata? metadata;
};
// An IBAN entry which can be saved in the autofill section of the
// settings UI.
dictionary IbanEntry {
// Globally unique identifier for this entry.
DOMString? guid;
// The IBAN's instrument ID from the GPay server, if applicable.
DOMString? instrumentId;
// IBAN value.
DOMString? value;
// IBAN's nickname.
DOMString? nickname;
AutofillMetadata? metadata;
};
// Contains the attribute type name and other relevant information about the
// attribute type. It is part of the `EntityInstance` API.
dictionary AttributeType {
// Contains the value of an `AttributeTypeName` on the C++ side.
long typeName;
// The type name as a human readable string.
DOMString typeNameAsString;
// The type of data stored for this attribute type.
AttributeTypeDataType dataType;
};
// Contains the entity type name and other relevant information about the
// entity type. It is part of the `EntityInstance` API.
dictionary EntityType {
// Contains the value of an `EntityTypeName` on the C++ side.
long typeName;
// The type name as a human readable string.
DOMString typeNameAsString;
// The i18n string representation of "Add <entity type>". Used in the entity
// instance adding settings UI. The string cannot be constructed
// dynamically, because the "<entity type>" string might need declension in
// some languages.
DOMString addEntityTypeString;
// The i18n string representation of "Edit <entity type>". Used in the
// entity instance editing settings UI. The string cannot be constructed
// dynamically, because the "<entity type>" string might need declension in
// some languages.
DOMString editEntityTypeString;
// The i18n string representation of "Delete <entity type>". Used in the
// entity instance deletion settings UI. The string cannot be constructed
// dynamically, because the "<entity type>" string might need declension in
// some languages.
DOMString deleteEntityTypeString;
};
// Contains date information: month, day and year.
dictionary DateValue {
// The year of the date valure, repesented as "YYYY". Example: "2016".
DOMString year;
// The month of the date value, without leading zeros. Example: "3" for
// March, "10" for October.
DOMString month;
// The day of the date value, without leading zeros. Example: "3", "30".
DOMString day;
};
// An attribute instance is a typed string value with additional metadata.
// It is associated with an `EntityInstance`.
dictionary AttributeInstance {
// Contains the attribute type name and other relevant information about the
// attribute type.
AttributeType type;
// The attribute instance value. If the `AttributeTypeDataType` is a `DATE`,
// then `value` is a `DateValue`. Otherwise, `value` is a `DOMString`.
(DOMString or DateValue) value;
};
// An entity instance entry which can be saved in the "Autofill with AI"
// section of the settings UI.
dictionary EntityInstance {
// Contains the entity type name and other relevant information about the
// entity type.
EntityType type;
// The attribute instances of this entity instance.
AttributeInstance[] attributeInstances;
// The guid of the entity instance.
DOMString guid;
// The nickname of the entity instance.
DOMString nickname;
};
// Contains the minimum amount of information needed to display an entity
// instance, along with the guid. The guid is needed to retrieve the complete
// information of the entity instance.
dictionary EntityInstanceWithLabels {
// The guid of the entity instance.
DOMString guid;
// The enitity instance label.
DOMString entityInstanceLabel;
// The enitity instance sublabel.
DOMString entityInstanceSubLabel;
};
// A Pay Over Time Issuer entry which can be displayed in the autofill
// section of the settings UI.
dictionary PayOverTimeIssuerEntry {
// Unique identifier for the Pay Over Time issuer.
DOMString? issuerId;
// The Pay Over Time issuer's instrument ID from the GPay server,
// if applicable.
DOMString? instrumentId;
// The Pay Over Time issuer's display name.
DOMString? displayName;
// The Pay Over Time issuer image source.
DOMString? imageSrc;
// The Pay Over Time issuer image source for dark theme.
DOMString? imageSrcDark;
};
callback VoidCallback = void();
callback GetAccountInfoCallback = void(optional AccountInfo accountInfo);
callback GetCountryListCallback = void(CountryEntry[] countries);
callback GetAddressComponentsCallback = void(AddressComponents components);
callback GetAddressListCallback = void(AddressEntry[] entries);
callback GetCreditCardListCallback = void(CreditCardEntry[] entries);
callback GetIbanListCallback = void(IbanEntry[] entries);
callback IsValidIbanCallback = void(boolean isValid);
callback GetCreditCardCallback = void(optional CreditCardEntry card);
callback CheckForDeviceAuthCallback = void(boolean isDeviceAuthAvailable);
callback LoadEntityInstancesCallback = void(EntityInstanceWithLabels[] entries);
callback GetEntityInstanceByGuid = void(EntityInstance entityInstance);
callback GetAllEntityTypesCallback = void(EntityType[] entityTypes);
callback GetAllAttributeTypesForEntityTypeNameCallback =
void(AttributeType[] attributeTypes);
callback GetAutofillAiOptInStatusCallback = void(boolean optedIn);
callback SetAutofillAiOptInStatusCallback = void(boolean success);
callback GetPayOverTimeIssuerListCallback = void(PayOverTimeIssuerEntry[] entries);
interface Functions {
// Gets currently signed-in user profile info, no value is returned if
// the user is not signed-in.
// |callback|: Callback which will be called with the info.
static void getAccountInfo(
GetAccountInfoCallback callback);
// 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);
// Removes the address with the given ID.
// |guid|: ID of the address to remove.
static void removeAddress(DOMString guid);
// Gets the list of all countries.
// |forAccountStorage|: whether the address profile opened in the editor
// originates in the user's profile.
// |callback|: Callback which will be called with the countries.
static void getCountryList(
boolean forAccountStorage,
GetCountryListCallback callback);
// Gets the address components for a given country code.
// |countryCode|: A two-character string representing the address' country
// whose components should be returned. See autofill_country.cc for a
// list of valid codes.
// |callback|: Callback which will be called with components.
static void getAddressComponents(
DOMString countryCode,
GetAddressComponentsCallback callback);
// Gets the list of addresses.
// |callback|: Callback which will be called with the list of addresses.
static void getAddressList(
GetAddressListCallback 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);
// Saves the given IBAN. If `iban` has an empty string as its ID, it will be
// assigned a new one and added as a new entry.
// |iban|: The IBAN entry to save.
static void saveIban(IbanEntry iban);
// Removes the payments entity with the given ID.
// |guid|: ID of the entity to remove.
static void removePaymentsEntity(DOMString guid);
// Gets the list of credit cards.
// |callback|: Callback which will be called with the list of credit cards.
static void getCreditCardList(
GetCreditCardListCallback callback);
// Gets the list of IBANs.
// |callback|: Callback which will be called with the list of IBANs.
static void getIbanList(
GetIbanListCallback callback);
// Returns true if the given `ibanValue` is a valid IBAN.
// |callback|: Callback which will be called with the result of IBAN
// validation.
static void isValidIban(
DOMString ibanValue, IsValidIbanCallback callback);
// Logs that the server cards edit link was clicked.
static void logServerCardLinkClicked();
// Logs that a server IBAN's edit link was clicked.
static void logServerIbanLinkClicked();
// Enrolls a credit card into virtual cards.
// |cardId|: The server side id of the credit card to be enrolled. Note it
// refers to the legacy server id of credit cards, not the instrument ids.
static void addVirtualCard(DOMString cardId);
// Unenrolls a credit card from virtual cards.
// |cardId|: The server side id of the credit card to be unenrolled. Note
// it refers to the legacy server id of credit cards, not the instrument
// ids.
static void removeVirtualCard(DOMString cardId);
// Gets the list of Pay Over Time Issuers.
// |callback|: Callback which will be called with the list of
// Pay Over Time Issuers.
static void getPayOverTimeIssuerList(
GetPayOverTimeIssuerListCallback callback);
// Authenticates the user via device authentication and if successful, it
// will then flip the mandatory auth toggle.
static void authenticateUserAndFlipMandatoryAuthToggle();
// Returns the local card based on the `guid` provided. The user could
// also be challenged with a reauth if that is enabled. For a successful
// auth, the local card is returned otherwise return a null object.
static void getLocalCard(
DOMString guid, GetCreditCardCallback callback);
// Returns true if there is authentication available on this device
// (biometric or screen lock), false otherwise.
static void checkIfDeviceAuthAvailable(
CheckForDeviceAuthCallback callback);
// Bulk delete all the CVCs (server and local) from the local webdata
// database. For server CVCs, this will also clear them from the Chrome
// sync server and thus other devices.
static void bulkDeleteAllCvcs();
// Sets the Sync Autofill toggle value, which corresponds to
// `syncer::UserSelectableType::kAutofill` in `SyncUserSettings`.
static void setAutofillSyncToggleEnabled(boolean enabled);
// Adds a new entity instance if it doesn't exist yet. Otherwise, it updates
// the entity instance.
static void addOrUpdateEntityInstance(
EntityInstance entityInstance, optional VoidCallback callback);
// Deletes an entity instance by its guid.
static void removeEntityInstance(
DOMString guid, optional VoidCallback callback);
// Returns all of the user's entity instances with labels.
static void loadEntityInstances(LoadEntityInstancesCallback callback);
// Returns the entity instance by its guid.
static void getEntityInstanceByGuid(
DOMString guid, GetEntityInstanceByGuid callback);
// Returns a list of all possible entity types. Used for the user to decide
// what entity instance to add.
static void getAllEntityTypes(GetAllEntityTypesCallback callback);
// Returns a list of all possible attribute types that can be set on an
// entity instance with the respective entity type name. Used for
// adding/editing a new entity instance.
static void getAllAttributeTypesForEntityTypeName(
long entityTypeName,
GetAllAttributeTypesForEntityTypeNameCallback callback);
// Gets the AutofillAI opt-in status for the current user.
static void getAutofillAiOptInStatus(
GetAutofillAiOptInStatusCallback callback);
// Sets the AutofillAI opt-in status for the current user.
static void setAutofillAiOptInStatus(
boolean optedIn,
SetAutofillAiOptInStatusCallback callback);
};
interface Events {
// Fired when the personal data has changed, meaning that an entry has
// been added, removed, or changed.
// `addressEntries`: the updated list of addresses.
// `creditCardEntries`: the updated list of credit cards.
// `ibans`: the updated list of IBANs.
// `payOverTimeIssuers`: the updated list of Pay Over Time issuers
// `accountInfo`: account info if the user is signed-in or no value if not.
static void onPersonalDataChanged(AddressEntry[] addressEntries,
CreditCardEntry[] creditCardEntries,
IbanEntry[] ibans,
PayOverTimeIssuerEntry[] payOverTimeIssuers,
optional AccountInfo accountInfo);
// Fired when the entity instances have changed (additions, updates,
// removals).
static void onEntityInstancesChanged(
EntityInstanceWithLabels[] entityInstancesWithLabels);
};
};
|