1 /* vim: set ts=2 sw=2 sts=2 et tw=80: */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 export class ControllersParent extends JSWindowActorParent {
10 // A map of commands that have had their enabled/disabled state assigned. The
11 // value of each key will be true if enabled, and false if disabled.
12 this.supportedCommands = {};
16 return this.browsingContext.top.embedderElement;
19 // Update the set of enabled and disabled commands.
20 enableDisableCommands(aAction, aEnabledCommands, aDisabledCommands) {
21 // Clear the list first
22 this.supportedCommands = {};
24 for (let command of aEnabledCommands) {
25 this.supportedCommands[command] = true;
28 for (let command of aDisabledCommands) {
29 this.supportedCommands[command] = false;
32 let browser = this.browser;
34 browser.ownerGlobal.updateCommands(aAction);
38 isCommandEnabled(aCommand) {
39 return this.supportedCommands[aCommand] || false;
42 supportsCommand(aCommand) {
43 return aCommand in this.supportedCommands;
47 this.sendAsyncMessage("ControllerCommands:Do", aCommand);
50 getCommandStateWithParams(aCommand, aCommandParams) {
51 throw Components.Exception("Not implemented", Cr.NS_ERROR_NOT_IMPLEMENTED);
54 doCommandWithParams(aCommand, aCommandParams) {
59 if (aCommand == "cmd_lookUpDictionary") {
63 value: aCommandParams.getLongValue("x"),
67 value: aCommandParams.getLongValue("y"),
71 throw Components.Exception(
73 Cr.NS_ERROR_NOT_IMPLEMENTED
76 this.sendAsyncMessage("ControllerCommands:DoWithParams", cmd);
79 getSupportedCommands() {
80 throw Components.Exception("Not implemented", Cr.NS_ERROR_NOT_IMPLEMENTED);
86 ControllersParent.prototype.QueryInterface = ChromeUtils.generateQI([
87 "nsIBrowserController",
89 "nsICommandController",