Merge pull request #367 from saneyuki/props

Remove some properties which returns Services.foo from TreeStyleTabUtils
This commit is contained in:
YUKI "Piro" Hiroshi 2012-09-24 01:10:41 -07:00
commit efa6a309f3
3 changed files with 22 additions and 45 deletions

View File

@ -1,3 +1,5 @@
Components.utils.import('resource://gre/modules/Services.jsm');
TreeStyleTabWindowHelper.extraProperties = [ TreeStyleTabWindowHelper.extraProperties = [
TreeStyleTabService.kID, TreeStyleTabService.kID,
TreeStyleTabService.kCOLLAPSED, TreeStyleTabService.kCOLLAPSED,
@ -1051,12 +1053,12 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
sv.getPref('extensions.stm.newTabPosition') != 0 sv.getPref('extensions.stm.newTabPosition') != 0
) { ) {
let checked = { value : false }; let checked = { value : false };
if (sv.PromptService.confirmEx( if (Services.prompt.confirmEx(
null, null,
sv.treeBundle.getString('compatibility_STM_warning_title'), sv.treeBundle.getString('compatibility_STM_warning_title'),
sv.treeBundle.getString('compatibility_STM_warning_text'), sv.treeBundle.getString('compatibility_STM_warning_text'),
(sv.PromptService.BUTTON_TITLE_IS_STRING * sv.PromptService.BUTTON_POS_0) + (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0) +
(sv.PromptService.BUTTON_TITLE_IS_STRING * sv.PromptService.BUTTON_POS_1), (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_1),
sv.treeBundle.getString('compatibility_STM_warning_use_TST'), sv.treeBundle.getString('compatibility_STM_warning_use_TST'),
sv.treeBundle.getString('compatibility_STM_warning_use_STM'), sv.treeBundle.getString('compatibility_STM_warning_use_STM'),
null, null,

View File

@ -277,23 +277,6 @@ var TreeStyleTabUtils = {
}, },
_SessionStore : null, _SessionStore : null,
get WindowMediator() {
if (!this._WindowMediator) {
this._WindowMediator = Services.wm;
}
return this._WindowMediator;
},
_WindowMediator : null,
get PromptService()
{
if (!this._PromptService) {
this._PromptService = Services.prompt;
}
return this._PromptService;
},
_PromptService : null,
get FocusManager() get FocusManager()
{ {
if (!this._FocusManager) { if (!this._FocusManager) {
@ -303,17 +286,9 @@ var TreeStyleTabUtils = {
}, },
_FocusManager : null, _FocusManager : null,
get Comparator() {
if (!this._Comparator) {
this._Comparator = Services.vc;
}
return this._Comparator;
},
_Comparator : null,
get isGecko10OrLater() get isGecko10OrLater()
{ {
return this.Comparator.compare(Services.appinfo.version, '10.0a') > 0; return Services.vc.compare(Services.appinfo.version, '10.0a') > 0;
}, },
get treeBundle() { get treeBundle() {
@ -643,18 +618,18 @@ var TreeStyleTabUtils = {
}, },
get topBrowserWindow() get topBrowserWindow()
{ {
return this.WindowMediator.getMostRecentWindow('navigator:browser'); return Services.wm.getMostRecentWindow('navigator:browser');
}, },
get browserWindows() get browserWindows()
{ {
var windows = []; var windows = [];
var targets = this.WindowMediator.getZOrderDOMWindowEnumerator('navigator:browser', true); var targets = Services.wm.getZOrderDOMWindowEnumerator('navigator:browser', true);
// By the bug 156333, we cannot find windows by their Z order on Linux. // By the bug 156333, we cannot find windows by their Z order on Linux.
// https://bugzilla.mozilla.org/show_bug.cgi?id=156333 // https://bugzilla.mozilla.org/show_bug.cgi?id=156333
if (!targets.hasMoreElements()) if (!targets.hasMoreElements())
targets = this.WindowMediator.getEnumerator('navigator:browser'); targets = Services.wm.getEnumerator('navigator:browser');
while (targets.hasMoreElements()) while (targets.hasMoreElements())
{ {
@ -694,11 +669,11 @@ var TreeStyleTabUtils = {
if (behavior & this.kDROPLINK_FIXED) return behavior; if (behavior & this.kDROPLINK_FIXED) return behavior;
var checked = { value : false }; var checked = { value : false };
var newChildTab = this.PromptService.confirmEx(this.browserWindow, var newChildTab = Services.prompt.confirmEx(this.browserWindow,
this.treeBundle.getString('dropLinkOnTab.title'), this.treeBundle.getString('dropLinkOnTab.title'),
this.treeBundle.getString('dropLinkOnTab.text'), this.treeBundle.getString('dropLinkOnTab.text'),
(this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_0) + (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0) +
(this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_1), (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_1),
this.treeBundle.getString('dropLinkOnTab.openNewChildTab'), this.treeBundle.getString('dropLinkOnTab.openNewChildTab'),
this.treeBundle.getString('dropLinkOnTab.loadInTheTab'), this.treeBundle.getString('dropLinkOnTab.loadInTheTab'),
null, null,
@ -725,12 +700,12 @@ var TreeStyleTabUtils = {
var dummyTabFlag = behavior & this.kGROUP_BOOKMARK_USE_DUMMY; var dummyTabFlag = behavior & this.kGROUP_BOOKMARK_USE_DUMMY;
var checked = { value : false }; var checked = { value : false };
var button = this.PromptService.confirmEx(this.browserWindow, var button = Services.prompt.confirmEx(this.browserWindow,
this.treeBundle.getString('openGroupBookmarkBehavior.title'), this.treeBundle.getString('openGroupBookmarkBehavior.title'),
this.treeBundle.getString('openGroupBookmarkBehavior.text'), this.treeBundle.getString('openGroupBookmarkBehavior.text'),
(this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_0) + (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0) +
(this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_1) + (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_1) +
(this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_2), (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_2),
this.treeBundle.getString('openGroupBookmarkBehavior.subTree'), this.treeBundle.getString('openGroupBookmarkBehavior.subTree'),
this.treeBundle.getString('openGroupBookmarkBehavior.separate'), this.treeBundle.getString('openGroupBookmarkBehavior.separate'),
this.treeBundle.getString('openGroupBookmarkBehavior.replace'), this.treeBundle.getString('openGroupBookmarkBehavior.replace'),
@ -768,11 +743,11 @@ var TreeStyleTabUtils = {
if (behavior & this.kBOOKMARK_DROPPED_TABS_FIXED) return behavior; if (behavior & this.kBOOKMARK_DROPPED_TABS_FIXED) return behavior;
var checked = { value : false }; var checked = { value : false };
var button = this.PromptService.confirmEx(this.browserWindow, var button = Services.prompt.confirmEx(this.browserWindow,
this.treeBundle.getString('bookmarkDroppedTabs.title'), this.treeBundle.getString('bookmarkDroppedTabs.title'),
this.treeBundle.getString('bookmarkDroppedTabs.text'), this.treeBundle.getString('bookmarkDroppedTabs.text'),
(this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_0) + (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0) +
(this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_1), (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_1),
this.treeBundle.getString('bookmarkDroppedTabs.bookmarkAll'), this.treeBundle.getString('bookmarkDroppedTabs.bookmarkAll'),
this.treeBundle.getString('bookmarkDroppedTabs.bookmarkOnlyParent'), this.treeBundle.getString('bookmarkDroppedTabs.bookmarkOnlyParent'),
null, null,

View File

@ -1388,11 +1388,11 @@ TreeStyleTabWindow.prototype = {
var checked = { value:true }; var checked = { value:true };
var w = this.window; var w = this.window;
w.focus(); w.focus();
var shouldClose = this.PromptService.confirmEx(w, var shouldClose = Services.prompt.confirmEx(w,
this.tabbrowserBundle.getString('tabs.closeWarningTitle'), this.tabbrowserBundle.getString('tabs.closeWarningTitle'),
this.tabbrowserBundle.getFormattedString('tabs.closeWarningMultipleTabs', [aTabsCount]), this.tabbrowserBundle.getFormattedString('tabs.closeWarningMultipleTabs', [aTabsCount]),
(this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_0) + (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0) +
(this.PromptService.BUTTON_TITLE_CANCEL * this.PromptService.BUTTON_POS_1), (Services.prompt.BUTTON_TITLE_CANCEL * Services.prompt.BUTTON_POS_1),
this.tabbrowserBundle.getString('tabs.closeButtonMultiple'), this.tabbrowserBundle.getString('tabs.closeButtonMultiple'),
null, null, null, null,
this.tabbrowserBundle.getString('tabs.closeWarningPromptMe'), this.tabbrowserBundle.getString('tabs.closeWarningPromptMe'),