зеркало из https://github.com/mozilla/gecko-dev.git
Bug 779935 - nsIAppsService.idl need to get mozIDOMApplication from manifest id [r=mounir]
This commit is contained in:
Родитель
4fd04c68e0
Коммит
94b7f94a3c
|
@ -53,6 +53,26 @@ AppsService.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
getAppByLocalId: function getAppByLocalId(aLocalId) {
|
||||
debug("getAppByLocalId( " + aLocalId + " )");
|
||||
if (this.inParent) {
|
||||
return DOMApplicationRegistry.getAppByLocalId(aLocalId);
|
||||
} else {
|
||||
return this.cpmm.sendSyncMessage("WebApps:GetAppByLocalId",
|
||||
{ id: aLocalId })[0];
|
||||
}
|
||||
},
|
||||
|
||||
getManifestURLByLocalId: function getManifestURLByLocalId(aLocalId) {
|
||||
debug("getManifestURLByLocalId( " + aLocalId + " )");
|
||||
if (this.inParent) {
|
||||
return DOMApplicationRegistry.getManifestURLByLocalId(aLocalId);
|
||||
} else {
|
||||
return this.cpmm.sendSyncMessage("WebApps:GetManifestURLByLocalId",
|
||||
{ id: aLocalId })[0];
|
||||
}
|
||||
},
|
||||
|
||||
classID : APPS_SERVICE_CID,
|
||||
QueryInterface : XPCOMUtils.generateQI([Ci.nsIAppsService])
|
||||
}
|
||||
|
|
|
@ -57,7 +57,8 @@ let DOMApplicationRegistry = {
|
|||
"Webapps:GetInstalled", "Webapps:GetNotInstalled",
|
||||
"Webapps:Launch", "Webapps:GetAll",
|
||||
"Webapps:InstallPackage", "Webapps:GetBasePath",
|
||||
"WebApps:GetAppByManifestURL", "WebApps:GetAppLocalIdByManifestURL"];
|
||||
"WebApps:GetAppByManifestURL", "WebApps:GetAppLocalIdByManifestURL",
|
||||
"WebApps:GetAppByLocalId", "Webapps:GetManifestURLByLocalId"];
|
||||
|
||||
this.messages.forEach((function(msgName) {
|
||||
ppmm.addMessageListener(msgName, this);
|
||||
|
@ -249,6 +250,12 @@ let DOMApplicationRegistry = {
|
|||
case "WebApps:GetAppLocalIdByManifestURL":
|
||||
return { id: this.getAppLocalIdByManifestURL(msg.url) };
|
||||
break;
|
||||
case "WebApps:GetAppByLocalId":
|
||||
return this.getAppByLocalId(msg.id);
|
||||
break;
|
||||
case "WebApps:GetManifestURLByLocalId":
|
||||
return this.getManifestURLByLocalId(msg.id);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -698,6 +705,28 @@ let DOMApplicationRegistry = {
|
|||
return null;
|
||||
},
|
||||
|
||||
getAppByLocalId: function(aLocalId) {
|
||||
for (let id in this.webapps) {
|
||||
let app = this.webapps[id];
|
||||
if (app.localId == aLocalId) {
|
||||
return this._cloneAppObject(app);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
getManifestURLByLocalId: function(aLocalId) {
|
||||
for (let id in this.webapps) {
|
||||
let app = this.webapps[id];
|
||||
if (app.localId == aLocalId) {
|
||||
return app.manifestURL;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
getAppLocalIdByManifestURL: function(aManifestURL) {
|
||||
for (let id in this.webapps) {
|
||||
if (this.webapps[id].manifestURL == aManifestURL) {
|
||||
|
|
|
@ -15,7 +15,7 @@ interface mozIDOMApplication;
|
|||
* This service allows accessing some DOMApplicationRegistry methods from
|
||||
* non-javascript code.
|
||||
*/
|
||||
[scriptable, uuid(1210a0f3-add3-4381-b892-9c102e3afc42)]
|
||||
[scriptable, uuid(04e4ef3c-1a30-45bc-ab08-291820f13872)]
|
||||
interface nsIAppsService : nsISupports
|
||||
{
|
||||
mozIDOMApplication getAppByManifestURL(in DOMString manifestURL);
|
||||
|
@ -27,4 +27,14 @@ interface nsIAppsService : nsISupports
|
|||
* installed manifest URL.
|
||||
*/
|
||||
unsigned long getAppLocalIdByManifestURL(in DOMString manifestURL);
|
||||
|
||||
/**
|
||||
* Returns the application associated to this localId.
|
||||
*/
|
||||
mozIDOMApplication getAppByLocalId(in unsigned long localId);
|
||||
|
||||
/**
|
||||
* Returns the manifest URL associated to this localId.
|
||||
*/
|
||||
DOMString getManifestURLByLocalId(in unsigned long localId);
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче