Bug 1132925 - Pass messages to the parent process to set reader mode prefs. r=margaret

This commit is contained in:
Abdelrhman Ahmed 2015-02-20 14:00:12 -08:00
parent 7e7e6beb2c
commit 4939d42cba
2 changed files with 26 additions and 3 deletions

View File

@ -28,6 +28,8 @@ let ReaderParent = {
"Reader:Share",
"Reader:SystemUIVisibility",
"Reader:UpdateReaderButton",
"Reader:SetIntPref",
"Reader:SetCharPref",
],
init: function() {
@ -80,6 +82,18 @@ let ReaderParent = {
this.updateReaderButton(browser);
break;
}
case "Reader:SetIntPref": {
if (message.data && message.data.name !== undefined) {
Services.prefs.setIntPref(message.data.name, message.data.value);
}
break;
}
case "Reader:SetCharPref": {
if (message.data && message.data.name !== undefined) {
Services.prefs.setCharPref(message.data.name, message.data.value);
}
break;
}
}
},

View File

@ -301,7 +301,10 @@ AboutReader.prototype = {
this._fontSize = newFontSize;
htmlClasses.add("font-size" + this._fontSize);
Services.prefs.setIntPref("reader.font_size", this._fontSize);
this._mm.sendAsyncMessage("Reader:SetIntPref", {
name: "reader.font_size",
value: this._fontSize
});
},
_handleDeviceLight: function Reader_handleDeviceLight(newLux) {
@ -392,7 +395,10 @@ AboutReader.prototype = {
this._enableAmbientLighting(colorSchemePref === "auto");
this._setColorScheme(colorSchemePref);
Services.prefs.setCharPref("reader.color_scheme", colorSchemePref);
this._mm.sendAsyncMessage("Reader:SetCharPref", {
name: "reader.color_scheme",
value: colorSchemePref
});
},
_setFontType: function Reader_setFontType(newFontType) {
@ -407,7 +413,10 @@ AboutReader.prototype = {
this._fontType = newFontType;
bodyClasses.add(this._fontType);
Services.prefs.setCharPref("reader.font_type", this._fontType);
this._mm.sendAsyncMessage("Reader:SetCharPref", {
name: "reader.font_type",
value: this._fontType
});
},
_getToolbarVisibility: function Reader_getToolbarVisibility() {