Commit d8cbbe04 authored by Stefano Crocco's avatar Stefano Crocco Committed by David Faure
Browse files

Avoid displaying multiple feature permission bars for same origin and feature

If a permission bar for a given origin and feature is already displayed,
don't show a new one for the same origin and feature.
parent 4dbb3ac5
......@@ -899,7 +899,15 @@ void WebEnginePart::slotWindowCloseRequested()
void WebEnginePart::slotShowFeaturePermissionBar(const QUrl &origin, QWebEnginePage::Feature feature)
auto findExistingBar = [origin, feature](FeaturePermissionBar *bar) {
return bar->url() == origin && bar->feature() == feature;
auto found = std::find_if(m_permissionBars.constBegin(), m_permissionBars.constEnd(), findExistingBar);
if (found != m_permissionBars.constEnd()) {
FeaturePermissionBar *bar = new FeaturePermissionBar(widget());
auto policyLambda = [this, bar](QWebEnginePage::Feature feature, QWebEnginePage::PermissionPolicy policy) {
slotFeaturePolicyChosen(bar, feature, policy);
......@@ -922,6 +930,7 @@ void WebEnginePart::slotFeaturePolicyChosen(FeaturePermissionBar* bar, QWebEngin
void WebEnginePart::deleteFeaturePermissionBar(FeaturePermissionBar *bar)
......@@ -184,6 +184,7 @@ private:
KUrlLabel* m_statusBarWalletLabel;
SearchBar* m_searchBar;
PasswordBar* m_passwordBar;
QVector<FeaturePermissionBar*> m_permissionBars;
WebEngineBrowserExtension* m_browserExtension;
KParts::StatusBarExtension* m_statusBarExtension;
WebEngineView* m_webView;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment