Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | #filter substitution |
michael@0 | 2 | <?xml version="1.0"?> |
michael@0 | 3 | |
michael@0 | 4 | # -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 5 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 6 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 7 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 8 | |
michael@0 | 9 | <?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?> |
michael@0 | 10 | <?xml-stylesheet href="chrome://browser/skin/" type="text/css"?> |
michael@0 | 11 | <?xul-overlay href="chrome://browser/content/baseMenuOverlay.xul"?> |
michael@0 | 12 | <?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?> |
michael@0 | 13 | <?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?> |
michael@0 | 14 | |
michael@0 | 15 | #include browser-doctype.inc |
michael@0 | 16 | |
michael@0 | 17 | <window id="chat-window" |
michael@0 | 18 | windowtype="Social:Chat" |
michael@0 | 19 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
michael@0 | 20 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 21 | title="&mainWindow.title;" |
michael@0 | 22 | onload="gChatWindow.onLoad();" |
michael@0 | 23 | onunload="gChatWindow.onUnload();" |
michael@0 | 24 | macanimationtype="document" |
michael@0 | 25 | fullscreenbutton="true" |
michael@0 | 26 | # width and height are also used in socialchat.xml: chatbar dragend handler |
michael@0 | 27 | width="400px" |
michael@0 | 28 | height="420px" |
michael@0 | 29 | persist="screenX screenY width height sizemode"> |
michael@0 | 30 | |
michael@0 | 31 | <script type="application/javascript" src="chrome://global/content/globalOverlay.js"/> |
michael@0 | 32 | <script type="application/javascript" src="chrome://global/content/contentAreaUtils.js"/> |
michael@0 | 33 | <script type="application/javascript" src="chrome://browser/content/nsContextMenu.js"/> |
michael@0 | 34 | |
michael@0 | 35 | #include global-scripts.inc |
michael@0 | 36 | |
michael@0 | 37 | <script type="application/javascript"> |
michael@0 | 38 | |
michael@0 | 39 | var gChatWindow = { |
michael@0 | 40 | // cargo-culted from browser.js for nonBrowserStartup, but we're slightly |
michael@0 | 41 | // different what what we need to leave enabled |
michael@0 | 42 | onLoad: function() { |
michael@0 | 43 | // Disable inappropriate commands / submenus |
michael@0 | 44 | var disabledItems = ['Browser:SavePage', 'Browser:OpenFile', |
michael@0 | 45 | 'Browser:SendLink', 'cmd_pageSetup', 'cmd_print', |
michael@0 | 46 | 'cmd_find', 'cmd_findAgain', 'cmd_findPrevious', |
michael@0 | 47 | 'cmd_fullZoomReduce', 'cmd_fullZoomEnlarge', 'cmd_fullZoomReset', |
michael@0 | 48 | #ifdef XP_MACOSX |
michael@0 | 49 | 'viewToolbarsMenu', 'viewSidebarMenuMenu', |
michael@0 | 50 | 'viewFullZoomMenu', 'pageStyleMenu', 'charsetMenu', |
michael@0 | 51 | #else |
michael@0 | 52 | 'Browser:OpenLocation', 'Tools:Search', |
michael@0 | 53 | #endif |
michael@0 | 54 | 'Tools:Sanitize', 'Tools:DevToolbox', |
michael@0 | 55 | 'key_selectTab1', 'key_selectTab2', 'key_selectTab3', |
michael@0 | 56 | 'key_selectTab4', 'key_selectTab5', 'key_selectTab6', |
michael@0 | 57 | 'key_selectTab7', 'key_selectTab8', 'key_selectLastTab', |
michael@0 | 58 | 'viewHistorySidebar', 'viewBookmarksSidebar', |
michael@0 | 59 | 'Browser:AddBookmarkAs', 'Browser:BookmarkAllTabs', |
michael@0 | 60 | 'Browser:ToggleTabView']; |
michael@0 | 61 | |
michael@0 | 62 | for (let disabledItem of disabledItems) { |
michael@0 | 63 | document.getElementById(disabledItem).setAttribute("disabled", "true"); |
michael@0 | 64 | } |
michael@0 | 65 | |
michael@0 | 66 | window.QueryInterface(Ci.nsIDOMChromeWindow).browserDOMWindow = |
michael@0 | 67 | new chatBrowserAccess(); |
michael@0 | 68 | |
michael@0 | 69 | // initialise the offline listener |
michael@0 | 70 | BrowserOffline.init(); |
michael@0 | 71 | }, |
michael@0 | 72 | |
michael@0 | 73 | onUnload: function() { |
michael@0 | 74 | BrowserOffline.uninit(); |
michael@0 | 75 | } |
michael@0 | 76 | } |
michael@0 | 77 | |
michael@0 | 78 | // define a popupnotifications handler for this window. we don't use |
michael@0 | 79 | // an iconbox here, and only support the browser frame for chat. |
michael@0 | 80 | XPCOMUtils.defineLazyGetter(this, "PopupNotifications", function () { |
michael@0 | 81 | let tmp = {}; |
michael@0 | 82 | Cu.import("resource://gre/modules/PopupNotifications.jsm", tmp); |
michael@0 | 83 | try { |
michael@0 | 84 | return new tmp.PopupNotifications(document.getElementById("chatter").content, |
michael@0 | 85 | document.getElementById("notification-popup"), |
michael@0 | 86 | null); |
michael@0 | 87 | } catch (ex) { |
michael@0 | 88 | console.error(ex); |
michael@0 | 89 | return null; |
michael@0 | 90 | } |
michael@0 | 91 | }); |
michael@0 | 92 | |
michael@0 | 93 | XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow", |
michael@0 | 94 | "resource:///modules/RecentWindow.jsm"); |
michael@0 | 95 | |
michael@0 | 96 | function chatBrowserAccess() { } |
michael@0 | 97 | |
michael@0 | 98 | chatBrowserAccess.prototype = { |
michael@0 | 99 | QueryInterface: XPCOMUtils.generateQI([Ci.nsIBrowserDOMWindow, Ci.nsISupports]), |
michael@0 | 100 | |
michael@0 | 101 | _openURIInNewTab: function(aURI, aWhere) { |
michael@0 | 102 | if (aWhere != Ci.nsIBrowserDOMWindow.OPEN_NEWTAB) |
michael@0 | 103 | return null; |
michael@0 | 104 | |
michael@0 | 105 | let win = RecentWindow.getMostRecentBrowserWindow(); |
michael@0 | 106 | if (!win) { |
michael@0 | 107 | // We couldn't find a suitable window, a new one needs to be opened. |
michael@0 | 108 | return null; |
michael@0 | 109 | } |
michael@0 | 110 | |
michael@0 | 111 | let loadInBackground = |
michael@0 | 112 | Services.prefs.getBoolPref("browser.tabs.loadDivertedInBackground"); |
michael@0 | 113 | let tab = win.gBrowser.loadOneTab(aURI ? aURI.spec : "about:blank", |
michael@0 | 114 | {inBackground: loadInBackground}); |
michael@0 | 115 | let browser = win.gBrowser.getBrowserForTab(tab); |
michael@0 | 116 | win.focus(); |
michael@0 | 117 | |
michael@0 | 118 | return browser; |
michael@0 | 119 | }, |
michael@0 | 120 | |
michael@0 | 121 | openURI: function (aURI, aOpener, aWhere, aContext) { |
michael@0 | 122 | let browser = this._openURIInNewTab(aURI, aWhere); |
michael@0 | 123 | return browser ? browser.contentWindow : null; |
michael@0 | 124 | }, |
michael@0 | 125 | |
michael@0 | 126 | openURIInFrame: function browser_openURIInFrame(aURI, aOpener, aWhere, aContext) { |
michael@0 | 127 | let browser = this._openURIInNewTab(aURI, aWhere); |
michael@0 | 128 | return browser ? browser.QueryInterface(Ci.nsIFrameLoaderOwner) : null; |
michael@0 | 129 | }, |
michael@0 | 130 | |
michael@0 | 131 | isTabContentWindow: function (aWindow) this.contentWindow == aWindow, |
michael@0 | 132 | |
michael@0 | 133 | get contentWindow() document.getElementById("chatter").contentWindow |
michael@0 | 134 | }; |
michael@0 | 135 | |
michael@0 | 136 | </script> |
michael@0 | 137 | |
michael@0 | 138 | #include browser-sets.inc |
michael@0 | 139 | |
michael@0 | 140 | #ifdef XP_MACOSX |
michael@0 | 141 | #include browser-menubar.inc |
michael@0 | 142 | #endif |
michael@0 | 143 | |
michael@0 | 144 | <popupset id="mainPopupSet"> |
michael@0 | 145 | <tooltip id="aHTMLTooltip" page="true"/> |
michael@0 | 146 | <menupopup id="contentAreaContextMenu" pagemenu="start" |
michael@0 | 147 | onpopupshowing="if (event.target != this) |
michael@0 | 148 | return true; |
michael@0 | 149 | gContextMenu = new nsContextMenu(this, event.shiftKey); |
michael@0 | 150 | if (gContextMenu.shouldDisplay) |
michael@0 | 151 | document.popupNode = this.triggerNode; |
michael@0 | 152 | return gContextMenu.shouldDisplay;" |
michael@0 | 153 | onpopuphiding="if (event.target != this) |
michael@0 | 154 | return; |
michael@0 | 155 | gContextMenu.hiding(); |
michael@0 | 156 | gContextMenu = null;"> |
michael@0 | 157 | #include browser-context.inc |
michael@0 | 158 | </menupopup> |
michael@0 | 159 | |
michael@0 | 160 | #include popup-notifications.inc |
michael@0 | 161 | |
michael@0 | 162 | </popupset> |
michael@0 | 163 | |
michael@0 | 164 | <commandset id="editMenuCommands"/> |
michael@0 | 165 | <chatbox id="chatter" flex="1"/> |
michael@0 | 166 | </window> |