android-components / mozilla.components.browser.engine.system.matcher / UrlMatcher

UrlMatcher

class UrlMatcher (source)

Provides functionality to process categorized URL black/white lists and match URLs against these lists.

Constructors

<init>

UrlMatcher(patterns: Array<String>)

Functions

matches

fun matches(resourceURI: String, pageURI: String): Boolean
fun matches(resourceURI: Uri, pageURI: Uri): Boolean

Checks if the given page URI is blacklisted for the given resource URI. Returns true if the site (page URI) is allowed to access the resource URI, otherwise false.

setCategoriesEnabled

fun setCategoriesEnabled(categories: Set<String>): Unit

Enables the provided categories.

Companion Object Properties

ADVERTISING

const val ADVERTISING: String

ANALYTICS

const val ANALYTICS: String

CONTENT

const val CONTENT: String

DEFAULT

const val DEFAULT: String

DISCONNECT

const val DISCONNECT: String

SOCIAL

const val SOCIAL: String

WEBFONTS

const val WEBFONTS: String

Companion Object Functions

createMatcher

fun createMatcher(context: Context, blackListFile: Int, overrides: IntArray?, whiteListFile: Int, enabledCategories: Set<String> = SUPPORTED_CATEGORIES): UrlMatcher
fun createMatcher(black: Reader, overrides: List<Reader>?, white: Reader, enabledCategories: Set<String> = SUPPORTED_CATEGORIES): UrlMatcher

Creates a new matcher instance for the provided URL lists.

isWebFont

fun isWebFont(uri: Uri): Boolean

Checks if the given URI points to a Web font.