Commit 89ede259 authored by henry's avatar henry Committed by morgan
Browse files

BB 45211: Settings UI for protections from third party applications.

parent 1bb5906e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -7,6 +7,11 @@
import { SettingGroupManager } from "chrome://browser/content/preferences/config/SettingGroupManager.mjs";
import { Preferences } from "chrome://global/content/preferences/Preferences.mjs";

ChromeUtils.importESModule(
  "chrome://browser/content/preferences/config/protections-from-apps.mjs",
  { global: "current" }
);

const XPCOMUtils = ChromeUtils.importESModule(
  "resource://gre/modules/XPCOMUtils.sys.mjs"
).XPCOMUtils;
+65 −0
Original line number Diff line number Diff line
/* 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 https://mozilla.org/MPL/2.0/. */

import { SettingGroupManager } from "chrome://browser/content/preferences/config/SettingGroupManager.mjs";
import { Preferences } from "chrome://global/content/preferences/Preferences.mjs";

Preferences.addAll([
  { id: "privacy.exposeContentTitleInWindow", type: "bool" },
  { id: "privacy.exposeContentTitleInWindow.pbm", type: "bool" },
]);

Preferences.addSetting({
  id: "exposeContentWindowTitle",
  pref: "privacy.exposeContentTitleInWindow",
});

Preferences.addSetting({
  id: "exposePrivateContentWindowTitle",
  pref: "privacy.exposeContentTitleInWindow.pbm",
});

Preferences.addSetting({
  id: "genericWindowTitles",
  deps: ["exposeContentWindowTitle", "exposePrivateContentWindowTitle"],
  get: (_pref, { exposeContentWindowTitle }) => {
    // NOTE: The behaviour of `privacy.exposeContentTitleInWindow` (all) and
    // `privacy.exposeContentTitleInWindow.pbm` (pbm) is:
    //
    //            || all=true               | all=false       |
    //  ==========++========================+=================|
    //  pbm=true  || All windows include    | All windows use |
    //            || content.               | generic.        |
    //  ----------++------------------------+-----------------|
    //  pbm=false || Private windows use    | All windows use |
    //            || generic. Other windows | generic.        |
    //            || include content.       |                 |
    //  ------------------------------------------------------+
    //
    // For the settings UI, we treat the "all=true, pbm=false" case as
    // "genericWindowTitles" being *unset*.
    return !exposeContentWindowTitle.value;
  },
  set: (
    value,
    { exposeContentWindowTitle, exposePrivateContentWindowTitle }
  ) => {
    exposeContentWindowTitle.value = !value;
    exposePrivateContentWindowTitle.value = !value;
  },
});

SettingGroupManager.registerGroups({
  protectionsFromThirdParty: {
    l10nId: "protections-from-applications-group",
    heaidngLevel: 2,
    // TODO: supportPage: "tor-manual:",
    items: [
      {
        id: "genericWindowTitles",
        l10nId: "generic-window-titles-checkbox",
      },
    ],
  },
});
+1 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ browser.jar:
   content/browser/preferences/widgets/update-state.mjs          (widgets/update-state/update-state.mjs)
   content/browser/preferences/widgets/update-state.css          (widgets/update-state/update-state.css)

   content/browser/preferences/config/protections-from-apps.mjs         (config/protections-from-apps.mjs)
   content/browser/preferences/config/letterboxing.mjs                  (config/letterboxing.mjs)
   content/browser/preferences/letterboxing.css                         (letterboxing.css)
   content/browser/preferences/letterboxing-middle.svg                  (letterboxing-middle.svg)
+1 −0
Original line number Diff line number Diff line
@@ -274,6 +274,7 @@ const CONFIG_PANES = Object.freeze({
      "networkProxy",
      "privacyPanel",
      "browsingProtection",
      "protectionsFromThirdParty",
      "certificates",
    ],
    replaces: "privacy",