Chromium Code Reviews| Index: chrome/browser/resources/net_internals/sdch_view.js |
| diff --git a/chrome/browser/resources/net_internals/sdch_view.js b/chrome/browser/resources/net_internals/sdch_view.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9828ae368d936c7ef4894210762c3f04e263c6a7 |
| --- /dev/null |
| +++ b/chrome/browser/resources/net_internals/sdch_view.js |
| @@ -0,0 +1,60 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * This view displays information related to SDCH. |
| + * |
| + * Shows loaded dictionaries, blacklisted domains and SDCH errors. |
| + */ |
| +var SdchView = (function() { |
| + 'use strict'; |
| + |
| + // We inherit from DivView. |
| + var superClass = DivView; |
| + |
| + /** |
| + * @constructor |
| + */ |
| + function SdchView() { |
| + assertFirstConstructorCall(SdchView); |
| + |
| + // Call superclass's constructor. |
| + superClass.call(this, SdchView.MAIN_BOX_ID); |
| + |
| + // Register to receive changes to the SDCH info. |
| + g_browser.addSdchInfoObserver(this, false); |
| + } |
| + |
| + SdchView.TAB_ID = 'tab-handle-sdch'; |
| + SdchView.TAB_NAME = 'SDCH'; |
| + SdchView.TAB_HASH = '#sdch'; |
| + |
| + // IDs for special HTML elements in sdch_view.html |
| + SdchView.MAIN_BOX_ID = 'sdch-view-tab-content'; |
| + SdchView.SDCH_ENABLED_SPAN_ID = 'sdch-view-sdch-enabled'; |
| + SdchView.SECURE_SCHEME_SUPPORT_SPAN_ID = 'sdch-view-secure-scheme-support'; |
| + SdchView.BLACKLIST_TBODY_ID = 'sdch-view-blacklist-body'; |
| + SdchView.DICTIONARIES_TBODY_ID = 'sdch-view-dictionaries-body'; |
| + |
| + cr.addSingletonGetter(SdchView); |
| + |
| + SdchView.prototype = { |
| + // Inherit the superclass's methods. |
| + __proto__: superClass.prototype, |
| + |
| + onLoadLogFinish: function(data) { |
| + return this.onSdchInfoChanged(data.sdchInfo); |
| + }, |
| + |
| + onSdchInfoChanged: function(sdchInfo) { |
| + if (!sdchInfo) |
|
mmenke
2014/10/30 21:18:52
Since sdchInfo can be an empty dictionary now, thi
baranovich
2014/10/31 19:55:32
Done.
|
| + return false; |
| + var input = new JsEvalContext(sdchInfo); |
| + jstProcess(input, $(SdchView.MAIN_BOX_ID)); |
| + return true; |
| + }, |
| + }; |
| + |
| + return SdchView; |
| +})(); |