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

Unified Diff: chrome/browser/resources/net_internals/httpcacheview.js

Issue 2011009: Add the http cache info to chrome://net2. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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
« no previous file with comments | « chrome/browser/dom_ui/net_internals_ui.cc ('k') | chrome/browser/resources/net_internals/index.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/net_internals/httpcacheview.js
===================================================================
--- chrome/browser/resources/net_internals/httpcacheview.js (revision 0)
+++ chrome/browser/resources/net_internals/httpcacheview.js (revision 0)
@@ -0,0 +1,52 @@
+// Copyright (c) 2010 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.
+
+/**
+ * This view displays information on the HTTP cache.
+ * @constructor
+ */
+function HttpCacheView(mainBoxId, reloadButtonId, statsDivId,
+ entryListingDivId) {
+ DivView.call(this, mainBoxId);
+
+ var reloadButton = document.getElementById(reloadButtonId);
+ reloadButton.onclick = this.reloadListing_.bind(this);
+
+ this.statsDiv_ = document.getElementById(statsDivId);
+ this.entryListingDiv_ = document.getElementById(entryListingDivId);
+
+ // Register to receive http cache info.
+ g_browser.addHttpCacheInfoObserver(this);
+}
+
+inherits(HttpCacheView, DivView);
+
+HttpCacheView.prototype.onHttpCacheInfoReceived = function(info) {
+ this.entryListingDiv_.innerHTML = '';
+ this.statsDiv_.innerHTML = '';
+
+ // Print the statistics.
+ var statsUl = addNode(this.statsDiv_, 'ul');
+ for (var statName in info.stats) {
+ var li = addNode(statsUl, 'li');
+ addTextNode(li, statName + ': ' + info.stats[statName]);
+ }
+
+ // Print the entries.
+ var keysOl = addNode(this.entryListingDiv_, 'ol');
+ for (var i = 0; i < info.keys.length; ++i) {
+ var key = info.keys[i];
+ var li = addNode(keysOl, 'li');
+ var a = addNode(li, 'a');
+ addTextNode(a, key);
+ a.href = 'chrome://net-internals/view-cache/' + key;
+ a.target = '_blank';
+ }
+};
+
+HttpCacheView.prototype.reloadListing_ = function() {
+ this.entryListingDiv_.innerHTML = 'Loading...';
+ this.statsDiv_.innerHTML = 'Loading...';
+ g_browser.sendGetHttpCacheInfo();
+};
« no previous file with comments | « chrome/browser/dom_ui/net_internals_ui.cc ('k') | chrome/browser/resources/net_internals/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698