|
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 "use strict"; |
|
5 |
|
6 const { Cu } = require("chrome"); |
|
7 const { CustomizableUI } = Cu.import('resource:///modules/CustomizableUI.jsm', {}); |
|
8 const { receive } = require("../event/utils"); |
|
9 const { InputPort } = require("./system"); |
|
10 const { object} = require("../util/sequence"); |
|
11 const { getOuterId } = require("../window/utils"); |
|
12 |
|
13 const Input = function() {}; |
|
14 Input.prototype = Object.create(InputPort.prototype); |
|
15 |
|
16 Input.prototype.onCustomizeStart = function (window) { |
|
17 receive(this, object([getOuterId(window), true])); |
|
18 } |
|
19 |
|
20 Input.prototype.onCustomizeEnd = function (window) { |
|
21 receive(this, object([getOuterId(window), null])); |
|
22 } |
|
23 |
|
24 Input.prototype.addListener = input => CustomizableUI.addListener(input); |
|
25 |
|
26 Input.prototype.removeListener = input => CustomizableUI.removeListener(input); |
|
27 |
|
28 exports.CustomizationInput = Input; |