Use Service.jsm in modules/ (exclude modules/lib/).

This commit is contained in:
saneyuki_s 2012-08-13 14:58:40 +09:00
parent 3378f7ae8a
commit 54a5d46758
2 changed files with 11 additions and 9 deletions

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

@ -38,7 +38,8 @@ const EXPORTED_SYMBOLS = ['TreeStyleTabUtils'];
const Cc = Components.classes; 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;
}, },