Bug 736312 - navigator.mozApps support on b2g [r=vingtetun]

This commit is contained in:
Fabrice Desré 2012-03-16 15:23:28 -07:00
Родитель ed3de8e8fc
Коммит 1b2195ed7a
2 изменённых файлов: 23 добавлений и 1 удалений

Просмотреть файл

@ -17,6 +17,7 @@ const LocalFile = CC('@mozilla.org/file/local;1',
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Cu.import('resource://gre/modules/Services.jsm');
Cu.import('resource://gre/modules/ContactService.jsm');
Cu.import('resource://gre/modules/Webapps.jsm');
XPCOMUtils.defineLazyGetter(Services, 'env', function() {
return Cc['@mozilla.org/process/environment;1']
@ -167,6 +168,8 @@ var shell = {
CustomEventManager.init();
WebappsHelper.init();
let browser = this.contentBrowser;
browser.homePage = homeURL;
browser.goHome();
@ -473,3 +476,20 @@ AlertsHelper = {
title: title, text: text } );
}
}
WebappsHelper = {
init: function webapps_init() {
Services.obs.addObserver(this, "webapps-launch", false);
},
observe: function webapps_observe(subject, topic, data) {
let json = JSON.parse(data);
DOMApplicationRegistry.getManifestFor(json.origin, function(aManifest) {
if (!aManifest)
return;
let manifest = new DOMApplicationManifest(aManifest, json.origin);
shell.sendEvent(content, "mozChromeEvent", { type: "webapps-launch", url: manifest.fullLaunchPath(), origin: json.origin });
});
}
}

Просмотреть файл

@ -144,6 +144,7 @@
@BINPATH@/components/directory.xpt
@BINPATH@/components/docshell.xpt
@BINPATH@/components/dom.xpt
@BINPATH@/components/dom_apps.xpt
@BINPATH@/components/dom_base.xpt
#ifdef MOZ_B2G_RIL
@BINPATH@/components/dom_telephony.xpt
@ -290,7 +291,6 @@
@BINPATH@/components/xuldoc.xpt
@BINPATH@/components/xultmpl.xpt
@BINPATH@/components/zipwriter.xpt
@BINPATH@/components/webapps.xpt
; JavaScript components
@BINPATH@/components/ConsoleAPI.manifest
@ -430,6 +430,8 @@
#endif
@BINPATH@/components/TelemetryPing.js
@BINPATH@/components/TelemetryPing.manifest
@BINPATH@/components/Webapps.js
@BINPATH@/components/Webapps.manifest
; Modules
@BINPATH@/modules/*