prepare history api

This commit is contained in:
Fabian Freund
2025-09-17 17:53:06 +02:00
parent d24d612635
commit 9676ccae3d
10 changed files with 850 additions and 209 deletions
@@ -27,6 +27,7 @@ import eu.weblibre.flutter_mozilla_components.pigeons.GeckoDeleteBrowsingDataCon
import eu.weblibre.flutter_mozilla_components.pigeons.GeckoDownloadsApi
import eu.weblibre.flutter_mozilla_components.pigeons.GeckoEngineSettingsApi
import eu.weblibre.flutter_mozilla_components.pigeons.GeckoFindApi
import eu.weblibre.flutter_mozilla_components.pigeons.GeckoHistoryApi
import eu.weblibre.flutter_mozilla_components.pigeons.GeckoIconsApi
import eu.weblibre.flutter_mozilla_components.pigeons.GeckoLogging
import eu.weblibre.flutter_mozilla_components.pigeons.GeckoMlApi
@@ -214,6 +215,7 @@ class GeckoBrowserApiImpl : GeckoBrowserApi {
GeckoDeleteBrowsingDataController.setUp(_flutterPluginBinding.binaryMessenger, GeckoDeleteBrowsingDataControllerImpl())
GeckoDownloadsApi.setUp(_flutterPluginBinding.binaryMessenger, GeckoDownloadsApiImpl())
GeckoBrowserExtensionApi.setUp(_flutterPluginBinding.binaryMessenger, GeckoBrowserExtensionApiImpl())
GeckoHistoryApi.setUp(_flutterPluginBinding.binaryMessenger, GeckoHistoryApiImpl())
ReaderViewEvents.setUp(
_flutterPluginBinding.binaryMessenger,
@@ -0,0 +1,72 @@
package eu.weblibre.flutter_mozilla_components.api
import eu.weblibre.flutter_mozilla_components.GlobalComponents
import eu.weblibre.flutter_mozilla_components.pigeons.AutocompleteResult
import eu.weblibre.flutter_mozilla_components.pigeons.GeckoHistoryApi
import eu.weblibre.flutter_mozilla_components.pigeons.VisitInfo
import eu.weblibre.flutter_mozilla_components.pigeons.VisitType
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
class GeckoHistoryApiImpl() : GeckoHistoryApi {
companion object {
private val coroutineScope = CoroutineScope(Dispatchers.Main + SupervisorJob())
}
private val components by lazy {
requireNotNull(GlobalComponents.components) { "Components not initialized" }
}
override fun getDetailedVisits(
startMillis: Long,
endMillis: Long,
excludeTypes: List<VisitType>,
callback: (Result<List<VisitInfo>>) -> Unit
) {
coroutineScope.launch {
withContext(Dispatchers.Main) {
val visits = components.core.historyStorage.getDetailedVisits(
startMillis,
endMillis,
excludeTypes.map {
when (it) {
VisitType.LINK -> mozilla.components.concept.storage.VisitType.LINK
VisitType.TYPED -> mozilla.components.concept.storage.VisitType.TYPED
VisitType.BOOKMARK -> mozilla.components.concept.storage.VisitType.BOOKMARK
VisitType.EMBED -> mozilla.components.concept.storage.VisitType.EMBED
VisitType.REDIRECT_PERMANENT -> mozilla.components.concept.storage.VisitType.REDIRECT_PERMANENT
VisitType.REDIRECT_TEMPORARY -> mozilla.components.concept.storage.VisitType.REDIRECT_TEMPORARY
VisitType.DOWNLOAD -> mozilla.components.concept.storage.VisitType.DOWNLOAD
VisitType.FRAMED_LINK -> mozilla.components.concept.storage.VisitType.FRAMED_LINK
VisitType.RELOAD -> mozilla.components.concept.storage.VisitType.RELOAD
}
})
callback(Result.success(visits.map {
VisitInfo(
url = it.url,
title = it.title,
visitTime = it.visitTime,
visitType = when (it.visitType) {
mozilla.components.concept.storage.VisitType.LINK -> VisitType.LINK
mozilla.components.concept.storage.VisitType.TYPED -> VisitType.TYPED
mozilla.components.concept.storage.VisitType.BOOKMARK -> VisitType.BOOKMARK
mozilla.components.concept.storage.VisitType.EMBED -> VisitType.EMBED
mozilla.components.concept.storage.VisitType.REDIRECT_PERMANENT -> VisitType.REDIRECT_PERMANENT
mozilla.components.concept.storage.VisitType.REDIRECT_TEMPORARY -> VisitType.REDIRECT_TEMPORARY
mozilla.components.concept.storage.VisitType.DOWNLOAD -> VisitType.DOWNLOAD
mozilla.components.concept.storage.VisitType.FRAMED_LINK -> VisitType.FRAMED_LINK
mozilla.components.concept.storage.VisitType.RELOAD -> VisitType.RELOAD
},
previewImageUrl = it.previewImageUrl,
isRemote = it.isRemote
)
}
))
}
}
}
}
@@ -166,6 +166,24 @@ enum class CookieSameSiteStatus(val raw: Int) {
}
}
enum class VisitType(val raw: Int) {
LINK(0),
TYPED(1),
BOOKMARK(2),
EMBED(3),
REDIRECT_PERMANENT(4),
REDIRECT_TEMPORARY(5),
DOWNLOAD(6),
FRAMED_LINK(7),
RELOAD(8);
companion object {
fun ofRaw(raw: Int): VisitType? {
return values().firstOrNull { it.raw == raw }
}
}
}
enum class SelectionPattern(val raw: Int) {
PHONE(0),
EMAIL(1);
@@ -1102,6 +1120,49 @@ data class Cookie (
override fun hashCode(): Int = toList().hashCode()
}
/** Generated class from Pigeon that represents data sent in messages. */
data class VisitInfo (
val url: String,
val title: String? = null,
val visitTime: Long,
val visitType: VisitType,
val previewImageUrl: String? = null,
val isRemote: Boolean
)
{
companion object {
fun fromList(pigeonVar_list: List<Any?>): VisitInfo {
val url = pigeonVar_list[0] as String
val title = pigeonVar_list[1] as String?
val visitTime = pigeonVar_list[2] as Long
val visitType = pigeonVar_list[3] as VisitType
val previewImageUrl = pigeonVar_list[4] as String?
val isRemote = pigeonVar_list[5] as Boolean
return VisitInfo(url, title, visitTime, visitType, previewImageUrl, isRemote)
}
}
fun toList(): List<Any?> {
return listOf(
url,
title,
visitTime,
visitType,
previewImageUrl,
isRemote,
)
}
override fun equals(other: Any?): Boolean {
if (other !is VisitInfo) {
return false
}
if (this === other) {
return true
}
return GeckoPigeonUtils.deepEquals(toList(), other.toList()) }
override fun hashCode(): Int = toList().hashCode()
}
/** Generated class from Pigeon that represents data sent in messages. */
data class HistoryItem (
val url: String,
@@ -2051,260 +2112,270 @@ private open class GeckoPigeonCodec : StandardMessageCodec() {
}
134.toByte() -> {
return (readValue(buffer) as Long?)?.let {
SelectionPattern.ofRaw(it.toInt())
VisitType.ofRaw(it.toInt())
}
}
135.toByte() -> {
return (readValue(buffer) as Long?)?.let {
WebExtensionActionType.ofRaw(it.toInt())
SelectionPattern.ofRaw(it.toInt())
}
}
136.toByte() -> {
return (readValue(buffer) as Long?)?.let {
GeckoSuggestionType.ofRaw(it.toInt())
WebExtensionActionType.ofRaw(it.toInt())
}
}
137.toByte() -> {
return (readValue(buffer) as Long?)?.let {
TrackingProtectionPolicy.ofRaw(it.toInt())
GeckoSuggestionType.ofRaw(it.toInt())
}
}
138.toByte() -> {
return (readValue(buffer) as Long?)?.let {
HttpsOnlyMode.ofRaw(it.toInt())
TrackingProtectionPolicy.ofRaw(it.toInt())
}
}
139.toByte() -> {
return (readValue(buffer) as Long?)?.let {
QueryParameterStripping.ofRaw(it.toInt())
HttpsOnlyMode.ofRaw(it.toInt())
}
}
140.toByte() -> {
return (readValue(buffer) as Long?)?.let {
BounceTrackingProtectionMode.ofRaw(it.toInt())
QueryParameterStripping.ofRaw(it.toInt())
}
}
141.toByte() -> {
return (readValue(buffer) as Long?)?.let {
ColorScheme.ofRaw(it.toInt())
BounceTrackingProtectionMode.ofRaw(it.toInt())
}
}
142.toByte() -> {
return (readValue(buffer) as Long?)?.let {
CookieBannerHandlingMode.ofRaw(it.toInt())
ColorScheme.ofRaw(it.toInt())
}
}
143.toByte() -> {
return (readValue(buffer) as Long?)?.let {
WebContentIsolationStrategy.ofRaw(it.toInt())
CookieBannerHandlingMode.ofRaw(it.toInt())
}
}
144.toByte() -> {
return (readValue(buffer) as Long?)?.let {
DownloadStatus.ofRaw(it.toInt())
WebContentIsolationStrategy.ofRaw(it.toInt())
}
}
145.toByte() -> {
return (readValue(buffer) as Long?)?.let {
LogLevel.ofRaw(it.toInt())
DownloadStatus.ofRaw(it.toInt())
}
}
146.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
TranslationOptions.fromList(it)
return (readValue(buffer) as Long?)?.let {
LogLevel.ofRaw(it.toInt())
}
}
147.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
ReaderState.fromList(it)
TranslationOptions.fromList(it)
}
}
148.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
LastMediaAccessState.fromList(it)
ReaderState.fromList(it)
}
}
149.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
HistoryMetadataKey.fromList(it)
LastMediaAccessState.fromList(it)
}
}
150.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
PackageCategoryValue.fromList(it)
HistoryMetadataKey.fromList(it)
}
}
151.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
ExternalPackage.fromList(it)
PackageCategoryValue.fromList(it)
}
}
152.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
LoadUrlFlagsValue.fromList(it)
ExternalPackage.fromList(it)
}
}
153.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
SourceValue.fromList(it)
LoadUrlFlagsValue.fromList(it)
}
}
154.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
TabState.fromList(it)
SourceValue.fromList(it)
}
}
155.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
RecoverableTab.fromList(it)
TabState.fromList(it)
}
}
156.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
RecoverableBrowserState.fromList(it)
RecoverableTab.fromList(it)
}
}
157.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
IconRequest.fromList(it)
RecoverableBrowserState.fromList(it)
}
}
158.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
ResourceSize.fromList(it)
IconRequest.fromList(it)
}
}
159.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
Resource.fromList(it)
ResourceSize.fromList(it)
}
}
160.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
IconResult.fromList(it)
Resource.fromList(it)
}
}
161.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
CookiePartitionKey.fromList(it)
IconResult.fromList(it)
}
}
162.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
Cookie.fromList(it)
CookiePartitionKey.fromList(it)
}
}
163.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
HistoryItem.fromList(it)
Cookie.fromList(it)
}
}
164.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
HistoryState.fromList(it)
VisitInfo.fromList(it)
}
}
165.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
ReaderableState.fromList(it)
HistoryItem.fromList(it)
}
}
166.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
SecurityInfoState.fromList(it)
HistoryState.fromList(it)
}
}
167.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
TabContentState.fromList(it)
ReaderableState.fromList(it)
}
}
168.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
FindResultState.fromList(it)
SecurityInfoState.fromList(it)
}
}
169.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
CustomSelectionAction.fromList(it)
TabContentState.fromList(it)
}
}
170.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
WebExtensionData.fromList(it)
FindResultState.fromList(it)
}
}
171.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
GeckoSuggestion.fromList(it)
CustomSelectionAction.fromList(it)
}
}
172.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
TabContent.fromList(it)
WebExtensionData.fromList(it)
}
}
173.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
ContentBlocking.fromList(it)
GeckoSuggestion.fromList(it)
}
}
174.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
GeckoEngineSettings.fromList(it)
TabContent.fromList(it)
}
}
175.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
AutocompleteResult.fromList(it)
ContentBlocking.fromList(it)
}
}
176.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
UnknownHitResult.fromList(it)
GeckoEngineSettings.fromList(it)
}
}
177.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
ImageHitResult.fromList(it)
AutocompleteResult.fromList(it)
}
}
178.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
VideoHitResult.fromList(it)
UnknownHitResult.fromList(it)
}
}
179.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
AudioHitResult.fromList(it)
ImageHitResult.fromList(it)
}
}
180.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
ImageSrcHitResult.fromList(it)
VideoHitResult.fromList(it)
}
}
181.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
PhoneHitResult.fromList(it)
AudioHitResult.fromList(it)
}
}
182.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
EmailHitResult.fromList(it)
ImageSrcHitResult.fromList(it)
}
}
183.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
GeoHitResult.fromList(it)
PhoneHitResult.fromList(it)
}
}
184.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
DownloadState.fromList(it)
EmailHitResult.fromList(it)
}
}
185.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
GeoHitResult.fromList(it)
}
}
186.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
DownloadState.fromList(it)
}
}
187.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
ShareInternetResourceState.fromList(it)
}
@@ -2334,214 +2405,222 @@ private open class GeckoPigeonCodec : StandardMessageCodec() {
stream.write(133)
writeValue(stream, value.raw)
}
is SelectionPattern -> {
is VisitType -> {
stream.write(134)
writeValue(stream, value.raw)
}
is WebExtensionActionType -> {
is SelectionPattern -> {
stream.write(135)
writeValue(stream, value.raw)
}
is GeckoSuggestionType -> {
is WebExtensionActionType -> {
stream.write(136)
writeValue(stream, value.raw)
}
is TrackingProtectionPolicy -> {
is GeckoSuggestionType -> {
stream.write(137)
writeValue(stream, value.raw)
}
is HttpsOnlyMode -> {
is TrackingProtectionPolicy -> {
stream.write(138)
writeValue(stream, value.raw)
}
is QueryParameterStripping -> {
is HttpsOnlyMode -> {
stream.write(139)
writeValue(stream, value.raw)
}
is BounceTrackingProtectionMode -> {
is QueryParameterStripping -> {
stream.write(140)
writeValue(stream, value.raw)
}
is ColorScheme -> {
is BounceTrackingProtectionMode -> {
stream.write(141)
writeValue(stream, value.raw)
}
is CookieBannerHandlingMode -> {
is ColorScheme -> {
stream.write(142)
writeValue(stream, value.raw)
}
is WebContentIsolationStrategy -> {
is CookieBannerHandlingMode -> {
stream.write(143)
writeValue(stream, value.raw)
}
is DownloadStatus -> {
is WebContentIsolationStrategy -> {
stream.write(144)
writeValue(stream, value.raw)
}
is LogLevel -> {
is DownloadStatus -> {
stream.write(145)
writeValue(stream, value.raw)
}
is TranslationOptions -> {
is LogLevel -> {
stream.write(146)
writeValue(stream, value.toList())
writeValue(stream, value.raw)
}
is ReaderState -> {
is TranslationOptions -> {
stream.write(147)
writeValue(stream, value.toList())
}
is LastMediaAccessState -> {
is ReaderState -> {
stream.write(148)
writeValue(stream, value.toList())
}
is HistoryMetadataKey -> {
is LastMediaAccessState -> {
stream.write(149)
writeValue(stream, value.toList())
}
is PackageCategoryValue -> {
is HistoryMetadataKey -> {
stream.write(150)
writeValue(stream, value.toList())
}
is ExternalPackage -> {
is PackageCategoryValue -> {
stream.write(151)
writeValue(stream, value.toList())
}
is LoadUrlFlagsValue -> {
is ExternalPackage -> {
stream.write(152)
writeValue(stream, value.toList())
}
is SourceValue -> {
is LoadUrlFlagsValue -> {
stream.write(153)
writeValue(stream, value.toList())
}
is TabState -> {
is SourceValue -> {
stream.write(154)
writeValue(stream, value.toList())
}
is RecoverableTab -> {
is TabState -> {
stream.write(155)
writeValue(stream, value.toList())
}
is RecoverableBrowserState -> {
is RecoverableTab -> {
stream.write(156)
writeValue(stream, value.toList())
}
is IconRequest -> {
is RecoverableBrowserState -> {
stream.write(157)
writeValue(stream, value.toList())
}
is ResourceSize -> {
is IconRequest -> {
stream.write(158)
writeValue(stream, value.toList())
}
is Resource -> {
is ResourceSize -> {
stream.write(159)
writeValue(stream, value.toList())
}
is IconResult -> {
is Resource -> {
stream.write(160)
writeValue(stream, value.toList())
}
is CookiePartitionKey -> {
is IconResult -> {
stream.write(161)
writeValue(stream, value.toList())
}
is Cookie -> {
is CookiePartitionKey -> {
stream.write(162)
writeValue(stream, value.toList())
}
is HistoryItem -> {
is Cookie -> {
stream.write(163)
writeValue(stream, value.toList())
}
is HistoryState -> {
is VisitInfo -> {
stream.write(164)
writeValue(stream, value.toList())
}
is ReaderableState -> {
is HistoryItem -> {
stream.write(165)
writeValue(stream, value.toList())
}
is SecurityInfoState -> {
is HistoryState -> {
stream.write(166)
writeValue(stream, value.toList())
}
is TabContentState -> {
is ReaderableState -> {
stream.write(167)
writeValue(stream, value.toList())
}
is FindResultState -> {
is SecurityInfoState -> {
stream.write(168)
writeValue(stream, value.toList())
}
is CustomSelectionAction -> {
is TabContentState -> {
stream.write(169)
writeValue(stream, value.toList())
}
is WebExtensionData -> {
is FindResultState -> {
stream.write(170)
writeValue(stream, value.toList())
}
is GeckoSuggestion -> {
is CustomSelectionAction -> {
stream.write(171)
writeValue(stream, value.toList())
}
is TabContent -> {
is WebExtensionData -> {
stream.write(172)
writeValue(stream, value.toList())
}
is ContentBlocking -> {
is GeckoSuggestion -> {
stream.write(173)
writeValue(stream, value.toList())
}
is GeckoEngineSettings -> {
is TabContent -> {
stream.write(174)
writeValue(stream, value.toList())
}
is AutocompleteResult -> {
is ContentBlocking -> {
stream.write(175)
writeValue(stream, value.toList())
}
is UnknownHitResult -> {
is GeckoEngineSettings -> {
stream.write(176)
writeValue(stream, value.toList())
}
is ImageHitResult -> {
is AutocompleteResult -> {
stream.write(177)
writeValue(stream, value.toList())
}
is VideoHitResult -> {
is UnknownHitResult -> {
stream.write(178)
writeValue(stream, value.toList())
}
is AudioHitResult -> {
is ImageHitResult -> {
stream.write(179)
writeValue(stream, value.toList())
}
is ImageSrcHitResult -> {
is VideoHitResult -> {
stream.write(180)
writeValue(stream, value.toList())
}
is PhoneHitResult -> {
is AudioHitResult -> {
stream.write(181)
writeValue(stream, value.toList())
}
is EmailHitResult -> {
is ImageSrcHitResult -> {
stream.write(182)
writeValue(stream, value.toList())
}
is GeoHitResult -> {
is PhoneHitResult -> {
stream.write(183)
writeValue(stream, value.toList())
}
is DownloadState -> {
is EmailHitResult -> {
stream.write(184)
writeValue(stream, value.toList())
}
is ShareInternetResourceState -> {
is GeoHitResult -> {
stream.write(185)
writeValue(stream, value.toList())
}
is DownloadState -> {
stream.write(186)
writeValue(stream, value.toList())
}
is ShareInternetResourceState -> {
stream.write(187)
writeValue(stream, value.toList())
}
else -> super.writeValue(stream, value)
}
}
@@ -4650,6 +4729,44 @@ interface GeckoDeleteBrowsingDataController {
}
}
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
interface GeckoHistoryApi {
fun getDetailedVisits(startMillis: Long, endMillis: Long, excludeTypes: List<VisitType>, callback: (Result<List<VisitInfo>>) -> Unit)
companion object {
/** The codec used by GeckoHistoryApi. */
val codec: MessageCodec<Any?> by lazy {
GeckoPigeonCodec()
}
/** Sets up an instance of `GeckoHistoryApi` to handle messages through the `binaryMessenger`. */
@JvmOverloads
fun setUp(binaryMessenger: BinaryMessenger, api: GeckoHistoryApi?, messageChannelSuffix: String = "") {
val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else ""
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.flutter_mozilla_components.GeckoHistoryApi.getDetailedVisits$separatedMessageChannelSuffix", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val startMillisArg = args[0] as Long
val endMillisArg = args[1] as Long
val excludeTypesArg = args[2] as List<VisitType>
api.getDetailedVisits(startMillisArg, endMillisArg, excludeTypesArg) { result: Result<List<VisitInfo>> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(GeckoPigeonUtils.wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(GeckoPigeonUtils.wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
}
}
}
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
interface GeckoDownloadsApi {
fun requestDownload(tabId: String, state: DownloadState)
fun copyInternetResource(tabId: String, state: ShareInternetResourceState)