diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/chrome/browser/resources/quota_internals | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/chrome/browser/resources/quota_internals')
4 files changed, 49 insertions, 15 deletions
diff --git a/chromium/chrome/browser/resources/quota_internals/event_handler.js b/chromium/chrome/browser/resources/quota_internals/event_handler.js index 6d0e7ddd9d3..d8c8b787ab3 100644 --- a/chromium/chrome/browser/resources/quota_internals/event_handler.js +++ b/chromium/chrome/browser/resources/quota_internals/event_handler.js @@ -391,6 +391,22 @@ function handleStatistics(event) { } /** + * Event Handler for |cr.quota.onStoragePressureFlagUpdated|. + * |event.detail| contains a boolean representing whether or not to show + * the storage pressure UI. + * @param {!CustomEvent<!Object>} event StoragePressureFlagUpdated event. + */ +function handleStoragePressureFlagInfo(event) { + const data = event.detail; + $('storage-pressure-loading').hidden = true; + if (data.isStoragePressureEnabled) { + $('storage-pressure-outer').hidden = false; + } else { + $('storage-pressure-disabled').hidden = false; + } +} + +/** * Update description on 'tree-item-description' field with * selected item in tree view. */ @@ -490,6 +506,8 @@ function onLoad() { cr.quota.onPerOriginInfoUpdated.addEventListener( 'update', handlePerOriginInfo); cr.quota.onStatisticsUpdated.addEventListener('update', handleStatistics); + cr.quota.onStoragePressureFlagUpdated.addEventListener( + 'update', handleStoragePressureFlagInfo); cr.quota.requestInfo(); $('refresh-button').addEventListener('click', cr.quota.requestInfo, false); diff --git a/chromium/chrome/browser/resources/quota_internals/main.html b/chromium/chrome/browser/resources/quota_internals/main.html index 59d0a4bbb2d..c1f7fb6458f 100644 --- a/chromium/chrome/browser/resources/quota_internals/main.html +++ b/chromium/chrome/browser/resources/quota_internals/main.html @@ -56,16 +56,26 @@ found in the LICENSE file. <table> <tbody id="stat-entries" class="entries"></tbody> </table> - <h2>Test Storage Pressure Behavior</h2> - <div class="pressure"> - Origin to test: - <input id="storage-pressure-origin" - value="https://www.example.com"> - </div> - <div class="pressure"> - <button id="trigger-notification"> - Trigger Storage Pressure Notification - </button> + <div id="storage-pressure-section"> + <h2>Test Storage Pressure Behavior</h2> + <div id="storage-pressure-loading"> + Loading... + </div> + <div id="storage-pressure-outer" hidden> + <div class="pressure"> + Origin to test: + <input id="storage-pressure-origin" + value="https://www.example.com"> + </div> + <div class="pressure"> + <button id="trigger-notification"> + Trigger Storage Pressure Notification + </button> + </div> + </div> + <div id="storage-pressure-disabled" hidden> + Storage Pressure feature disabled. + </div> </div> </tabpanel> diff --git a/chromium/chrome/browser/resources/quota_internals/message_dispatcher.js b/chromium/chrome/browser/resources/quota_internals/message_dispatcher.js index 473ce67bfd7..25fa7ecf1bb 100644 --- a/chromium/chrome/browser/resources/quota_internals/message_dispatcher.js +++ b/chromium/chrome/browser/resources/quota_internals/message_dispatcher.js @@ -38,13 +38,15 @@ cr.define('cr.quota', function() { * * onGlobalInfoUpdated, * * onPerHostInfoUpdated, * * onPerOriginInfoUpdated, - * * onStatisticsUpdated. + * * onStatisticsUpdated, + * * onStoragePressureFlagUpdated. * @param {string} message Message label. Possible Values are: * * 'AvailableSpaceUpdated', * * 'GlobalInfoUpdated', * * 'PerHostInfoUpdated', * * 'PerOriginInfoUpdated', - * * 'StatisticsUpdated'. + * * 'StatisticsUpdated', + * * 'StoragePressureFlagUpdated'. * @param {Object} detail Message specific additional data. */ function messageHandler(message, detail) { @@ -65,6 +67,9 @@ cr.define('cr.quota', function() { case 'StatisticsUpdated': target = cr.quota.onStatisticsUpdated; break; + case 'StoragePressureFlagUpdated': + target = cr.quota.onStoragePressureFlagUpdated; + break; default: console.error('Unknown Message'); break; @@ -82,6 +87,7 @@ cr.define('cr.quota', function() { onPerHostInfoUpdated: new cr.EventTarget(), onPerOriginInfoUpdated: new cr.EventTarget(), onStatisticsUpdated: new cr.EventTarget(), + onStoragePressureFlagUpdated: new cr.EventTarget(), requestInfo: requestInfo, triggerStoragePressure: triggerStoragePressure, diff --git a/chromium/chrome/browser/resources/quota_internals/quota_internals_resources.grd b/chromium/chrome/browser/resources/quota_internals/quota_internals_resources.grd index c5b1cca697e..3694a9782c4 100644 --- a/chromium/chrome/browser/resources/quota_internals/quota_internals_resources.grd +++ b/chromium/chrome/browser/resources/quota_internals/quota_internals_resources.grd @@ -8,9 +8,9 @@ </outputs> <release seq="1"> <includes> - <include name="IDR_QUOTA_INTERNALS_MAIN_HTML" file="main.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip"/> - <include name="IDR_QUOTA_INTERNALS_EVENT_HANDLER_JS" file="event_handler.js" type="BINDATA" compress="gzip"/> - <include name="IDR_QUOTA_INTERNALS_MESSAGE_DISPATCHER_JS" file="message_dispatcher.js" type="BINDATA" compress="gzip"/> + <include name="IDR_QUOTA_INTERNALS_MAIN_HTML" file="main.html" flattenhtml="true" allowexternalscript="true" type="BINDATA"/> + <include name="IDR_QUOTA_INTERNALS_EVENT_HANDLER_JS" file="event_handler.js" type="BINDATA"/> + <include name="IDR_QUOTA_INTERNALS_MESSAGE_DISPATCHER_JS" file="message_dispatcher.js" type="BINDATA"/> </includes> </release> </grit> |