1 <!DOCTYPE html> 2 <!-- 3 * Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this 4 * source code is governed by a BSD-style license that can be found in the 5 * LICENSE file. 6 --> 7 <html> 8 <head> 9 </head> 10 <body> 11 <script> 12 var history_log = []; 13 14 /** 15 * Stores a state every time an "active" event is sent, up to 20 items. 16 */ 17 chrome.idle.onStateChanged.addListener(function(newstate) { 18 var time = new Date(); 19 if (history_log.length >= 20) { 20 history_log.pop(); 21 } 22 history_log.unshift({'state':newstate, 'time':time}); 23 }); 24 25 /** 26 * Opens history.html when the browser action is clicked. 27 * Used window.open because I didn't want the tabs permission. 28 */ 29 chrome.browserAction.onClicked.addListener(function() { 30 window.open('history.html', 'testwindow', 'width=700,height=600'); 31 }); 32 </script> 33 </body> 34 </html> 35