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

Unified Diff: netlog_viewer/http_cache_view.js

Issue 2154753002: Serving version 1 of the web app. All code has been copied from the (Closed) Base URL: https://github.com/catapult-project/catapult.git@gh-pages
Patch Set: Removed some unecessary files. Created 4 years, 5 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 | « netlog_viewer/http_cache_view.html ('k') | netlog_viewer/import_view.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: netlog_viewer/http_cache_view.js
diff --git a/netlog_viewer/http_cache_view.js b/netlog_viewer/http_cache_view.js
new file mode 100644
index 0000000000000000000000000000000000000000..9031459076ffa621eccce13ece34cf4c0cdb346c
--- /dev/null
+++ b/netlog_viewer/http_cache_view.js
@@ -0,0 +1,65 @@
+// Copyright (c) 2011 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.
+ */
+var HttpCacheView = (function() {
+ 'use strict';
+
+ // We inherit from DivView.
+ var superClass = DivView;
+
+ /**
+ * @constructor
+ */
+ function HttpCacheView() {
+ assertFirstConstructorCall(HttpCacheView);
+
+ // Call superclass's constructor.
+ superClass.call(this, HttpCacheView.MAIN_BOX_ID);
+
+ this.statsDiv_ = $(HttpCacheView.STATS_DIV_ID);
+
+ // Register to receive http cache info.
+ g_browser.addHttpCacheInfoObserver(this, true);
+ }
+
+ HttpCacheView.TAB_ID = 'tab-handle-http-cache';
+ HttpCacheView.TAB_NAME = 'Cache';
+ HttpCacheView.TAB_HASH = '#httpCache';
+
+ // IDs for special HTML elements in http_cache_view.html
+ HttpCacheView.MAIN_BOX_ID = 'http-cache-view-tab-content';
+ HttpCacheView.STATS_DIV_ID = 'http-cache-view-cache-stats';
+
+ cr.addSingletonGetter(HttpCacheView);
+
+ HttpCacheView.prototype = {
+ // Inherit the superclass's methods.
+ __proto__: superClass.prototype,
+
+ onLoadLogFinish: function(data) {
+ return this.onHttpCacheInfoChanged(data.httpCacheInfo);
+ },
+
+ onHttpCacheInfoChanged: function(info) {
+ this.statsDiv_.innerHTML = '';
+
+ if (!info)
+ return false;
+
+ // 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]);
+ }
+ return true;
+ }
+ };
+
+ return HttpCacheView;
+})();
+
« no previous file with comments | « netlog_viewer/http_cache_view.html ('k') | netlog_viewer/import_view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698