Bug 957881 - Get rid of recommended addons code. r=bnicholson

This commit is contained in:
Margaret Leibovic 2014-01-10 17:18:14 -08:00
parent 14c8882d88
commit ee6b3dbd97
5 changed files with 0 additions and 86 deletions

View File

@ -5,7 +5,6 @@
dist_dest = $(DIST)/$(APP_NAME).app
PREF_JS_EXPORTS = $(srcdir)/mobile.js
DIST_FILES = recommended-addons.json
ifndef LIBXUL_SDK
ifneq (Android,$(OS_TARGET))

View File

@ -1,15 +0,0 @@
{
"addons": [{
"id": "fullscreen@mbrubeck.limpet.net",
"name": "Full Screen",
"version": "3.4",
"iconURL": "https://addons.cdn.mozilla.net/img/uploads/addon_icons/252/252573-32.png?modified=1354183977",
"learnmoreURL": "https://addons.mozilla.org/en-US/android/addon/full-screen-252573/?src=api"
}, {
"id": "cloudviewer@starkravingfinkle.org",
"name": "Cloud Viewer",
"version": "2.1",
"iconURL": "https://addons.cdn.mozilla.net/img/uploads/addon_icons/295/295895-32.png?modified=1353947644",
"learnmoreURL": "https://addons.mozilla.org/en-US/android/addon/cloud-viewer/?src=api"
}]
}

View File

@ -68,8 +68,6 @@ AddonUpdateService.prototype = {
}
});
});
RecommendedSearchResults.search();
}
};
@ -113,71 +111,5 @@ UpdateCheckListener.prototype = {
}
};
// -----------------------------------------------------------------------
// RecommendedSearchResults fetches add-on data and saves it to a cache
// -----------------------------------------------------------------------
var RecommendedSearchResults = {
_getFile: function() {
let dirService = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
let file = dirService.get("ProfD", Ci.nsILocalFile);
file.append("recommended-addons.json");
return file;
},
_writeFile: function (aFile, aData) {
if (!aData)
return;
// Asynchronously copy the data to the file.
let array = new TextEncoder().encode(aData);
OS.File.writeAtomic(aFile.path, array, { tmpPath: aFile.path + ".tmp" }).then(function onSuccess() {
Services.obs.notifyObservers(null, "recommended-addons-cache-updated", "");
});
},
searchSucceeded: function(aAddons, aAddonCount, aTotalResults) {
let self = this;
// Filter addons already installed
AddonManager.getAllAddons(function(aAllAddons) {
let addons = aAddons.filter(function(addon) {
for (let i = 0; i < aAllAddons.length; i++)
if (addon.id == aAllAddons[i].id)
return false;
return true;
});
let json = {
addons: []
};
addons.forEach(function(aAddon) {
json.addons.push({
id: aAddon.id,
name: aAddon.name,
version: aAddon.version,
learnmoreURL: aAddon.learnmoreURL,
iconURL: aAddon.iconURL
})
});
let file = self._getFile();
self._writeFile(file, JSON.stringify(json));
});
},
searchFailed: function searchFailed() { },
search: function() {
const kAddonsMaxDisplay = 2;
if (AddonRepository.isSearching)
AddonRepository.cancelSearch();
AddonRepository.retrieveRecommendedAddons(kAddonsMaxDisplay, RecommendedSearchResults);
}
}
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([AddonUpdateService]);

View File

@ -87,7 +87,6 @@
@BINPATH@/res/drawable
@BINPATH@/res/drawable-hdpi
@BINPATH@/res/layout
@BINPATH@/recommended-addons.json
@BINPATH@/distribution/*
[browser]

View File

@ -337,7 +337,6 @@ DIST_FILES += \
chrome.manifest \
update.locale \
removed-files \
recommended-addons.json \
distribution \
$(NULL)