|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 "use strict"; |
|
6 |
|
7 const Cc = Components.classes; |
|
8 const Ci = Components.interfaces; |
|
9 const Cu = Components.utils; |
|
10 const Cr = Components.results; |
|
11 |
|
12 Cu.import("resource:///modules/tabview/utils.jsm"); |
|
13 Cu.import("resource://gre/modules/Services.jsm"); |
|
14 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |
|
15 |
|
16 XPCOMUtils.defineLazyGetter(this, "tabviewBundle", function() { |
|
17 return Services.strings. |
|
18 createBundle("chrome://browser/locale/tabview.properties"); |
|
19 }); |
|
20 XPCOMUtils.defineLazyGetter(this, "tabbrowserBundle", function() { |
|
21 return Services.strings. |
|
22 createBundle("chrome://browser/locale/tabbrowser.properties"); |
|
23 }); |
|
24 |
|
25 function tabviewString(name) tabviewBundle.GetStringFromName('tabview.' + name); |
|
26 function tabbrowserString(name) tabbrowserBundle.GetStringFromName(name); |
|
27 |
|
28 XPCOMUtils.defineLazyGetter(this, "gPrefBranch", function() { |
|
29 return Services.prefs.getBranch("browser.panorama."); |
|
30 }); |
|
31 |
|
32 XPCOMUtils.defineLazyModuleGetter(this, "gPageThumbnails", |
|
33 "resource://gre/modules/PageThumbs.jsm", "PageThumbs"); |
|
34 |
|
35 var gWindow = window.parent; |
|
36 var gBrowser = gWindow.gBrowser; |
|
37 var gTabView = gWindow.TabView; |
|
38 var gTabViewDeck = gWindow.document.getElementById("tab-view-deck"); |
|
39 var gBrowserPanel = gWindow.document.getElementById("browser-panel"); |
|
40 var gTabViewFrame = gWindow.document.getElementById("tab-view"); |
|
41 |
|
42 let AllTabs = { |
|
43 _events: { |
|
44 attrModified: "TabAttrModified", |
|
45 close: "TabClose", |
|
46 move: "TabMove", |
|
47 open: "TabOpen", |
|
48 select: "TabSelect", |
|
49 pinned: "TabPinned", |
|
50 unpinned: "TabUnpinned" |
|
51 }, |
|
52 |
|
53 get tabs() { |
|
54 return Array.filter(gBrowser.tabs, function (tab) Utils.isValidXULTab(tab)); |
|
55 }, |
|
56 |
|
57 register: function AllTabs_register(eventName, callback) { |
|
58 gBrowser.tabContainer.addEventListener(this._events[eventName], callback, false); |
|
59 }, |
|
60 |
|
61 unregister: function AllTabs_unregister(eventName, callback) { |
|
62 gBrowser.tabContainer.removeEventListener(this._events[eventName], callback, false); |
|
63 } |
|
64 }; |
|
65 |
|
66 # NB: Certain files need to evaluate before others |
|
67 |
|
68 #include iq.js |
|
69 #include storage.js |
|
70 #include items.js |
|
71 #include groupitems.js |
|
72 #include tabitems.js |
|
73 #include favicons.js |
|
74 #include drag.js |
|
75 #include trench.js |
|
76 #include search.js |
|
77 #include telemetry.js |
|
78 #include ui.js |