Commit 973307a1 authored by Abigail Klein's avatar Abigail Klein Committed by Commit Bot

[chrome:accessibility] Cache filters so they're easily accessible on page refresh.

Bug: 785493,959368
Change-Id: Id9aad4c62b617f2c0cd2b2269624dd1f211edb7e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1829951Reviewed-by: default avatarNektarios Paisios <nektar@chromium.org>
Commit-Queue: Nektarios Paisios <nektar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702179}
parent a1574595
...@@ -147,7 +147,7 @@ found in the LICENSE file. ...@@ -147,7 +147,7 @@ found in the LICENSE file.
<label for="filter-allow"> <label for="filter-allow">
Allow: Allow:
</label> </label>
<input id="filter-allow" aria-describedby="allow_secondary" value="*"> <input id="filter-allow" aria-describedby="allow_secondary">
</div> </div>
<div id="allow_secondary" class="secondary"> <div id="allow_secondary" class="secondary">
Include these attributes. Empty attributes are skipped. Include these attributes. Empty attributes are skipped.
......
...@@ -70,6 +70,12 @@ cr.define('accessibility', function() { ...@@ -70,6 +70,12 @@ cr.define('accessibility', function() {
const allow = improvementsEnabled ? $('filter-allow').value : '*'; const allow = improvementsEnabled ? $('filter-allow').value : '*';
const allowEmpty = improvementsEnabled ? $('filter-allow-empty').value : ''; const allowEmpty = improvementsEnabled ? $('filter-allow-empty').value : '';
const deny = improvementsEnabled ? $('filter-deny').value : ''; const deny = improvementsEnabled ? $('filter-deny').value : '';
if (improvementsEnabled) {
window.localStorage['chrome-accessibility-filter-allow'] = allow;
window.localStorage['chrome-accessibility-filter-allow-empty'] =
allowEmpty;
window.localStorage['chrome-accessibility-filter-deny'] = deny;
}
// The calling |element| is a button with an id of the format // The calling |element| is a button with an id of the format
// <treeId>:<requestType>, where requestType is one of 'showOrRefreshTree', // <treeId>:<requestType>, where requestType is one of 'showOrRefreshTree',
...@@ -122,8 +128,17 @@ cr.define('accessibility', function() { ...@@ -122,8 +128,17 @@ cr.define('accessibility', function() {
addToBrowsersList(browsers[i]); addToBrowsersList(browsers[i]);
} }
// Remove filters if the flag is not enabled. // Cache filters so they're easily accessible on page refresh. Remove
if (!data['improvementsEnabled']) { // filters if the flag is not enabled.
if (data['improvementsEnabled']) {
const allow = window.localStorage['chrome-accessibility-filter-allow'];
const allowEmpty =
window.localStorage['chrome-accessibility-filter-allow-empty'];
const deny = window.localStorage['chrome-accessibility-filter-deny'];
$('filter-allow').value = allow ? allow : '*';
$('filter-allow-empty').value = allowEmpty ? allowEmpty : '';
$('filter-deny').value = deny ? deny : '';
} else {
const filtersEl = $('filters'); const filtersEl = $('filters');
filtersEl.parentNode.removeChild(filtersEl); filtersEl.parentNode.removeChild(filtersEl);
} }
......
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