2019-07-13 01:32:00 +02:00
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
package org.mozilla.fenix.search
|
|
|
|
|
|
|
|
import mozilla.components.browser.search.SearchEngine
|
2019-07-26 16:49:25 +02:00
|
|
|
import mozilla.components.browser.session.Session
|
2019-07-13 01:32:00 +02:00
|
|
|
import org.mozilla.fenix.search.awesomebar.AwesomeBarInteractor
|
|
|
|
import org.mozilla.fenix.search.toolbar.ToolbarInteractor
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Interactor for the search screen
|
|
|
|
* Provides implementations for the AwesomeBarView and ToolbarView
|
|
|
|
*/
|
|
|
|
class SearchInteractor(
|
2019-08-20 18:07:00 +02:00
|
|
|
private val searchController: SearchController
|
2019-07-13 01:32:00 +02:00
|
|
|
) : AwesomeBarInteractor, ToolbarInteractor {
|
2019-07-26 16:49:25 +02:00
|
|
|
|
2019-07-13 01:32:00 +02:00
|
|
|
override fun onUrlCommitted(url: String) {
|
2019-08-20 18:07:00 +02:00
|
|
|
searchController.handleUrlCommitted(url)
|
2019-07-13 01:32:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
override fun onEditingCanceled() {
|
2019-08-20 18:07:00 +02:00
|
|
|
searchController.handleEditingCancelled()
|
2019-07-13 01:32:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
override fun onTextChanged(text: String) {
|
2019-08-20 18:07:00 +02:00
|
|
|
searchController.handleTextChanged(text)
|
2019-07-13 01:32:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
override fun onUrlTapped(url: String) {
|
2019-08-20 18:07:00 +02:00
|
|
|
searchController.handleUrlTapped(url)
|
2019-07-13 01:32:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
override fun onSearchTermsTapped(searchTerms: String) {
|
2019-08-20 18:07:00 +02:00
|
|
|
searchController.handleSearchTermsTapped(searchTerms)
|
2019-07-13 01:32:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
override fun onSearchShortcutEngineSelected(searchEngine: SearchEngine) {
|
2019-08-20 18:07:00 +02:00
|
|
|
searchController.handleSearchShortcutEngineSelected(searchEngine)
|
2019-07-13 01:32:00 +02:00
|
|
|
}
|
|
|
|
|
2019-10-18 13:48:58 +02:00
|
|
|
override fun onSearchShortcutsButtonClicked() {
|
|
|
|
searchController.handleSearchShortcutsButtonClicked()
|
|
|
|
}
|
|
|
|
|
2019-07-13 01:32:00 +02:00
|
|
|
override fun onClickSearchEngineSettings() {
|
2019-08-20 18:07:00 +02:00
|
|
|
searchController.handleClickSearchEngineSettings()
|
2019-07-13 01:32:00 +02:00
|
|
|
}
|
|
|
|
|
2019-07-26 16:49:25 +02:00
|
|
|
override fun onExistingSessionSelected(session: Session) {
|
2019-08-20 18:07:00 +02:00
|
|
|
searchController.handleExistingSessionSelected(session)
|
2019-07-13 01:32:00 +02:00
|
|
|
}
|
2020-02-24 11:00:56 +01:00
|
|
|
|
|
|
|
override fun onExistingSessionSelected(tabId: String) {
|
|
|
|
searchController.handleExistingSessionSelected(tabId)
|
|
|
|
}
|
2019-07-13 01:32:00 +02:00
|
|
|
}
|