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

Unified Diff: components/proximity_auth/webui/resources/log-buffer.js

Issue 1135293002: Hook up PA_LOG() logs to chrome://proximity-auth WebUI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stop using release() Created 5 years, 7 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: components/proximity_auth/webui/resources/log-buffer.js
diff --git a/components/proximity_auth/webui/resources/log-buffer.js b/components/proximity_auth/webui/resources/log-buffer.js
new file mode 100644
index 0000000000000000000000000000000000000000..71b393b5b961d13f0ccb4e4a8d29c3305662559f
--- /dev/null
+++ b/components/proximity_auth/webui/resources/log-buffer.js
@@ -0,0 +1,74 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+Polymer('log-buffer', {
+ publish: {
+ /**
+ * List of displayed logs.
+ * @type {?Array.<{{
+ * text: string,
+ * time: string,
+ * file: string,
+ * line: number,
+ * severity: number,
+ * }}>} LogMessage
+ */
+ logs: null,
+ },
+
+ /**
+ * Called when an instance is created.
+ */
+ created: function() {
+ this.logs = [];
+ // We assume that only one instance of log-buffer is ever created.
+ LogBufferInterface = this;
+ chrome.send('getLogMessages');
+ },
+
+ // Clears the native LogBuffer.
+ clearLogs: function() {
+ chrome.send('clearLogBuffer');
+ },
+
+ // Handles when a new log message is added.
+ onLogMessageAdded: function(log) {
+ this.logs.push(log);
+ },
+
+ // Handles when the logs are cleared.
+ onLogBufferCleared: function() {
+ this.logs = [];
+ },
+
+ // Handles when the logs are returned in response to the 'getLogMessages'
+ // request.
+ onGotLogMessages: function(logs) {
+ this.logs = logs;
+ }
+});
+
+// Interface with the native WebUI component for LogBuffer events. The functions
+// contained in this object will be invoked by the browser for each operation
+// performed on the native LogBuffer.
+LogBufferInterface = {
+ /**
+ * Called when a new log message is added.
+ * @type {function(LogMessage)}
+ */
+ onLogMessageAdded: function(log) {},
+
+ /**
+ * Called when the log buffer is cleared.
+ * @type {function()}
+ */
+ onLogBufferCleared: function() {},
+
+ /**
+ * Called in response to chrome.send('getLogMessages') with the log messages
+ * currently in the buffer.
+ * @type {function(Array.<LogMessage>)}
+ */
+ onGotLogMessages: function(messages) {},
+};
« no previous file with comments | « components/proximity_auth/webui/resources/log-buffer.html ('k') | components/proximity_auth/webui/resources/log-panel.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698