chromium/components/autofill/core/browser/proto/api_v1.proto

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Data models to interface with Autofill API v1.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

package autofill;

import "password_requirements.proto";
import "server.proto";

// Request to retrieve field suggestions from Autofill API for forms in a page
// that can be used as a resource ID in a RESTful interface.
message AutofillPageResourceQueryRequest {
  // Serialized AutofillPageQueryRequest encoded in base64. We cannot use
  // "bytes" because this is not supported by the API. The serialized_request is
  // also a distinct signature that can be used for caching.
  optional string serialized_request = 1;
};

// Request to retrieve field suggestions for multiple forms in a page. You can
// see this as batched form requests.
// Next ID: 4
message AutofillPageQueryRequest {
  // Next ID: 5
  message Form {
    // Next ID: 5
    message Field {
      // Signature made of the field |name| and |control_type|.
      optional fixed32 signature = 1;
      // Name of the field (e.g., "First Name").
      optional string name = 2;
      // Type of the control (e.g., "email").
      optional string control_type = 3;
      // Metadata around the field.
      optional AutofillRandomizedFieldMetadata metadata = 4;
    };
    // Signature of the form that is made of:
    //  - URL scheme (e.g., "http")
    //  - URL domain page (e.g., "google.com")
    //  - Form name (e.g., "Sign In")
    //  - Concatenated field names (e.g., "First Name", "Last Name")
    optional fixed64 signature = 1;
    // Fields of the form for which we want suggestions.
    repeated Field fields = 2;
    // Metadata around the form.
    optional AutofillRandomizedFormMetadata metadata = 3;
    // Alternative signature of the form that is made of:
    //  - URL scheme (e.g., "http")
    //  - URL domain page (e.g., "google.com")
    //  - Concatenated fields' form control types (e.g., "text", "password")
    //  - For forms with 1-2 fields, one of the following non-empty elements
    //  ordered by preference: path, reference, or query.
    optional fixed64 alternative_signature = 4;
  };
  // Version of the client. Do not use, deprecated.
  optional string client_version = 1 [deprecated = true];
  // Forms in the same page for which we want fields suggestions.
  repeated Form forms = 2;
  // The collection of server-side experiments to use.
  repeated int64 experiments = 3;
};

// Response containing field suggestions from Autofill API for
// AutofillPageQueryRequest request. Form and fields are in the exact same order
// as in the request that gave the response.
// Next ID: 2
message AutofillQueryResponse {
  // Next ID: 3
  message FormSuggestion {
    // Next ID: 7
    message FieldSuggestion {
      // Prediction made on a field.
      // Next ID: 5
      message FieldPrediction {
        // This lists all the different ways predictions can be provided,
        // including some experiments.
        enum Source {
          // No source for this prediction. This is only valid for
          // NO_SERVER_DATA predictions.
          SOURCE_UNSPECIFIED = 0;
          // The autofill prediction, with no experiments enabled.
          SOURCE_AUTOFILL_DEFAULT = 1;
          // The password manager prediction, with no experiments enabled.
          SOURCE_PASSWORDS_DEFAULT = 2;
          // The prediction came from an override list.
          SOURCE_OVERRIDE = 3;
          // The autofill prediction came from the experiment which combines all
          // approved experiments.
          SOURCE_ALL_APPROVED_EXPERIMENTS = 4;
          // The autofill prediction came from the experiment which considers
          // fields ranks.
          SOURCE_FIELD_RANKS = 5;
          // The prediction was specified as a command line override (used for
          // testing purposes only).
          SOURCE_MANUAL_OVERRIDE = 6;
        }

        // The predicted field type.
        // See components/autofill/core/browser/field_types.h for defined types.
        // It is not guaranteed that the value of |type| is known to the enum.
        optional int32 type = 1;
        // Indicates if the prediction is an override.
        optional bool override = 2 [default = false];
        // The source of the prediction. E.g. which pipeline, which experiment,
        // etc.
        optional Source source = 3;
        reserved 4;  // repeated .autofill.AlternativeType alternative_types
      }
      // Signature identifying the field that is the same as in the request.
      optional fixed32 field_signature = 1;
      reserved 2;  // optional int32 primary_type_prediction
      // Detailed list of all possible predictions. Contains an autofill and/or
      // a password manager prediction.
      repeated FieldPrediction predictions = 3;
      // Whether the server-side classification believes that the field
      // may be pre-filled with a placeholder in the value attribute.
      optional bool may_use_prefilled_placeholder = 4;
      // For fields of type NEW_PASSWORD and ACCOUNT_CREATION_PASSWORD, this may
      // specify requirements for the generation of passwords.
      optional .autofill.PasswordRequirementsSpec password_requirements = 5;
      reserved 6;  // optional bool primary_type_prediction_is_override
    };
    // Suggestions on the fields in the same form.
    repeated FieldSuggestion field_suggestions = 1;
    reserved 2;  // repeated .autofill.Context contexts
  };
  // Suggestions for forms in the same page.
  repeated FormSuggestion form_suggestions = 1;
};

// Next ID: 2
message AutofillUploadRequest {
  // Content of the upload for voting.
  optional AutofillUploadContents upload = 1;
}