Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/browser/components/ipprotection/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 1 kB image not shown  

Quelle  IPPOptOutHelper.sys.mjs   Sprache: unbekannt

 
Spracherkennung für: .mjs vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

/* 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/. */

const lazy = {};

ChromeUtils.defineESModuleGetters(lazy, {
  CustomizableUI:
    "moz-src:///browser/components/customizableui/CustomizableUI.sys.mjs",
  IPProtectionService:
    "moz-src:///toolkit/components/ipprotection/IPProtectionService.sys.mjs",
});

const OPTED_OUT_PREF = "browser.ipProtection.optedOut";
const WIDGET_ID = "ipprotection-button";

/**
 * This class monitors the optedOut pref and if it sees an opted-out state, it
 * sets the state on IPProtectionService and removes the toolbar widget.
 */
class IPPOptedOutHelperSingleton {
  init() {
    Services.prefs.addObserver(OPTED_OUT_PREF, this);
  }

  uninit() {
    Services.prefs.removeObserver(OPTED_OUT_PREF, this);
  }

  initOnStartupCompleted() {}

  get optedOut() {
    return Services.prefs.getBoolPref(OPTED_OUT_PREF, false);
  }

  observe(_subject, _topic, _data) {
    lazy.IPProtectionService.updateState();
    if (this.optedOut) {
      lazy.CustomizableUI.removeWidgetFromArea(WIDGET_ID);
    }
  }
}

const IPPOptOutHelper = new IPPOptedOutHelperSingleton();

export { IPPOptOutHelper };

[Dauer der Verarbeitung: 0.24 Sekunden, vorverarbeitet 2026-08-25]