49 Components.utils.import(
"resource://app/jsmodules/DOMUtils.jsm");
59 if (typeof(
Cc) ==
"undefined")
60 var
Cc = Components.classes;
61 if (typeof(
Ci) ==
"undefined")
62 var
Ci = Components.interfaces;
63 if (typeof(
Cr) ==
"undefined")
64 var
Cr = Components.results;
65 if (typeof(
Cu) ==
"undefined")
66 var
Cu = Components.utils;
83 this._widget = aWidget;
101 _domEventListenerSet:
null,
116 initialize:
function addOnBundleSvc_initialize() {
121 var addOnsListElem = this._getElement(
"add_ons_list");
123 var func =
function(aEvent) {
return _this._doCommand(aEvent); };
124 this._domEventListenerSet.add(addOnsListElem,
130 this._updateAddOnItemList();
138 finalize:
function addOnBundleSvc_finalize() {
140 if (this._domEventListenerSet) {
141 this._domEventListenerSet.removeAll();
143 this._domEventListenerSet =
null;
147 this._addOnBundle =
null;
148 this._addOnsTable =
null;
161 return this._addOnBundle;
164 set addOnBundle(aBundle) {
166 if (aBundle == this._addOnBundle)
170 this._addOnBundle = aBundle;
173 this._updateAddOnItemList();
187 _doCommand:
function addOnBundleSvc__doCommand(aEvent) {
189 var
target = aEvent.target;
190 var localName = target.localName;
194 case "sb-add-on-bundle-item" :
195 this._doAddOnBundleItemChange(target);
210 _doAddOnBundleItemChange:
211 function addOnBundleSvc__doAddOnBundleItemChange(aElement) {
213 var index = aElement.getAttribute(
"index");
214 var install = aElement.install;
215 this.addOnBundle.setExtensionInstallFlag(index, install);
232 _addAddOn:
function addOnBundleSvc__addAddOn(aIndex) {
234 var addOnID = this.addOnBundle.getExtensionAttribute(aIndex,
"id");
236 addOnID = this.addOnBundle.getExtensionAttribute(aIndex,
"name");
239 if (this._addOnsTable[addOnID])
244 addOnInfo.index = aIndex;
245 addOnInfo.installFlag = this.addOnBundle.getExtensionInstallFlag(aIndex);
246 addOnInfo.addOnID = this.addOnBundle.getExtensionAttribute(aIndex,
"id");
247 addOnInfo.addOnURL = this.addOnBundle.getExtensionAttribute(aIndex,
"url");
248 addOnInfo.description =
249 this.addOnBundle.getExtensionAttribute(aIndex,
"description");
250 addOnInfo.iconURL = this.addOnBundle.getExtensionAttribute(aIndex,
"icon");
251 addOnInfo.name = this.addOnBundle.getExtensionAttribute(aIndex,
"name");
254 addOnInfo.addOnItemElem = this._addAddOnElement(addOnInfo);
257 this._addOnsTable[addOnID] = addOnInfo;
270 _addAddOnElement:
function addOnBundleSvc__addAddOnElement(aAddOnInfo) {
272 var listItemTemplateElem = this._getElement(
"list_item_template");
275 var listItemElem = listItemTemplateElem.cloneNode(
true);
276 listItemElem.hidden =
false;
279 var itemElem = DOMUtils.getElementsByAttribute(listItemElem,
282 itemElem.setAttribute(
"addonid", aAddOnInfo.addOnID);
283 itemElem.setAttribute(
"addonurl", aAddOnInfo.addOnURL);
284 itemElem.setAttribute(
"defaultinstall", aAddOnInfo.installFlag);
285 itemElem.setAttribute(
"description", aAddOnInfo.description);
286 itemElem.setAttribute(
"icon", aAddOnInfo.iconURL);
287 itemElem.setAttribute(
"index", aAddOnInfo.index);
288 itemElem.setAttribute(
"name", aAddOnInfo.name);
291 listItemElem = listItemElem.cloneNode(
true);
294 var itemListElem = this._getElement(
"add_ons_list");
295 itemListElem.appendChild(listItemElem);
299 itemElem = DOMUtils.getElementsByAttribute(listItemElem,
317 _updateAddOnItemList:
function addOnBundleSvc__updateAddOnItemList() {
319 this._addOnsTable = {};
320 var itemListElem = this._getElement(
"add_ons_list");
321 while (itemListElem.firstChild)
322 itemListElem.removeChild(itemListElem.firstChild);
325 if (this.addOnBundle) {
326 var extensionCount = this.addOnBundle.bundleExtensionCount;
327 for (var
i = 0;
i < extensionCount;
i++) {
343 _getElement:
function addOnBundleSvc__getElement(aElementID) {
344 return document.getAnonymousElementByAttribute(this._widget,
function addOnBundleSvc(aWidget)
function DOMEventListenerSet()
DataRemote prototype constructor
_getSelectedPageStyle s i