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.
5 Polymer('log-buffer', {
8 * List of displayed logs.
21 * Called when an instance is created.
25 // We assume that only one instance of log-buffer is ever created.
26 LogBufferInterface = this;
27 chrome.send('getLogMessages');
30 // Clears the native LogBuffer.
31 clearLogs: function() {
32 chrome.send('clearLogBuffer');
35 // Handles when a new log message is added.
36 onLogMessageAdded: function(log) {
40 // Handles when the logs are cleared.
41 onLogBufferCleared: function() {
45 // Handles when the logs are returned in response to the 'getLogMessages'
47 onGotLogMessages: function(logs) {
52 // Interface with the native WebUI component for LogBuffer events. The functions
53 // contained in this object will be invoked by the browser for each operation
54 // performed on the native LogBuffer.
55 LogBufferInterface = {
57 * Called when a new log message is added.
58 * @type {function(LogMessage)}
60 onLogMessageAdded: function(log) {},
63 * Called when the log buffer is cleared.
66 onLogBufferCleared: function() {},
69 * Called in response to chrome.send('getLogMessages') with the log messages
70 * currently in the buffer.
71 * @type {function(Array.<LogMessage>)}
73 onGotLogMessages: function(messages) {},