| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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 information related to SDCH. | |
| 7 * | |
| 8 * Shows loaded dictionaries, blacklisted domains and SDCH errors. | |
| 9 */ | |
| 10 var SdchView = (function() { | |
| 11 'use strict'; | |
| 12 | |
| 13 // We inherit from DivView. | |
| 14 var superClass = DivView; | |
| 15 | |
| 16 /** | |
| 17 * @constructor | |
| 18 */ | |
| 19 function SdchView() { | |
| 20 assertFirstConstructorCall(SdchView); | |
| 21 | |
| 22 // Call superclass's constructor. | |
| 23 superClass.call(this, SdchView.MAIN_BOX_ID); | |
| 24 | |
| 25 // Register to receive changes to the SDCH info. | |
| 26 g_browser.addSdchInfoObserver(this, false); | |
| 27 } | |
| 28 | |
| 29 SdchView.TAB_ID = 'tab-handle-sdch'; | |
| 30 SdchView.TAB_NAME = 'SDCH'; | |
| 31 SdchView.TAB_HASH = '#sdch'; | |
| 32 | |
| 33 // IDs for special HTML elements in sdch_view.html | |
| 34 SdchView.MAIN_BOX_ID = 'sdch-view-tab-content'; | |
| 35 SdchView.SDCH_ENABLED_SPAN_ID = 'sdch-view-sdch-enabled'; | |
| 36 SdchView.SECURE_SCHEME_SUPPORT_SPAN_ID = 'sdch-view-secure-scheme-support'; | |
| 37 SdchView.BLACKLIST_TBODY_ID = 'sdch-view-blacklist-body'; | |
| 38 SdchView.DICTIONARIES_TBODY_ID = 'sdch-view-dictionaries-body'; | |
| 39 | |
| 40 cr.addSingletonGetter(SdchView); | |
| 41 | |
| 42 SdchView.prototype = { | |
| 43 // Inherit the superclass's methods. | |
| 44 __proto__: superClass.prototype, | |
| 45 | |
| 46 onLoadLogFinish: function(data) { | |
| 47 return this.onSdchInfoChanged(data.sdchInfo); | |
| 48 }, | |
| 49 | |
| 50 onSdchInfoChanged: function(sdchInfo) { | |
| 51 if (!sdchInfo || typeof(sdchInfo.sdch_enabled) === 'undefined') | |
| 52 return false; | |
| 53 var input = new JsEvalContext(sdchInfo); | |
| 54 jstProcess(input, $(SdchView.MAIN_BOX_ID)); | |
| 55 return true; | |
| 56 }, | |
| 57 }; | |
| 58 | |
| 59 return SdchView; | |
| 60 })(); | |
| OLD | NEW |