blob: 95a2492d19c5f3d058ba10f87410fd2245de8800 [file] [log] [blame]
// Copyright 2020 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.autofillAssistantPrivate</code> API to interact with
// the Autofill Assistant execution engine. Access is restricted to a set of
// extensions part of an allowlist.
//
// The correct usage of this API is to to first call <code>create</code>, then
// add listeners for the Events and then call <code>start</code>.
// <code>onActionsChanged</code> will be called when actions become available
// and can be executed via <code>performAction</code>.
namespace autofillAssistantPrivate {
// Success or error of a function call will be communicated by setting
// $(ref:runtime.lastError).
callback VoidCallback = void ();
dictionary ActionObject {
// The name for the action.
DOMString name;
// |onActionsChanged| returns an array of ActionObjects. |index|
// corresponds to the position in that array and is also the index to be
// passed to |performAction|.
long index;
};
interface Functions {
// Creates the autofill assistant controller and cleans up and existing
// controller if applicable.
static void create(optional VoidCallback callback);
// Starts the controller with the given parameters.
static void start(any parameters, optional VoidCallback callback);
// Performs an action.
// |index|: The index into the |actions| array provided by
// |onActionsChanged|.
static void performAction(
long index, optional VoidCallback callback);
// Set user data to configure collect data actions.
static void provideUserData(optional VoidCallback callback);
};
interface Events {
// Fires when the status message changed.
//
// |message| The new status of the autofill assistant controller.
static void onStatusMessageChanged(DOMString message);
// Fires when a set of actions has changed.
//
// |actions| The new list of available actions.
static void onActionsChanged(ActionObject[] actions);
};
};