Files
tubestation/toolkit/components/cookiebanners/nsICookieBannerService.idl

70 lines
2.2 KiB
Plaintext

/* 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"
#include "nsIClickRule.idl"
#include "nsICookieBannerRule.idl"
#include "nsICookieRule.idl"
#include "nsIURI.idl"
/**
* Service singleton which owns the cookie banner feature.
* This service owns the cookie banner handling rules.
* It initializes both the component for importing rules
* (nsICookieBannerListService) and injecting cookies (nsICookieInjector).
*/
[scriptable, uuid(eac9cdc4-ecee-49f2-91da-7627e15c1f3c)]
interface nsICookieBannerService : nsISupports {
/**
* Modes for cookie banner handling
* MODE_DISABLED - No cookie banner handling, service disabled.
* MODE_REJECT - Only handle banners where selecting "reject all" is possible.
* MODE_REJECT_OR_ACCEPT - Prefer selecting "reject all", if not possible
* fall back to "accept all".
*/
cenum Modes : 8 {
MODE_DISABLED,
MODE_REJECT,
MODE_REJECT_OR_ACCEPT,
};
/**
* Getter for a list of all cookie banner rules. This includes both opt-in and opt-out rules.
*/
readonly attribute Array<nsICookieBannerRule> rules;
/**
* Clears all imported rules. They will be imported again on startup and when
* enabling the service. This is currently only used for testing.
*
* doImport - Whether to import initial rule list after reset. Passing false
* will result in an empty rule list.
*/
void resetRules([optional] in boolean doImport);
/**
* Look up all cookie rules for a given URI. Depending on the MODE_ this will
* return none, only reject rules or accept rules if there is no reject rule
* available.
*/
Array<nsICookieRule> getCookiesForURI(in nsIURI aURI, in bool aIsPrivateBrowsing);
/**
* Look up the click rules for a given domain.
*/
Array<nsIClickRule> getClickRulesForDomain(in ACString aDomain);
/**
* Insert a cookie banner rule for a domain. If there was previously a rule
* stored with the same domain it will be overwritten.
*/
void insertRule(in nsICookieBannerRule aRule);
/**
* Remove a cookie banner rule.
*/
void removeRule(in nsICookieBannerRule aRule);
};