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.
6 * This view displays information related to SDCH.
8 * Shows loaded dictionaries, blacklisted domains and SDCH errors.
10 var SdchView = (function() {
13 // We inherit from DivView.
14 var superClass = DivView;
20 assertFirstConstructorCall(SdchView);
22 // Call superclass's constructor.
23 superClass.call(this, SdchView.MAIN_BOX_ID);
25 // Register to receive changes to the SDCH info.
26 g_browser.addSdchInfoObserver(this, false);
29 SdchView.TAB_ID = 'tab-handle-sdch';
30 SdchView.TAB_NAME = 'SDCH';
31 SdchView.TAB_HASH = '#sdch';
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';
40 cr.addSingletonGetter(SdchView);
42 SdchView.prototype = {
43 // Inherit the superclass's methods.
44 __proto__: superClass.prototype,
46 onLoadLogFinish: function(data) {
47 return this.onSdchInfoChanged(data.sdchInfo);
50 onSdchInfoChanged: function(sdchInfo) {
51 if (!sdchInfo || typeof(sdchInfo.sdch_enabled) === 'undefined')
53 var input = new JsEvalContext(sdchInfo);
54 jstProcess(input, $(SdchView.MAIN_BOX_ID));