Bug 745995. Natively-installed webapps should yse the app's icon for their taskbar and system menu icons. r=bsmedberg a=gavin

This commit is contained in:
Tim Abraldes 2012-04-18 15:17:49 -07:00
Родитель af04879d8b
Коммит 205ad940fc
1 изменённых файлов: 23 добавлений и 2 удалений

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

@ -7,7 +7,9 @@ const Ci = Components.interfaces;
const Cu = Components.utils;
const WEBAPP_REGISTRY_DIR = "WebappRegD";
const NS_APP_CHROME_DIR_LIST = "AChromDL";
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/WebappRT.jsm");
@ -16,7 +18,8 @@ function DirectoryProvider() {}
DirectoryProvider.prototype = {
classID: Components.ID("{e1799fda-4b2f-4457-b671-e0641d95698d}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDirectoryServiceProvider]),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDirectoryServiceProvider,
Ci.nsIDirectoryServiceProvider2]),
getFile: function(prop, persistent) {
if (prop == WEBAPP_REGISTRY_DIR) {
@ -28,7 +31,25 @@ DirectoryProvider.prototype = {
// We return null to show failure instead of throwing an error,
// which works with the way the interface is called (per bug 529077).
return null;
}
},
getFiles: function(prop, persistent) {
if (prop == NS_APP_CHROME_DIR_LIST) {
return {
_done: false,
QueryInterface: XPCOMUtils.generateQI([Ci.nsISimpleEnumerator]),
hasMoreElements: function() {
return !this._done;
},
getNext: function() {
this._done = true;
return FileUtils.getDir("AppRegD", ["chrome"], false);
}
};
}
return null;
},
};
const NSGetFactory = XPCOMUtils.generateNSGetFactory([DirectoryProvider]);