mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-09 19:10:42 +00:00
Issue #7863: Ensure parent process triggers speculative connect
This commit is contained in:
parent
f20fb50481
commit
20387401b1
@ -213,7 +213,8 @@ class BrowserToolbarView(
|
|||||||
components.core.sessionManager,
|
components.core.sessionManager,
|
||||||
sessionId = null,
|
sessionId = null,
|
||||||
isPrivate = sessionManager.selectedSession?.private ?: false,
|
isPrivate = sessionManager.selectedSession?.private ?: false,
|
||||||
interactor = interactor
|
interactor = interactor,
|
||||||
|
engine = components.core.engine
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import mozilla.components.browser.domains.autocomplete.DomainAutocompleteProvide
|
|||||||
import mozilla.components.browser.session.SessionManager
|
import mozilla.components.browser.session.SessionManager
|
||||||
import mozilla.components.browser.toolbar.BrowserToolbar
|
import mozilla.components.browser.toolbar.BrowserToolbar
|
||||||
import mozilla.components.browser.toolbar.display.DisplayToolbar
|
import mozilla.components.browser.toolbar.display.DisplayToolbar
|
||||||
|
import mozilla.components.concept.engine.Engine
|
||||||
import mozilla.components.concept.storage.HistoryStorage
|
import mozilla.components.concept.storage.HistoryStorage
|
||||||
import mozilla.components.feature.toolbar.ToolbarAutocompleteFeature
|
import mozilla.components.feature.toolbar.ToolbarAutocompleteFeature
|
||||||
import mozilla.components.feature.toolbar.ToolbarFeature
|
import mozilla.components.feature.toolbar.ToolbarFeature
|
||||||
@ -72,7 +73,8 @@ class DefaultToolbarIntegration(
|
|||||||
sessionManager: SessionManager,
|
sessionManager: SessionManager,
|
||||||
sessionId: String? = null,
|
sessionId: String? = null,
|
||||||
isPrivate: Boolean,
|
isPrivate: Boolean,
|
||||||
interactor: BrowserToolbarViewInteractor
|
interactor: BrowserToolbarViewInteractor,
|
||||||
|
engine: Engine
|
||||||
) : ToolbarIntegration(
|
) : ToolbarIntegration(
|
||||||
context = context,
|
context = context,
|
||||||
toolbar = toolbar,
|
toolbar = toolbar,
|
||||||
@ -135,7 +137,11 @@ class DefaultToolbarIntegration(
|
|||||||
}
|
}
|
||||||
toolbar.addBrowserAction(tabsAction)
|
toolbar.addBrowserAction(tabsAction)
|
||||||
|
|
||||||
ToolbarAutocompleteFeature(toolbar).apply {
|
val engineForSpeculativeConnects = if (!isPrivate) engine else null
|
||||||
|
ToolbarAutocompleteFeature(
|
||||||
|
toolbar,
|
||||||
|
engineForSpeculativeConnects
|
||||||
|
).apply {
|
||||||
addDomainProvider(domainAutocompleteProvider)
|
addDomainProvider(domainAutocompleteProvider)
|
||||||
if (context.settings().shouldShowHistorySuggestions) {
|
if (context.settings().shouldShowHistorySuggestions) {
|
||||||
addHistoryStorageProvider(historyStorage)
|
addHistoryStorageProvider(historyStorage)
|
||||||
|
@ -127,7 +127,8 @@ class SearchFragment : Fragment(), UserInteractionHandler {
|
|||||||
view.toolbar_component_wrapper,
|
view.toolbar_component_wrapper,
|
||||||
searchInteractor,
|
searchInteractor,
|
||||||
historyStorageProvider(),
|
historyStorageProvider(),
|
||||||
(activity as HomeActivity).browsingModeManager.mode.isPrivate
|
(activity as HomeActivity).browsingModeManager.mode.isPrivate,
|
||||||
|
requireComponents.core.engine
|
||||||
)
|
)
|
||||||
|
|
||||||
val urlView = toolbarView.view
|
val urlView = toolbarView.view
|
||||||
@ -307,6 +308,10 @@ class SearchFragment : Fragment(), UserInteractionHandler {
|
|||||||
fill_link_from_clipboard.visibility = visibility
|
fill_link_from_clipboard.visibility = visibility
|
||||||
divider_line.visibility = visibility
|
divider_line.visibility = visibility
|
||||||
clipboard_url.text = clipboardUrl
|
clipboard_url.text = clipboardUrl
|
||||||
|
|
||||||
|
if (clipboardUrl != null && !((activity as HomeActivity).browsingModeManager.mode.isPrivate)) {
|
||||||
|
requireComponents.core.engine.speculativeConnect(clipboardUrl)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onRequestPermissionsResult(
|
override fun onRequestPermissionsResult(
|
||||||
|
@ -141,6 +141,7 @@ class AwesomeBarView(
|
|||||||
val draw = getDrawable(context, R.drawable.ic_link)!!
|
val draw = getDrawable(context, R.drawable.ic_link)!!
|
||||||
draw.colorFilter = createBlendModeColorFilterCompat(primaryTextColor, SRC_IN)
|
draw.colorFilter = createBlendModeColorFilterCompat(primaryTextColor, SRC_IN)
|
||||||
|
|
||||||
|
val engineForSpeculativeConnects = if (!isBrowsingModePrivate()) components.core.engine else null
|
||||||
sessionProvider =
|
sessionProvider =
|
||||||
SessionSuggestionProvider(
|
SessionSuggestionProvider(
|
||||||
context.resources,
|
context.resources,
|
||||||
@ -154,14 +155,16 @@ class AwesomeBarView(
|
|||||||
HistoryStorageSuggestionProvider(
|
HistoryStorageSuggestionProvider(
|
||||||
components.core.historyStorage,
|
components.core.historyStorage,
|
||||||
loadUrlUseCase,
|
loadUrlUseCase,
|
||||||
components.core.icons
|
components.core.icons,
|
||||||
|
engineForSpeculativeConnects
|
||||||
)
|
)
|
||||||
|
|
||||||
bookmarksStorageSuggestionProvider =
|
bookmarksStorageSuggestionProvider =
|
||||||
BookmarksStorageSuggestionProvider(
|
BookmarksStorageSuggestionProvider(
|
||||||
components.core.bookmarksStorage,
|
components.core.bookmarksStorage,
|
||||||
loadUrlUseCase,
|
loadUrlUseCase,
|
||||||
components.core.icons
|
components.core.icons,
|
||||||
|
engineForSpeculativeConnects
|
||||||
)
|
)
|
||||||
|
|
||||||
val searchDrawable = getDrawable(context, R.drawable.ic_search)!!
|
val searchDrawable = getDrawable(context, R.drawable.ic_search)!!
|
||||||
@ -176,7 +179,8 @@ class AwesomeBarView(
|
|||||||
mode = SearchSuggestionProvider.Mode.MULTIPLE_SUGGESTIONS,
|
mode = SearchSuggestionProvider.Mode.MULTIPLE_SUGGESTIONS,
|
||||||
limit = 3,
|
limit = 3,
|
||||||
icon = searchDrawable.toBitmap(),
|
icon = searchDrawable.toBitmap(),
|
||||||
showDescription = false
|
showDescription = false,
|
||||||
|
engine = engineForSpeculativeConnects
|
||||||
)
|
)
|
||||||
|
|
||||||
shortcutsEnginePickerProvider =
|
shortcutsEnginePickerProvider =
|
||||||
@ -344,6 +348,8 @@ class AwesomeBarView(
|
|||||||
val draw = getDrawable(context, R.drawable.ic_search)
|
val draw = getDrawable(context, R.drawable.ic_search)
|
||||||
draw?.colorFilter = createBlendModeColorFilterCompat(primaryTextColor, SRC_IN)
|
draw?.colorFilter = createBlendModeColorFilterCompat(primaryTextColor, SRC_IN)
|
||||||
|
|
||||||
|
val engineForSpeculativeConnects = if (!isBrowsingModePrivate()) components.core.engine else null
|
||||||
|
|
||||||
SearchSuggestionProvider(
|
SearchSuggestionProvider(
|
||||||
components.search.provider.installedSearchEngines(context).list.find { it.name == engine.name }
|
components.search.provider.installedSearchEngines(context).list.find { it.name == engine.name }
|
||||||
?: components.search.provider.getDefaultEngine(context),
|
?: components.search.provider.getDefaultEngine(context),
|
||||||
@ -351,7 +357,8 @@ class AwesomeBarView(
|
|||||||
components.core.client,
|
components.core.client,
|
||||||
limit = 3,
|
limit = 3,
|
||||||
mode = SearchSuggestionProvider.Mode.MULTIPLE_SUGGESTIONS,
|
mode = SearchSuggestionProvider.Mode.MULTIPLE_SUGGESTIONS,
|
||||||
icon = draw?.toBitmap()
|
icon = draw?.toBitmap(),
|
||||||
|
engine = engineForSpeculativeConnects
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import kotlinx.android.extensions.LayoutContainer
|
|||||||
import mozilla.components.browser.domains.autocomplete.ShippedDomainsProvider
|
import mozilla.components.browser.domains.autocomplete.ShippedDomainsProvider
|
||||||
import mozilla.components.browser.toolbar.BrowserToolbar
|
import mozilla.components.browser.toolbar.BrowserToolbar
|
||||||
import mozilla.components.browser.toolbar.behavior.BrowserToolbarBottomBehavior
|
import mozilla.components.browser.toolbar.behavior.BrowserToolbarBottomBehavior
|
||||||
|
import mozilla.components.concept.engine.Engine
|
||||||
import mozilla.components.concept.storage.HistoryStorage
|
import mozilla.components.concept.storage.HistoryStorage
|
||||||
import mozilla.components.feature.toolbar.ToolbarAutocompleteFeature
|
import mozilla.components.feature.toolbar.ToolbarAutocompleteFeature
|
||||||
import mozilla.components.support.ktx.android.content.getColorFromAttr
|
import mozilla.components.support.ktx.android.content.getColorFromAttr
|
||||||
@ -63,7 +64,8 @@ class ToolbarView(
|
|||||||
private val container: ViewGroup,
|
private val container: ViewGroup,
|
||||||
private val interactor: ToolbarInteractor,
|
private val interactor: ToolbarInteractor,
|
||||||
private val historyStorage: HistoryStorage?,
|
private val historyStorage: HistoryStorage?,
|
||||||
private val isPrivate: Boolean
|
private val isPrivate: Boolean,
|
||||||
|
engine: Engine
|
||||||
) : LayoutContainer {
|
) : LayoutContainer {
|
||||||
|
|
||||||
override val containerView: View?
|
override val containerView: View?
|
||||||
@ -137,7 +139,11 @@ class ToolbarView(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolbarAutocompleteFeature(view).apply {
|
val engineForSpeculativeConnects = if (!isPrivate) engine else null
|
||||||
|
ToolbarAutocompleteFeature(
|
||||||
|
view,
|
||||||
|
engineForSpeculativeConnects
|
||||||
|
).apply {
|
||||||
addDomainProvider(ShippedDomainsProvider().also { it.initialize(view.context) })
|
addDomainProvider(ShippedDomainsProvider().also { it.initialize(view.context) })
|
||||||
historyStorage?.also(::addHistoryStorageProvider)
|
historyStorage?.also(::addHistoryStorageProvider)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user