Merge pull request #334 from saneyuki/service

Use Service.jsm.
This commit is contained in:
SHIMODA "Piro" Hiroshi 2012-08-12 23:50:01 -07:00
commit d12b24195c
3 changed files with 16 additions and 16 deletions

View File

@ -1,10 +1,8 @@
const XULAppInfo = Components.classes['@mozilla.org/xre/app-info;1'] Components.utils.import('resource://gre/modules/Services.jsm');
.getService(Components.interfaces.nsIXULAppInfo);
const comparator = Components.classes['@mozilla.org/xpcom/version-comparator;1'] const XULAppInfo = Services.appinfo;
.getService(Components.interfaces.nsIVersionComparator); const comparator = Services.vc;
var Prefs = Components var Prefs = Services.prefs;
.classes['@mozilla.org/preferences;1']
.getService(Components.interfaces.nsIPrefBranch);
Components.utils.import('resource://treestyletab-modules/lib/animationManager.js', {}); Components.utils.import('resource://treestyletab-modules/lib/animationManager.js', {});
Components.utils.import('resource://treestyletab-modules/lib/prefs.js', {}); Components.utils.import('resource://treestyletab-modules/lib/prefs.js', {});

View File

@ -40,14 +40,15 @@ const DEBUG = false;
const Cc = Components.classes; const Cc = Components.classes;
const Ci = Components.interfaces; const Ci = Components.interfaces;
Components.utils.import('resource://gre/modules/Services.jsm');
const TAB_DROP_TYPE = 'application/x-moz-tabbrowser-tab'; const TAB_DROP_TYPE = 'application/x-moz-tabbrowser-tab';
const SSS = Cc['@mozilla.org/content/style-sheet-service;1'] const SSS = Cc['@mozilla.org/content/style-sheet-service;1']
.getService(Ci.nsIStyleSheetService); .getService(Ci.nsIStyleSheetService);
const SecMan = Cc['@mozilla.org/scriptsecuritymanager;1'] const SecMan = Cc['@mozilla.org/scriptsecuritymanager;1']
.getService(Ci.nsIScriptSecurityManager); .getService(Ci.nsIScriptSecurityManager);
const IOService = Cc['@mozilla.org/network/io-service;1'] const IOService = Services.io;
.getService(Ci.nsIIOService);
function TabbarDNDObserver(aTabBrowser) function TabbarDNDObserver(aTabBrowser)
{ {

View File

@ -39,6 +39,7 @@ const Cc = Components.classes;
const Ci = Components.interfaces; const Ci = Components.interfaces;
Components.utils.import('resource://gre/modules/XPCOMUtils.jsm'); Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');
Components.utils.import('resource://gre/modules/Services.jsm');
Components.utils.import('resource://treestyletab-modules/lib/prefs.js'); Components.utils.import('resource://treestyletab-modules/lib/prefs.js');
Components.utils.import('resource://treestyletab-modules/lib/namespace.jsm'); Components.utils.import('resource://treestyletab-modules/lib/namespace.jsm');
@ -276,7 +277,7 @@ var TreeStyleTabUtils = {
get ObserverService() { get ObserverService() {
if (!this._ObserverService) { if (!this._ObserverService) {
this._ObserverService = Cc['@mozilla.org/observer-service;1'].getService(Ci.nsIObserverService); this._ObserverService = Services.obs;
} }
return this._ObserverService; return this._ObserverService;
}, },
@ -284,7 +285,7 @@ var TreeStyleTabUtils = {
get IOService() { get IOService() {
if (!this._IOService) { if (!this._IOService) {
this._IOService = Cc['@mozilla.org/network/io-service;1'].getService(Ci.nsIIOService); this._IOService = Services.io;
} }
return this._IOService; return this._IOService;
}, },
@ -292,7 +293,7 @@ var TreeStyleTabUtils = {
get WindowMediator() { get WindowMediator() {
if (!this._WindowMediator) { if (!this._WindowMediator) {
this._WindowMediator = Cc['@mozilla.org/appshell/window-mediator;1'].getService(Ci.nsIWindowMediator); this._WindowMediator = Services.wm;
} }
return this._WindowMediator; return this._WindowMediator;
}, },
@ -301,7 +302,7 @@ var TreeStyleTabUtils = {
get PromptService() get PromptService()
{ {
if (!this._PromptService) { if (!this._PromptService) {
this._PromptService = Cc['@mozilla.org/embedcomp/prompt-service;1'].getService(Ci.nsIPromptService); this._PromptService = Services.prompt;
} }
return this._PromptService; return this._PromptService;
}, },
@ -318,14 +319,14 @@ var TreeStyleTabUtils = {
get XULAppInfo() { get XULAppInfo() {
if (!this._XULAppInfo) { if (!this._XULAppInfo) {
this._XULAppInfo = Cc['@mozilla.org/xre/app-info;1'].getService(Ci.nsIXULAppInfo).QueryInterface(Ci.nsIXULRuntime); this._XULAppInfo = Services.appinfo;
} }
return this._XULAppInfo; return this._XULAppInfo;
}, },
_XULAppInfo : null, _XULAppInfo : null,
get Comparator() { get Comparator() {
if (!this._Comparator) { if (!this._Comparator) {
this._Comparator = Cc['@mozilla.org/xpcom/version-comparator;1'].getService(Ci.nsIVersionComparator); this._Comparator = Services.vc;
} }
return this._Comparator; return this._Comparator;
}, },