1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
10 * List of displayed logs.
27 * Called when an instance is initialized.
30 // We assume that only one instance of log-buffer is ever created.
31 LogBufferInterface
= this;
32 chrome
.send('getLogMessages');
35 // Clears the native LogBuffer.
36 clearLogs: function() {
37 chrome
.send('clearLogBuffer');
40 // Handles when a new log message is added.
41 onLogMessageAdded: function(log
) {
42 this.push('logs', log
);
45 // Handles when the logs are cleared.
46 onLogBufferCleared: function() {
50 // Handles when the logs are returned in response to the 'getLogMessages'
52 onGotLogMessages: function(logs
) {
57 // Interface with the native WebUI component for LogBuffer events. The functions
58 // contained in this object will be invoked by the browser for each operation
59 // performed on the native LogBuffer.
60 LogBufferInterface
= {
62 * Called when a new log message is added.
63 * @type {function(LogMessage)}
65 onLogMessageAdded: function(log
) {},
68 * Called when the log buffer is cleared.
71 onLogBufferCleared: function() {},
74 * Called in response to chrome.send('getLogMessages') with the log messages
75 * currently in the buffer.
76 * @type {function(Array<LogMessage>)}
78 onGotLogMessages: function(messages
) {},