OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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 a summary of the state of each SPDY sessions, and |
| 7 * has links to display them in the events tab. |
| 8 */ |
| 9 var SpdyView = (function() { |
| 10 'use strict'; |
| 11 |
| 12 // We inherit from DivView. |
| 13 var superClass = DivView; |
| 14 |
| 15 /** |
| 16 * @constructor |
| 17 */ |
| 18 function SpdyView() { |
| 19 assertFirstConstructorCall(SpdyView); |
| 20 |
| 21 // Call superclass's constructor. |
| 22 superClass.call(this, SpdyView.MAIN_BOX_ID); |
| 23 |
| 24 g_browser.addSpdySessionInfoObserver(this, true); |
| 25 g_browser.addSpdyStatusObserver(this, true); |
| 26 } |
| 27 |
| 28 SpdyView.TAB_ID = 'tab-handle-spdy'; |
| 29 SpdyView.TAB_NAME = 'HTTP/2'; |
| 30 SpdyView.TAB_HASH = '#http2'; |
| 31 |
| 32 // IDs for special HTML elements in spdy_view.html |
| 33 SpdyView.MAIN_BOX_ID = 'spdy-view-tab-content'; |
| 34 SpdyView.STATUS_ID = 'spdy-view-status'; |
| 35 SpdyView.SESSION_INFO_ID = 'spdy-view-session-info'; |
| 36 |
| 37 cr.addSingletonGetter(SpdyView); |
| 38 |
| 39 SpdyView.prototype = { |
| 40 // Inherit the superclass's methods. |
| 41 __proto__: superClass.prototype, |
| 42 |
| 43 onLoadLogFinish: function(data) { |
| 44 return this.onSpdySessionInfoChanged(data.spdySessionInfo) && |
| 45 this.onSpdyStatusChanged(data.spdyStatus); |
| 46 }, |
| 47 |
| 48 /** |
| 49 * If |spdySessionInfo| contains any sessions, displays a single table with |
| 50 * information on each SPDY session. Otherwise, displays "None". |
| 51 */ |
| 52 onSpdySessionInfoChanged: function(spdySessionInfo) { |
| 53 if (!spdySessionInfo) |
| 54 return false; |
| 55 // TODO(rayraymond): Update DOM without use of jstemplate. |
| 56 // var input = new JsEvalContext({ spdySessionInfo: spdySessionInfo }); |
| 57 // jstProcess(input, $(SpdyView.SESSION_INFO_ID)); |
| 58 return true; |
| 59 }, |
| 60 |
| 61 /** |
| 62 * Displays information on the global SPDY status. |
| 63 */ |
| 64 onSpdyStatusChanged: function(spdyStatus) { |
| 65 if (!spdyStatus) |
| 66 return false; |
| 67 // TODO(rayraymond): Update DOM without use of jstemplate. |
| 68 // var input = new JsEvalContext(spdyStatus); |
| 69 // jstProcess(input, $(SpdyView.STATUS_ID)); |
| 70 return true; |
| 71 } |
| 72 }; |
| 73 |
| 74 return SpdyView; |
| 75 })(); |
| 76 |
OLD | NEW |