fune/mobile/android/components/ColorPicker.js
Kris Maglione a259026c9d Bug 1456035: Part 4 - Convert callers of XPCOMUtils.generateQI to ChromeUtils.generateQI. r=mccr8
This also removes any redundant Ci.nsISupports elements in the interface
lists.

This was done using the following script:

acecb401b7/processors/chromeutils-generateQI.jsm

MozReview-Commit-ID: AIx10P8GpZY

--HG--
extra : rebase_source : a29c07530586dc18ba040f19215475ac20fcfb3b
2018-04-22 20:55:06 -07:00

54 lines
1.5 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.defineModuleGetter(this, "Prompt",
"resource://gre/modules/Prompt.jsm");
function ColorPicker() {
}
ColorPicker.prototype = {
_initial: 0,
_domWin: null,
_title: "",
get strings() {
if (!this._strings) {
this._strings = Services.strings.createBundle("chrome://browser/locale/browser.properties");
}
return this._strings;
},
init: function(aParent, aTitle, aInitial) {
this._domWin = aParent;
this._initial = aInitial;
this._title = aTitle;
},
open: function(aCallback) {
new Prompt({
window: this._domWin,
title: this._title,
buttons: [
this.strings.GetStringFromName("inputWidgetHelper.set"),
this.strings.GetStringFromName("inputWidgetHelper.cancel"),
],
})
.addColorPicker({ value: this._initial })
.show((data) => {
if (data.button == 0)
aCallback.done(data.color0);
else
aCallback.done(this._initial);
});
},
classID: Components.ID("{430b987f-bb9f-46a3-99a5-241749220b29}"),
QueryInterface: ChromeUtils.generateQI([Ci.nsIColorPicker])
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ColorPicker]);