1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5#include "nsISupports.idl"
6
7interface nsIAutoCompletePopup;
8
9webidl Document;
10webidl Element;
11webidl Event;
12webidl HTMLInputElement;
13
14/*
15 * nsIFormFillController is an interface for controlling form fill behavior
16 * on HTML documents.  Any number of docShells can be controller concurrently.
17 * While a docShell is attached, all HTML documents that are loaded within it
18 * will have a focus listener attached that will listen for when a text input
19 * is focused.  When this happens, the input will be bound to the
20 * global nsIAutoCompleteController service.
21 */
22
23[scriptable, uuid(07f0a0dc-f6e9-4cdd-a55f-56d770523a4c)]
24interface nsIFormFillController : nsISupports
25{
26  /*
27   * The input element the form fill controller is currently bound to.
28   */
29  readonly attribute HTMLInputElement focusedInput;
30
31  /*
32   * Whether the autocomplete popup on a password field was automatically opened
33   * by the form fill controller (upon focus).
34   */
35  readonly attribute boolean passwordPopupAutomaticallyOpened;
36
37  // Only used by tests.
38  void attachPopupElementToDocument(in Document document, in Element popup);
39  void detachFromDocument(in Document document);
40
41  /*
42   * Mark the specified <input> element as being managed by password manager.
43   * Autocomplete requests will be handed off to the password manager, and will
44   * not be stored in form history.
45   *
46   * @param aInput - The HTML <input> element to tag
47   */
48  [can_run_script] void markAsLoginManagerField(in HTMLInputElement aInput);
49
50  /*
51   * Mark the specified <input> element as being managed by a form autofill component.
52   * Autocomplete requests will be handed off to the autofill component.
53   *
54   * @param aInput - The HTML <input> element to mark
55   */
56  [can_run_script] void markAsAutofillField(in HTMLInputElement aInput);
57
58  /*
59   * Open the autocomplete popup, if possible.
60   */
61  [can_run_script] void showPopup();
62};
63