56 name:
"browser.content.full-zoom",
61 get globalValue FullZoom_get_globalValue() {
62 var globalValue = this._cps.getPref(
null, this.
name);
63 if (typeof globalValue !=
"undefined")
64 globalValue = this._ensureValid(globalValue);
65 delete this.globalValue;
66 return this.globalValue = globalValue;
74 get _cps FullZoom_get__cps() {
76 return this._cps =
Cc[
"@mozilla.org/content-pref/service;1"].
82 return this.
_prefBranch =
Cc[
"@mozilla.org/preferences-service;1"].
87 _siteSpecificPref: undefined,
90 updateBackgroundTabs: undefined,
93 _inPrivateBrowsing:
false,
95 get siteSpecific FullZoom_get_siteSpecific() {
96 return !this._inPrivateBrowsing && this._siteSpecificPref;
103 interfaces: [Components.interfaces.nsIDOMEventListener,
104 Components.interfaces.nsIObserver,
105 Components.interfaces.nsIContentPrefObserver,
106 Components.interfaces.nsISupportsWeakReference,
107 Components.interfaces.nsISupports],
110 if (!this.
interfaces.some(function (v) aIID.equals(v)))
111 throw Cr.NS_ERROR_NO_INTERFACE;
119 init:
function FullZoom_init() {
121 window.addEventListener(
"DOMMouseScroll",
this,
false);
124 this._cps.addObserver(this.
name,
this);
128 let
os =
Cc[
"@mozilla.org/observer-service;1"].
130 os.addObserver(
this,
"private-browsing",
true);
134 if (
"@mozilla.org/privatebrowsing;1" in
Cc) {
135 this._inPrivateBrowsing = Cc[
"@mozilla.org/privatebrowsing;1"].
137 privateBrowsingEnabled;
140 this._siteSpecificPref =
141 this.
_prefBranch.getBoolPref(
"browser.zoom.siteSpecific");
142 this.updateBackgroundTabs =
143 this.
_prefBranch.getBoolPref(
"browser.zoom.updateBackgroundTabs");
146 this.
_prefBranch.addObserver(
"browser.zoom.",
this,
true);
149 destroy:
function FullZoom_destroy() {
150 let
os =
Cc[
"@mozilla.org/observer-service;1"].
152 os.removeObserver(
this,
"private-browsing");
153 this.
_prefBranch.removeObserver(
"browser.zoom.",
this);
154 this._cps.removeObserver(this.
name,
this);
155 window.removeEventListener(
"DOMMouseScroll",
this,
false);
165 handleEvent:
function FullZoom_handleEvent(
event) {
166 switch (
event.type) {
167 case "DOMMouseScroll":
168 this._handleMouseScrolled(
event);
173 _handleMouseScrolled:
function FullZoom__handleMouseScrolled(
event) {
176 var
pref =
"mousewheel";
178 pref +=
".horizscroll";
181 pref +=
".withshiftkey";
182 else if (
event.ctrlKey)
183 pref +=
".withcontrolkey";
184 else if (
event.altKey)
185 pref +=
".withaltkey";
186 else if (
event.metaKey)
187 pref +=
".withmetakey";
189 pref +=
".withnokey";
194 var isZoomEvent =
false;
208 window.setTimeout(
function (
self) {
self._applySettingToPref() }, 0,
this);
215 case "nsPref:changed":
217 case "browser.zoom.siteSpecific":
218 this._siteSpecificPref =
219 this.
_prefBranch.getBoolPref(
"browser.zoom.siteSpecific");
221 case "browser.zoom.updateBackgroundTabs":
222 this.updateBackgroundTabs =
223 this.
_prefBranch.getBoolPref(
"browser.zoom.updateBackgroundTabs");
227 case "private-browsing":
230 this._inPrivateBrowsing =
true;
233 this._inPrivateBrowsing =
false;
242 onContentPrefSet:
function FullZoom_onContentPrefSet(aGroup,
aName,
aValue) {
243 if (aGroup == this._cps.grouper.group(gBrowser.currentURI))
244 this._applyPrefToSetting(
aValue);
245 else if (aGroup ==
null) {
246 this.globalValue = this._ensureValid(
aValue);
251 if (!this._cps.hasPref(gBrowser.currentURI,
this.name))
252 this._applyPrefToSetting();
256 onContentPrefRemoved:
function FullZoom_onContentPrefRemoved(aGroup,
aName) {
257 if (aGroup == this._cps.grouper.group(gBrowser.currentURI))
258 this._applyPrefToSetting();
259 else if (aGroup ==
null) {
260 this.globalValue = undefined;
265 if (!this._cps.hasPref(gBrowser.currentURI,
this.name))
266 this._applyPrefToSetting();
283 onLocationChange:
function FullZoom_onLocationChange(aURI, aIsTabSwitch,
aBrowser) {
284 if (!aURI || (aIsTabSwitch && !this.siteSpecific))
286 this._applyPrefToSetting(this._cps.getPref(aURI,
this.name),
aBrowser);
291 updateMenu:
function FullZoom_updateMenu() {
292 var
menuItem = document.getElementById(
"toggle_zoom");
294 menuItem.setAttribute(
"checked", !ZoomManager.useFullZoom);
300 reduce:
function FullZoom_reduce() {
301 ZoomManager.reduce();
302 this._applySettingToPref();
305 enlarge:
function FullZoom_enlarge() {
306 ZoomManager.enlarge();
307 this._applySettingToPref();
310 reset:
function FullZoom_reset() {
311 if (typeof this.globalValue !=
"undefined")
312 ZoomManager.zoom = this.globalValue;
338 _applyPrefToSetting:
function FullZoom__applyPrefToSetting(
aValue,
aBrowser) {
339 if (!this.siteSpecific && !this._inPrivateBrowsing)
345 browser.contentDocument instanceof
Ci.nsIImageDocument ||
346 this._inPrivateBrowsing)
347 ZoomManager.setZoomForBrowser(browser, 1);
348 else if (typeof
aValue !=
"undefined")
349 ZoomManager.setZoomForBrowser(browser, this._ensureValid(
aValue));
350 else if (typeof this.globalValue !=
"undefined")
351 ZoomManager.setZoomForBrowser(browser, this.globalValue);
353 ZoomManager.setZoomForBrowser(browser, 1);
358 _applySettingToPref:
function FullZoom__applySettingToPref() {
360 content.document instanceof
Ci.nsIImageDocument)
364 this._cps.setPref(gBrowser.currentURI,
this.name, zoomLevel);
367 _removePref:
function FullZoom__removePref() {
368 if (!(content.document instanceof
Ci.nsIImageDocument))
369 this._cps.removePref(gBrowser.currentURI,
this.name);
376 _ensureValid:
function FullZoom__ensureValid(
aValue) {
380 if (
aValue < ZoomManager.MIN)
381 return ZoomManager.MIN;
383 if (
aValue > ZoomManager.MAX)
384 return ZoomManager.MAX;
sbOSDControlService prototype QueryInterface
getService(Ci.sbIFaceplateManager)
_updateTextAndScrollDataForTab aBrowser
sbDeviceFirmwareAutoCheckForUpdate prototype interfaces
_updateTextAndScrollDataForFrame aData
sbDeviceFirmwareAutoCheckForUpdate prototype observe