fun get(key: TrackingProtectionCategory, blocked: Boolean) = if (blocked) buckets.blockedBucketMap[key].orEmpty() else buckets.loadedBucketMap[key].orEmpty() companion object { private fun putTrackersInBuckets( list: List<TrackerLog>, ): BucketedTrackerLog { val blockedMap = createMap() val loadedMap = createMap() for (item in list) { if (item.cookiesHasBeenBlocked) { blockedMap.addTrackerHost(CROSS_SITE_TRACKING_COOKIES, item) } // Blocked categories for (category in item.blockedCategories) { blockedMap.addTrackerHost(category, item) } // Loaded categories for (category in item.loadedCategories) { loadedMap.addTrackerHost(category, item) } } return BucketedTrackerLog(blockedMap, loadedMap) }
Gets the tracker URLs for a given category.