36 var
Cr = Components.results;
37 var
Ci = Components.interfaces;
38 var
Cc = Components.classes;
64 _boundAttribute:
null,
69 init:
function(aKey, aRoot) {
71 if (this._initialized)
72 throw Cr.NS_ERROR_UNEXPECTED;
79 this._root =
"songbird.";
88 var prefsService =
Cc[
"@mozilla.org/preferences-service;1"]
89 .getService(
Ci.nsIPrefService);
90 this.
_prefBranch = prefsService.getBranch(this._root)
91 .QueryInterface(
Ci.nsIPrefBranch2);
93 throw Cr.NS_ERROR_FAILURE;
95 this._initialized =
true;
100 if (!this._initialized)
101 throw Cr.NS_ERROR_NOT_INITIALIZED;
103 this.
_prefBranch.removeObserver( this._key,
this );
106 this._observing =
false;
107 this._boundObserver =
null;
108 this._boundAttribute =
null;
109 this._boundProperty =
null;
110 this._boundElement =
null;
113 bindObserver:
function(aObserver, aSuppressFirst) {
114 if (!this._initialized)
115 throw Cr.NS_ERROR_NOT_INITIALIZED;
118 if ( this._observing )
121 this.
_prefBranch.addObserver(this._key,
this,
true);
122 this._observing =
true;
125 this._boundObserver = aObserver;
126 this._boundElement =
null;
127 this._boundProperty =
null;
128 this._boundAttribute =
null;
129 this._isBool =
false;
131 this._evalString =
"";
138 bindRemoteObserver:
function(aRemoteObserver, aSuppressFirst) {
139 this.bindObserver(aRemoteObserver, aSuppressFirst);
142 bindProperty:
function(aElement, aProperty, aIsBool, aIsNot, aEvalString) {
143 if (!this._initialized)
144 throw Cr.NS_ERROR_NOT_INITIALIZED;
154 if ( this._observing )
157 this.
_prefBranch.addObserver(this._key,
this,
true);
158 this._observing =
true;
161 this._boundObserver =
null;
162 this._boundElement = aElement;
163 this._boundProperty = aProperty;
164 this._boundAttribute =
null;
165 this._isBool = aIsBool;
166 this._isNot = aIsNot;
167 this._evalString = aEvalString;
173 bindAttribute:
function(aElement,
aAttribute, aIsBool, aIsNot, aEvalString) {
174 if (!this._initialized)
175 throw Cr.NS_ERROR_NOT_INITIALIZED;
185 if ( this._observing )
188 this.
_prefBranch.addObserver(this._key,
this,
true);
189 this._observing =
true;
192 this._boundObserver =
null;
193 this._boundElement = aElement;
194 this._boundProperty =
null;
196 this._isBool = aIsBool;
197 this._isNot = aIsNot;
198 this._evalString = aEvalString;
204 deleteBranch:
function() {
212 if (!this._initialized)
213 throw Cr.NS_ERROR_NOT_INITIALIZED;
215 return this._getValue();
218 set stringValue(aStringValue) {
219 if (!this._initialized)
220 throw Cr.NS_ERROR_NOT_INITIALIZED;
223 if (aStringValue ==
null)
225 this._setValue(aStringValue);
229 if (!this._initialized)
230 throw Cr.NS_ERROR_NOT_INITIALIZED;
232 return (this._makeIntValue(this._getValue()) != 0);
235 set boolValue(aBoolValue) {
236 if (!this._initialized)
237 throw Cr.NS_ERROR_NOT_INITIALIZED;
240 aBoolValue = aBoolValue ?
"1" :
"0";
241 this._setValue(aBoolValue);
245 if (!this._initialized)
246 throw Cr.NS_ERROR_NOT_INITIALIZED;
248 return this._makeIntValue(this._getValue());
251 set intValue(aIntValue) {
252 if (!this._initialized)
253 throw Cr.NS_ERROR_NOT_INITIALIZED;
255 this._setValue(aIntValue +
"");
263 getAsString:
function() {
264 return this.stringValue;
267 setAsString:
function(aStringValue) {
268 this.stringValue = aStringValue;
271 setAsBool:
function(aBoolValue) {
272 this.boolValue = aBoolValue;
275 getAsBool:
function(aBoolValue) {
276 return this.boolValue;
279 getAsInt:
function() {
280 return this.intValue;
283 setAsInt:
function(aIntValue) {
284 this.intValue = aIntValue;
288 _setValue:
function(aValueStr) {
292 var sString =
Cc[
"@mozilla.org/supports-string;1"]
293 .createInstance(
Ci.nsISupportsString);
294 sString.data = aValueStr;
296 Ci.nsISupportsString,
301 _getValue:
function() {
306 var prefValue = this.
_prefBranch.getComplexValue(this._key,
Ci.nsISupportsString);
307 if (prefValue !=
"") {
308 retval = prefValue.data;
319 _makeIntValue:
function(aValueStr) {
321 if (aValueStr && aValueStr.length)
322 retval = parseInt(aValueStr);
331 if (!this._initialized)
332 throw Cr.NS_ERROR_NOT_INITIALIZED;
335 if (
aData != this._key)
340 var
value = this._getValue();
343 if (this._evalString.length)
344 value = eval(this._evalString);
349 if (typeof(value) !=
"boolean") {
352 else if (value ==
"false")
355 value = (this._makeIntValue(value) != 0);
363 if (this._boundObserver) {
367 if (this._boundObserver instanceof
Ci.sbIRemoteObserver) {
369 this._boundObserver.observe( this._key, value );
373 this._boundObserver.observe(
this, this._key, value );
377 dump(
"ERROR! Could not call boundObserver.observe(). Key = " + this._key +
"\n" + err +
"\n");
380 else if (this._boundElement && this._boundProperty) {
382 this._boundElement[this._boundProperty] =
value;
384 else if (this._boundElement && this._boundAttribute) {
395 this._boundElement.setAttribute(this._boundAttribute, valStr);
398 dump(
"ERROR! Could not setAttribute in sbDataRemote.js\n " + err +
"\n");
408 Ci.nsISecurityCheckedComponent,
409 Ci.sbISecurityAggregator,
410 Ci.nsISupportsWeakReference ];
411 count.value = ifaces.length;
432 flags:
Ci.nsIClassInfo.DOM_OBJECT,
435 _securityMixin:
null,
436 _initializedSCC:
false,
438 _publicRProps: [
"classinfo:classDescription",
439 "classinfo:contractID",
441 "classinfo:implementationLanguage",
443 _publicMethods: [
"internal:bindAttribute",
444 "internal:deleteBranch",
445 "internal:bindObserver",
446 "internal:bindProperty",
447 "internal:setAsString",
448 "internal:getAsString",
451 "internal:setAsBool",
452 "internal:getAsBool",
455 _publicInterfaces: [
Ci.nsISupports,
458 Ci.nsISecurityCheckedComponent,
461 _initSCC:
function() {
462 this._securityMixin =
Cc[
"@songbirdnest.com/remoteapi/security-mixin;1"]
463 .createInstance(
Ci.nsISecurityCheckedComponent);
467 .init(
this, this._publicInterfaces, this._publicInterfaces.length,
468 this._publicMethods,
this._publicMethods.length,
469 this._publicRProps,
this._publicRProps.length,
470 this._publicWProps,
this._publicWProps.length,
473 this._initializedSCC =
true;
476 canCreateWrapper:
function(iid) {
477 if (! this._initializedSCC)
479 return this._securityMixin.canCreateWrapper(iid);
481 canCallMethod:
function(iid, methodName) {
482 if (! this._initializedSCC)
484 return this._securityMixin.canCallMethod(iid, methodName);
486 canGetProperty:
function(iid, propertyName) {
487 if (! this._initializedSCC)
489 return this._securityMixin.canGetProperty(iid, propertyName);
491 canSetProperty:
function(iid, propertyName) {
492 if (! this._initializedSCC)
494 return this._securityMixin.canSetProperty(iid, propertyName);
500 !iid.equals(
Ci.nsIClassInfo) &&
501 !iid.equals(
Ci.nsIObserver) &&
502 !iid.equals(
Ci.nsISecurityCheckedComponent) &&
503 !iid.equals(
Ci.sbISecurityAggregator) &&
504 !iid.equals(
Ci.nsISupportsWeakReference) &&
505 !iid.equals(
Ci.nsISupports)) {
506 throw Cr.NS_ERROR_NO_INTERFACE;
527 dump(
"DEBUG_DATAREMOTE: NEW DATAREMOTE\n");
530 __proto__: RealDataRemote.prototype,
531 _activeDataremotes: {},
536 if (this._observing) {
537 this._activeDataremotes[this._key]--;
538 dump(
"DEBUG_DATAREMOTE: UNBIND " + this._key +
". Remaining:\n");
539 for (var
key in this._activeDataremotes) {
540 dump(
"DEBUG_DATAREMOTE:\t" +
key +
"\t\t\t" +
541 this._activeDataremotes[
key] +
"\n");
545 this.__proto__.__proto__.unbind.call(
this);
548 _logBind:
function() {
549 dump(
"DEBUG_DATAREMOTE: BIND " + this._key +
"\n");
550 if (!(this._key in this._activeDataremotes)) {
551 this._activeDataremotes[this._key] = 0;
553 this._activeDataremotes[this._key]++;
556 bindObserver:
function() {
557 this.__proto__.__proto__.bindObserver.apply(
this,
arguments);
561 bindProperty:
function() {
562 this.__proto__.__proto__.bindProperty.apply(
this,
arguments);
566 bindAttribute:
function() {
567 this.__proto__.__proto__.bindAttribute.apply(
this,
arguments);
582 registerSelf:
function(compMgr, fileSpec, location, type) {
583 compMgr = compMgr.QueryInterface(
Ci.nsIComponentRegistrar);
592 unregisterSelf :
function (compMgr, location, type) {
593 compMgr.QueryInterface(
Ci.nsIComponentRegistrar);
599 throw Cr.NS_ERROR_NO_INTERFACE;
601 if (!iid.equals(
Ci.nsIFactory))
602 throw Cr.NS_ERROR_NOT_IMPLEMENTED;
604 return this.mFactory;
610 throw Cr.NS_ERROR_NO_AGGREGATION;
616 canUnload:
function(compMgr) {
621 if ( !iid.equals(
Ci.nsIModule) ||
622 !iid.equals(
Ci.nsISupports) )
623 throw Cr.NS_ERROR_NO_INTERFACE;
SafebrowsingApplicationMod prototype registerSelf
const SONGBIRD_DATAREMOTE_CID
const SONGBIRD_DATAREMOTE_CONTRACTID
sbDeviceFirmwareAutoCheckForUpdate prototype flags
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
const SONGBIRD_DATAREMOTE_IID
sbOSDControlService prototype QueryInterface
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
sbDeviceFirmwareAutoCheckForUpdate prototype getHelperForLanguage
SafebrowsingApplicationMod prototype getClassObject
function NSGetModule(compMgr, fileSpec)
return!aWindow arguments!aWindow arguments[0]
const SONGBIRD_DATAREMOTE_CLASSNAME
sbDeviceFirmwareAutoCheckForUpdate prototype classID
sbDeviceFirmwareAutoCheckForUpdate prototype getInterfaces
classDescription implementationLanguage
_getWindowDimension aAttribute
_updateTextAndScrollDataForFrame aData
sbDeviceFirmwareAutoCheckForUpdate prototype observe