- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / resources / net_internals / quic_view.js
1 // Copyright (c) 2013 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 QUIC session, and
7  * has links to display them in the events tab.
8  */
9 var QuicView = (function() {
10   'use strict';
11
12   // We inherit from DivView.
13   var superClass = DivView;
14
15   /**
16    * @constructor
17    */
18   function QuicView() {
19     assertFirstConstructorCall(QuicView);
20
21     // Call superclass's constructor.
22     superClass.call(this, QuicView.MAIN_BOX_ID);
23
24     g_browser.addQuicInfoObserver(this, true);
25   }
26
27   QuicView.TAB_ID = 'tab-handle-quic';
28   QuicView.TAB_NAME = 'QUIC';
29   QuicView.TAB_HASH = '#quic';
30
31   // IDs for special HTML elements in quic_view.html
32   QuicView.MAIN_BOX_ID = 'quic-view-tab-content';
33
34   cr.addSingletonGetter(QuicView);
35
36   QuicView.prototype = {
37     // Inherit the superclass's methods.
38     __proto__: superClass.prototype,
39
40     onLoadLogFinish: function(data) {
41       return this.onQuicInfoChanged(data.quicInfo);
42     },
43
44     /**
45      * If there are any sessions, display a single table with
46      * information on each QUIC session.  Otherwise, displays "None".
47      */
48     onQuicInfoChanged: function(quicInfo) {
49       if (!quicInfo)
50         return false;
51       var input = new JsEvalContext(quicInfo);
52       jstProcess(input, $(QuicView.MAIN_BOX_ID));
53       return true;
54     },
55   };
56
57   return QuicView;
58 })();