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

#include "nsISupports.idl"

webidl BrowsingContext;

[scriptable, builtinclass, uuid(63a0e445-e1ff-41ef-9f8c-0af5b30f894c)]
interface nsIScopedPrefs : nsISupports {
    cenum Pref: 8 {
        // Represent the tracking protection control prefs. It's comparable to the
        // privacy.trackingprotection.enabled pref and privacy.trackingprotection.pbmode.enabled
        // depending on whether we are in private mode.
        PRIVACY_TRACKINGPROTECTION_ENABLED = 0,
        // `privacy.trackingprotection.cryptomining.enabled` pref
        PRIVACY_TRACKINGPROTECTION_CRYPTOMINING_ENABLED = 1,
        // `privacy.trackingprotection.fingerprinting.enabled` pref
        PRIVACY_TRACKINGPROTECTION_FINGERPRINTING_ENABLED = 2,
        // `privacy.trackingprotection.socialtracking.enabled` pref
        PRIVACY_TRACKINGPROTECTION_SOCIALTRACKING_ENABLED = 3,
        // Comparable to privacy.trackingprotection.emailtracking.enabled and
        // privacy.trackingprotection.emailtracking.pbmode.enabled.
        PRIVACY_TRACKINGPROTECTION_EMAILTRACKING_ENABLED = 4,
        // Content-classifier variants of the tracking protection control prefs
        // above. They let the ContentClassifier blocking decision be gated
        // independently from the URLClassifier. Each falls back to whether the
        // corresponding feature is enabled in the content protection engines
        // pref (`privacy.trackingprotection.content.protection.engines`), gated
        // by `privacy.trackingprotection.content.protection.enabled`.
        PRIVACY_TRACKINGPROTECTION_CONTENT_ENABLED = 5,
        PRIVACY_TRACKINGPROTECTION_CONTENT_CRYPTOMINING_ENABLED = 6,
        PRIVACY_TRACKINGPROTECTION_CONTENT_FINGERPRINTING_ENABLED = 7,
        PRIVACY_TRACKINGPROTECTION_CONTENT_SOCIALTRACKING_ENABLED = 8,
        PRIVACY_TRACKINGPROTECTION_CONTENT_EMAILTRACKING_ENABLED = 9,
        // Test-only: gates the ContentClassifier `test_block` feature, used by
        // the content-classifier blocking tests.
        PRIVACY_TRACKINGPROTECTION_CONTENT_TEST_ENABLED = 10,
        NUM_SCOPED_BOOL_PREFS = 11,
    };

    void setBoolPrefScoped(in nsIScopedPrefs_Pref pref, in BrowsingContext bc, in boolean value);
    boolean getBoolPrefScoped(in nsIScopedPrefs_Pref pref, in BrowsingContext bc);

    // resets all prefs scoped by the attached browsingContext
    void clearScoped();
    void clearScopedPref(in nsIScopedPrefs_Pref pref);
    void clearScopedByHost(in AUTF8String aHost);
    void clearScopedPrefByHost(in nsIScopedPrefs_Pref pref, in AUTF8String aHost);
};
