summaryrefslogtreecommitdiffstats
path: root/mobile/android/chrome/content/aboutPrivateBrowsing.js
diff options
context:
space:
mode:
Diffstat (limited to 'mobile/android/chrome/content/aboutPrivateBrowsing.js')
-rw-r--r--mobile/android/chrome/content/aboutPrivateBrowsing.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/mobile/android/chrome/content/aboutPrivateBrowsing.js b/mobile/android/chrome/content/aboutPrivateBrowsing.js
new file mode 100644
index 000000000..782abfb5d
--- /dev/null
+++ b/mobile/android/chrome/content/aboutPrivateBrowsing.js
@@ -0,0 +1,32 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+var Ci = Components.interfaces;
+var Cu = Components.utils;
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
+Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
+
+XPCOMUtils.defineLazyGetter(window, "gChromeWin", () =>
+ window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShellTreeItem)
+ .rootTreeItem
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindow)
+ .QueryInterface(Ci.nsIDOMChromeWindow));
+
+document.addEventListener("DOMContentLoaded", function() {
+ let BrowserApp = gChromeWin.BrowserApp;
+
+ if (!PrivateBrowsingUtils.isContentWindowPrivate(window)) {
+ document.body.setAttribute("class", "normal");
+ document.getElementById("newPrivateTabLink").addEventListener("click", function() {
+ BrowserApp.addTab("about:privatebrowsing", { selected: true, parentId: BrowserApp.selectedTab.id, isPrivate: true });
+ }, false);
+ }
+ }, false);