Chromium Code Reviews| Index: chrome/browser/resources/offline_pages/offline_internals.js |
| diff --git a/chrome/browser/resources/offline_pages/offline_internals.js b/chrome/browser/resources/offline_pages/offline_internals.js |
| index baa0d181feaf049c62c42c543222fd0c0d8cd627..63394e9301995d440c8b5013273d09ba104cc6ac 100644 |
| --- a/chrome/browser/resources/offline_pages/offline_internals.js |
| +++ b/chrome/browser/resources/offline_pages/offline_internals.js |
| @@ -72,6 +72,15 @@ cr.define('offlineInternals', function() { |
| for (var i = 0; i < requests.length; i++) { |
| var row = document.createElement('tr'); |
| + var checkboxCell = document.createElement('td'); |
| + var checkbox = document.createElement('input'); |
| + checkbox.setAttribute('type', 'checkbox'); |
| + checkbox.setAttribute('name', 'requests'); |
| + checkbox.setAttribute('value', requests[i].id); |
| + |
| + checkboxCell.appendChild(checkbox); |
| + row.appendChild(checkboxCell); |
| + |
| var cell = document.createElement('td'); |
| cell.textContent = requests[i].onlineUrl; |
| row.appendChild(cell); |
| @@ -123,6 +132,13 @@ cr.define('offlineInternals', function() { |
| } |
| /** |
| + * Delete all pending SavePageRequest items in the request queue. |
| + */ |
| + function deleteAllRequests() { |
| + browserProxy_.deleteAllRequests().then(requestsDeleted); |
| + } |
| + |
| + /** |
| * Callback when pages are deleted. |
| * @param {string} status The status of the request. |
| */ |
| @@ -132,6 +148,14 @@ cr.define('offlineInternals', function() { |
| } |
| /** |
| + * Callback when requests are deleted. |
| + */ |
| + function requestsDeleted(status) { |
| + $('page-actions-info').textContent = status; |
|
chili
2016/09/12 20:26:01
page-actions-info is a div between the stored page
Pete Williamson
2016/09/12 22:46:35
Done.
|
| + browserProxy_.getRequestQueue().then(fillRequestQueue); |
| + } |
| + |
| + /** |
| * Downloads all the stored page and request queue information into a file. |
| * TODO(chili): Create a CSV writer that can abstract out the line joining. |
| */ |
| @@ -171,6 +195,21 @@ cr.define('offlineInternals', function() { |
| } |
| /** |
| + * Delete selected SavePageRequest items from the request queue. |
| + */ |
| + function deleteSelectedRequests() { |
| + var checkboxes = document.getElementsByName('requests'); |
| + var selectedIds = []; |
| + |
| + for (var i = 0; i < checkboxes.length; i++) { |
| + if (checkboxes[i].checked) |
| + selectedIds.push(checkboxes[i].value); |
| + } |
| + |
| + browserProxy_.deleteSelectedRequests(selectedIds).then(requestsDeleted); |
| + } |
| + |
| + /** |
| * Refreshes the logs. |
| */ |
| function refreshLog() { |
| @@ -198,6 +237,8 @@ cr.define('offlineInternals', function() { |
| var incognito = loadTimeData.getBoolean('isIncognito'); |
| $('clear-all').disabled = incognito; |
| $('clear-selected').disabled = incognito; |
| + $('delete-all').disabled = incognito; |
| + $('delete-selected').disabled = incognito; |
| $('log-model-on').disabled = incognito; |
| $('log-model-off').disabled = incognito; |
| $('log-request-on').disabled = incognito; |
| @@ -206,6 +247,8 @@ cr.define('offlineInternals', function() { |
| $('clear-all').onclick = deleteAllPages; |
| $('clear-selected').onclick = deleteSelectedPages; |
| + $('delete-all').onclick = deleteAllRequests; |
| + $('delete-selected').onclick = deleteSelectedRequests; |
| $('refresh').onclick = refreshAll; |
| $('download').onclick = download; |
| $('log-model-on').onclick = togglePageModelLog.bind(this, true); |