Index: netlog_viewer/spdy_view.js |
diff --git a/netlog_viewer/spdy_view.js b/netlog_viewer/spdy_view.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d07b2795d61f49389bdb8b380cc623b8c2a5a5eb |
--- /dev/null |
+++ b/netlog_viewer/spdy_view.js |
@@ -0,0 +1,76 @@ |
+// Copyright (c) 2012 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 a summary of the state of each SPDY sessions, and |
+ * has links to display them in the events tab. |
+ */ |
+var SpdyView = (function() { |
+ 'use strict'; |
+ |
+ // We inherit from DivView. |
+ var superClass = DivView; |
+ |
+ /** |
+ * @constructor |
+ */ |
+ function SpdyView() { |
+ assertFirstConstructorCall(SpdyView); |
+ |
+ // Call superclass's constructor. |
+ superClass.call(this, SpdyView.MAIN_BOX_ID); |
+ |
+ g_browser.addSpdySessionInfoObserver(this, true); |
+ g_browser.addSpdyStatusObserver(this, true); |
+ } |
+ |
+ SpdyView.TAB_ID = 'tab-handle-spdy'; |
+ SpdyView.TAB_NAME = 'HTTP/2'; |
+ SpdyView.TAB_HASH = '#http2'; |
+ |
+ // IDs for special HTML elements in spdy_view.html |
+ SpdyView.MAIN_BOX_ID = 'spdy-view-tab-content'; |
+ SpdyView.STATUS_ID = 'spdy-view-status'; |
+ SpdyView.SESSION_INFO_ID = 'spdy-view-session-info'; |
+ |
+ cr.addSingletonGetter(SpdyView); |
+ |
+ SpdyView.prototype = { |
+ // Inherit the superclass's methods. |
+ __proto__: superClass.prototype, |
+ |
+ onLoadLogFinish: function(data) { |
+ return this.onSpdySessionInfoChanged(data.spdySessionInfo) && |
+ this.onSpdyStatusChanged(data.spdyStatus); |
+ }, |
+ |
+ /** |
+ * If |spdySessionInfo| contains any sessions, displays a single table with |
+ * information on each SPDY session. Otherwise, displays "None". |
+ */ |
+ onSpdySessionInfoChanged: function(spdySessionInfo) { |
+ if (!spdySessionInfo) |
+ return false; |
+ // TODO(rayraymond): Update DOM without use of jstemplate. |
+ // var input = new JsEvalContext({ spdySessionInfo: spdySessionInfo }); |
+ // jstProcess(input, $(SpdyView.SESSION_INFO_ID)); |
+ return true; |
+ }, |
+ |
+ /** |
+ * Displays information on the global SPDY status. |
+ */ |
+ onSpdyStatusChanged: function(spdyStatus) { |
+ if (!spdyStatus) |
+ return false; |
+ // TODO(rayraymond): Update DOM without use of jstemplate. |
+ // var input = new JsEvalContext(spdyStatus); |
+ // jstProcess(input, $(SpdyView.STATUS_ID)); |
+ return true; |
+ } |
+ }; |
+ |
+ return SpdyView; |
+})(); |
+ |