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 the Alt-Svc mappings. |
| 7 */ |
| 8 var AltSvcView = (function() { |
| 9 'use strict'; |
| 10 |
| 11 // We inherit from DivView. |
| 12 var superClass = DivView; |
| 13 |
| 14 /** |
| 15 * @constructor |
| 16 */ |
| 17 function AltSvcView() { |
| 18 assertFirstConstructorCall(AltSvcView); |
| 19 |
| 20 // Call superclass's constructor. |
| 21 superClass.call(this, AltSvcView.MAIN_BOX_ID); |
| 22 |
| 23 g_browser.addAltSvcMappingsObserver(this, true); |
| 24 } |
| 25 |
| 26 AltSvcView.TAB_ID = 'tab-handle-alt-svc'; |
| 27 AltSvcView.TAB_NAME = 'Alt-Svc'; |
| 28 AltSvcView.TAB_HASH = '#alt-svc'; |
| 29 |
| 30 // IDs for special HTML elements in alt_svc_view.html |
| 31 AltSvcView.MAIN_BOX_ID = 'alt-svc-view-tab-content'; |
| 32 AltSvcView.ALTERNATE_PROTOCOL_MAPPINGS_ID = |
| 33 'alt-svc-view-alternate-protocol-mappings'; |
| 34 |
| 35 cr.addSingletonGetter(AltSvcView); |
| 36 |
| 37 AltSvcView.prototype = { |
| 38 // Inherit the superclass's methods. |
| 39 __proto__: superClass.prototype, |
| 40 |
| 41 onLoadLogFinish: function(data) { |
| 42 // TODO(rch): Remove the check for spdyAlternateProtocolMappings after |
| 43 // M53 (It was renamed to altSvcMappings in M50). |
| 44 return this.onAltSvcMappingsChanged(data.altSvcMappings || |
| 45 data.spdyAlternateProtocolMappings); |
| 46 }, |
| 47 |
| 48 /** |
| 49 * Displays the alternate service mappings. |
| 50 */ |
| 51 onAltSvcMappingsChanged: function(altSvcMappings) { |
| 52 if (!altSvcMappings) |
| 53 return false; |
| 54 // TODO(rayraymond): Update DOM without use of jstemplate. |
| 55 // var input = new JsEvalContext({altSvcMappings: altSvcMappings}); |
| 56 // jstProcess(input, $(AltSvcView.ALTERNATE_PROTOCOL_MAPPINGS_ID)); |
| 57 return true; |
| 58 } |
| 59 }; |
| 60 |
| 61 return AltSvcView; |
| 62 })(); |
OLD | NEW |