Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7128)

Unified Diff: chrome/browser/resources/offline_pages/offline_internals.js

Issue 2089423002: [Offline Pages] Connect the offline page logs to the internals page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@i4
Patch Set: remove unneeded consts Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 fc0fcb4a463a50edaa904c5fb6b4c2f1b9556515..d663460290d355fbde4fa5fd4fc463d29c851eec 100644
--- a/chrome/browser/resources/offline_pages/offline_internals.js
+++ b/chrome/browser/resources/offline_pages/offline_internals.js
@@ -82,11 +82,26 @@ cr.define('offlineInternals', function() {
}
/**
+ * Fills the event logs section.
+ * @param {!Array<string>} logs A list of log strings.
+ */
+ function fillEventLog(logs) {
+ var element = $('logs');
+ element.textContent = '';
+ for (let log of logs) {
+ var logItem = document.createElement('li');
+ logItem.textContent = log;
+ element.appendChild(logItem);
+ }
+ }
+
+ /**
* Refresh all displayed information.
*/
function refreshAll() {
browserProxy_.getStoredPages().then(fillStoredPages);
browserProxy_.getRequestQueue().then(fillRequestQueue);
+ refreshLog();
}
/**
@@ -121,6 +136,15 @@ cr.define('offlineInternals', function() {
}
/**
+ * Updates the status strings.
+ * @param {!IsLogging} logStatus Status of logging.
+ */
+ function updateLogStatus(logStatus) {
+ $('model-status').textContent = logStatus.modelIsLogging ? 'On' : 'Off';
+ $('request-status').textContent = logStatus.queueIsLogging ? 'On' : 'Off';
+ }
+
+ /**
* Delete selected pages from the offline store.
*/
function deleteSelectedPages() {
@@ -135,11 +159,28 @@ cr.define('offlineInternals', function() {
browserProxy_.deleteSelectedPages(selectedIds).then(pagesDeleted);
}
+ /**
+ * Refreshes the logs.
+ */
+ function refreshLog() {
+ browserProxy_.getEventLogs().then(fillEventLog);
+ browserProxy_.getLoggingState().then(updateLogStatus);
+ }
+
function initialize() {
$('clear-all').onclick = deleteAllPages;
$('clear-selected').onclick = deleteSelectedPages;
$('refresh').onclick = refreshAll;
$('download').onclick = download;
+ $('log-model-on').onclick =
+ browserProxy_.setRecordPageModel.bind(browserProxy_, true);
+ $('log-model-off').onclick =
+ browserProxy_.setRecordPageModel.bind(browserProxy_, false);
+ $('log-request-on').onclick =
+ browserProxy_.setRecordRequestQueue.bind(browserProxy_, true);
+ $('log-request-off').onclick =
+ browserProxy_.setRecordRequestQueue.bind(browserProxy_, false);
+ $('refresh-logs').onclick = refreshLog;
browserProxy_ =
offlineInternals.OfflineInternalsBrowserProxyImpl.getInstance();
refreshAll();

Powered by Google App Engine
This is Rietveld 408576698