Bug 1850713: remove duplicated setting of early hint preloader id in `ScriptLoader...
[gecko.git] / dom / commandhandler / nsIControllerCommandTable.idl
blobbaec06fc1258e7552cdd32863bb3d053fb811b3d
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/. */
5 #include "nsISupports.idl"
6 #include "nsIControllerCommand.idl"
7 #include "nsICommandParams.idl"
9 %{C++
10 class nsControllerCommandTable;
13 /**
14 * nsIControllerCommandTable
16 * An interface via which a controller can maintain a series of commands,
17 * and efficiently dispatch commands to their respective handlers.
19 * Controllers that use an nsIControllerCommandTable should support
20 * nsIInterfaceRequestor, and be able to return an interface to their
21 * controller command table via getInterface().
25 [scriptable, builtinclass, uuid(c847f90e-b8f3-49db-a4df-8867831f2800)]
26 interface nsIControllerCommandTable : nsISupports
28 /**
29 * Make this command table immutable, so that commands cannot
30 * be registered or unregistered. Some command tables are made
31 * mutable after command registration so that they can be
32 * used as singletons.
34 void makeImmutable();
36 /**
37 * Register and unregister commands with the command table.
39 * @param aCommandName the name of the command under which to register or
40 * unregister the given command handler.
42 * @param aCommand the handler for this command.
44 void registerCommand(in string aCommandName, in nsIControllerCommand aCommand);
45 void unregisterCommand(in string aCommandName, in nsIControllerCommand aCommand);
47 /**
48 * Find the command handler which has been registered to handle the named command.
50 * @param aCommandName the name of the command to find the handler for.
52 nsIControllerCommand findCommandHandler(in string aCommandName);
54 /**
55 * Get whether the named command is enabled.
57 * @param aCommandName the name of the command to test
58 * @param aCommandRefCon the command context data
60 boolean isCommandEnabled(in string aCommandName, in nsISupports aCommandRefCon);
62 /**
63 * Tell the command to update its state (if it is a state updating command)
65 * @param aCommandName the name of the command to update
66 * @param aCommandRefCon the command context data
68 void updateCommandState(in string aCommandName, in nsISupports aCommandRefCon);
70 /**
71 * Get whether the named command is supported.
73 * @param aCommandName the name of the command to test
74 * @param aCommandRefCon the command context data
76 boolean supportsCommand(in string aCommandName, in nsISupports aCommandRefCon);
78 /**
79 * Execute the named command.
81 * @param aCommandName the name of the command to execute
82 * @param aCommandRefCon the command context data
84 [can_run_script]
85 void doCommand(in string aCommandName, in nsISupports aCommandRefCon);
87 [can_run_script]
88 void doCommandParams(in string aCommandName, in nsICommandParams aParam, in nsISupports aCommandRefCon);
90 void getCommandState(in string aCommandName, in nsICommandParams aParam, in nsISupports aCommandRefCon);
92 Array<ACString> getSupportedCommands();
94 %{C++
95 /**
96 * In order to avoid circular dependency issues, these methods are defined
97 * in nsControllerCommandTable.h. Consumers need to #include that header.
99 inline nsControllerCommandTable* AsControllerCommandTable();
100 inline const nsControllerCommandTable* AsControllerCommandTable() const;