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