1// Copyright (c) 2010 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. 4 5/** 6 * This view displays information on the HTTP cache. 7 * @constructor 8 */ 9function HttpCacheView(mainBoxId, statsDivId) { 10 DivView.call(this, mainBoxId); 11 12 this.statsDiv_ = document.getElementById(statsDivId); 13 14 // Register to receive http cache info. 15 g_browser.addHttpCacheInfoObserver(this); 16} 17 18inherits(HttpCacheView, DivView); 19 20HttpCacheView.prototype.onHttpCacheInfoChanged = function(info) { 21 this.statsDiv_.innerHTML = ''; 22 23 // Print the statistics. 24 var statsUl = addNode(this.statsDiv_, 'ul'); 25 for (var statName in info.stats) { 26 var li = addNode(statsUl, 'li'); 27 addTextNode(li, statName + ': ' + info.stats[statName]); 28 } 29}; 30 31