browser/components/tabview/tabview.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial