diff --git a/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/Session.java b/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/Session.java index dda9ef4cd..1309d4288 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/Session.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/Session.java @@ -794,6 +794,10 @@ public void setWebXRState(@SessionState.WebXRState int aWebXRState) { } } + public @SessionState.WebXRState int getWebXRState() { + return mState.mWebXRState; + } + // Session Settings protected void setServo(final boolean enabled) { diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/adapters/SitePermissionAdapter.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/adapters/SitePermissionAdapter.java index 7ce827f36..f330b13a6 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/adapters/SitePermissionAdapter.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/adapters/SitePermissionAdapter.java @@ -60,6 +60,10 @@ public void setSites(@NonNull List sites) { } } + public List getSites() { + return mDisplayList; + } + private void notifyDiff(List newDisplayList) { DiffUtil.DiffResult result = DiffUtil.calculateDiff(new DiffUtil.Callback() { @Override diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/settings/PrivacyOptionsView.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/settings/PrivacyOptionsView.java index 91f25d80f..231c89355 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/settings/PrivacyOptionsView.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/settings/PrivacyOptionsView.java @@ -22,12 +22,14 @@ import org.mozilla.geckoview.StorageController; import org.mozilla.vrbrowser.R; import org.mozilla.vrbrowser.browser.SettingsStore; +import org.mozilla.vrbrowser.browser.engine.SessionState; import org.mozilla.vrbrowser.browser.engine.SessionStore; import org.mozilla.vrbrowser.databinding.OptionsPrivacyBinding; import org.mozilla.vrbrowser.db.SitePermission; import org.mozilla.vrbrowser.ui.views.settings.SwitchSetting; import org.mozilla.vrbrowser.ui.widgets.WidgetManagerDelegate; import org.mozilla.vrbrowser.ui.widgets.WidgetPlacement; +import org.mozilla.vrbrowser.ui.widgets.WindowWidget; import org.mozilla.vrbrowser.utils.DeviceType; import java.util.ArrayList; @@ -36,8 +38,6 @@ class PrivacyOptionsView extends SettingsView { private OptionsPrivacyBinding mBinding; private ArrayList> mPermissionButtons; - private SettingsView mPopUpsBlockingExceptions; - private SettingsView mWebXRSitesExceptions; public PrivacyOptionsView(Context aContext, WidgetManagerDelegate aWidgetManager) { super(aContext, aWidgetManager); @@ -87,9 +87,6 @@ protected void updateUI() { TextView permissionsTitleText = findViewById(R.id.permissionsTitle); permissionsTitleText.setText(getContext().getString(R.string.security_options_permissions_title, getContext().getString(R.string.app_name))); - mPopUpsBlockingExceptions = new SitePermissionsOptionsView(getContext(), mWidgetManager, SitePermission.SITE_PERMISSION_POPUP); - mWebXRSitesExceptions = new SitePermissionsOptionsView(getContext(), mWidgetManager, SitePermission.SITE_PERMISSION_WEBXR); - mPermissionButtons = new ArrayList<>(); mPermissionButtons.add(Pair.create(findViewById(R.id.cameraPermissionSwitch), Manifest.permission.CAMERA)); mPermissionButtons.add(Pair.create(findViewById(R.id.microphonePermissionSwitch), Manifest.permission.RECORD_AUDIO)); @@ -323,6 +320,9 @@ private void setWebXR(boolean value, boolean doApply) { if (doApply) { SettingsStore.getInstance(getContext()).setWebXREnabled(value); + for (WindowWidget window: mWidgetManager.getWindows().getCurrentWindows()) { + window.getSession().reload(GeckoSession.LOAD_FLAGS_BYPASS_CACHE); + } } } diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/settings/SitePermissionsOptionsView.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/settings/SitePermissionsOptionsView.java index 58d02d2eb..ceba85d3d 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/settings/SitePermissionsOptionsView.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/settings/SitePermissionsOptionsView.java @@ -14,7 +14,9 @@ import androidx.databinding.DataBindingUtil; import androidx.lifecycle.Observer; +import org.mozilla.geckoview.GeckoSession; import org.mozilla.vrbrowser.R; +import org.mozilla.vrbrowser.browser.engine.Session; import org.mozilla.vrbrowser.databinding.OptionsExceptionsBinding; import org.mozilla.vrbrowser.db.SitePermission; import org.mozilla.vrbrowser.ui.adapters.SitePermissionAdapter; @@ -22,6 +24,8 @@ import org.mozilla.vrbrowser.ui.viewmodel.SitePermissionViewModel; import org.mozilla.vrbrowser.ui.widgets.WidgetManagerDelegate; import org.mozilla.vrbrowser.ui.widgets.WidgetPlacement; +import org.mozilla.vrbrowser.ui.widgets.WindowWidget; +import org.mozilla.vrbrowser.utils.UrlUtils; import java.util.List; @@ -102,7 +106,13 @@ public Point getDimensions() { @Override protected boolean reset() { + List sites = mAdapter.getSites(); mViewModel.deleteAll(mCategory); + if (sites != null) { + for (SitePermission site: sites) { + reloadIfSameDomain(site.url); + } + } return true; } @@ -150,6 +160,19 @@ public void onChanged(List sites) { @Override public void onDelete(@NonNull SitePermission item) { mViewModel.deleteSite(item); + reloadIfSameDomain(item.url); } }; + + private void reloadIfSameDomain(String aHost) { + if (mCategory != SitePermission.SITE_PERMISSION_WEBXR) { + return; + } + for (WindowWidget window: mWidgetManager.getWindows().getCurrentWindows()) { + Session session = window.getSession(); + if (aHost.equalsIgnoreCase(UrlUtils.getHost(session.getCurrentUri()))) { + session.reload(GeckoSession.LOAD_FLAGS_BYPASS_CACHE); + } + } + } }