android-components / mozilla.components.browser.search / SearchEngineManager

SearchEngineManager

class SearchEngineManager (source)

This class provides access to a centralized registry of search engines.

Constructors

Name Summary
<init> SearchEngineManager(providers: List<SearchEngineProvider`> = listOf(
AssetsSearchEngineProvider(LocaleSearchLocalizationProvider())), coroutineContext: [CoroutineContext](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.coroutines/-coroutine-context/index.html) = Dispatchers.IO)`
This class provides access to a centralized registry of search engines.
 

Properties

Name Summary
defaultSearchEngine var defaultSearchEngine: SearchEngine?
This is set by browsers to indicate the users preference of which search engine to use. This overrides the default which may be set by the SearchEngineProvider (e.g. via list.json)

Functions

Name Summary
getDefaultSearchEngine fun getDefaultSearchEngine(context: <ERROR CLASS>, name: String = EMPTY): SearchEngine
Returns the default search engine.
getDefaultSearchEngineAsync suspend fun getDefaultSearchEngineAsync(context: <ERROR CLASS>, name: String = EMPTY): SearchEngine
Returns the default search engine.
getProvidedDefaultSearchEngine fun getProvidedDefaultSearchEngine(context: <ERROR CLASS>): SearchEngine
Returns the provided default search engine or the first search engine if the default is not set.
getProvidedDefaultSearchEngineAsync suspend fun getProvidedDefaultSearchEngineAsync(context: <ERROR CLASS>): SearchEngine
Returns the provided default search engine or the first search engine if the default is not set.
getSearchEngines fun getSearchEngines(context: <ERROR CLASS>): List<SearchEngine>
Returns all search engines.
getSearchEnginesAsync suspend fun getSearchEnginesAsync(context: <ERROR CLASS>): List<SearchEngine>
Returns all search engines.
load suspend fun ~~load~~(context: <ERROR CLASS>): Deferred<SearchEngineList>
Asynchronously load search engines from providers. Inherits caller’s CoroutineContext.
loadAsync suspend fun loadAsync(context: <ERROR CLASS>): Deferred<SearchEngineList>
Asynchronously load search engines from providers. Inherits caller’s CoroutineContext.
registerForLocaleUpdates fun registerForLocaleUpdates(context: <ERROR CLASS>): Unit
Registers for ACTION_LOCALE_CHANGED broadcasts and automatically reloads the search engines whenever the locale changes.

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.