Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: netlog_viewer/sdch_view.js

Issue 2178423002: Bring the gh-pages branch up to date with the master branch (Closed) Base URL: https://github.com/catapult-project/catapult.git@gh-pages
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « netlog_viewer/sdch_view.html ('k') | netlog_viewer/sockets_view.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * This view displays information related to SDCH. 6 * This view displays information related to SDCH.
7 * 7 *
8 * Shows loaded dictionaries, blacklisted domains and SDCH errors. 8 * Shows loaded dictionaries, blacklisted domains and SDCH errors.
9 */ 9 */
10 var SdchView = (function() { 10 var SdchView = (function() {
(...skipping 16 matching lines...) Expand all
27 } 27 }
28 28
29 SdchView.TAB_ID = 'tab-handle-sdch'; 29 SdchView.TAB_ID = 'tab-handle-sdch';
30 SdchView.TAB_NAME = 'SDCH'; 30 SdchView.TAB_NAME = 'SDCH';
31 SdchView.TAB_HASH = '#sdch'; 31 SdchView.TAB_HASH = '#sdch';
32 32
33 // IDs for special HTML elements in sdch_view.html 33 // IDs for special HTML elements in sdch_view.html
34 SdchView.MAIN_BOX_ID = 'sdch-view-tab-content'; 34 SdchView.MAIN_BOX_ID = 'sdch-view-tab-content';
35 SdchView.SDCH_ENABLED_SPAN_ID = 'sdch-view-sdch-enabled'; 35 SdchView.SDCH_ENABLED_SPAN_ID = 'sdch-view-sdch-enabled';
36 SdchView.SECURE_SCHEME_SUPPORT_SPAN_ID = 'sdch-view-secure-scheme-support'; 36 SdchView.SECURE_SCHEME_SUPPORT_SPAN_ID = 'sdch-view-secure-scheme-support';
37 SdchView.BLACKLIST_TBODY_ID = 'sdch-view-blacklist-body'; 37 SdchView.BLACKLIST_TBODY_ID = 'sdch-view-blacklist-tbody';
38 SdchView.DICTIONARIES_TBODY_ID = 'sdch-view-dictionaries-body'; 38 SdchView.NUM_DICTIONARIES_LOADED_ID = 'sdch-view-num-dictionaries-loaded';
39 SdchView.DICTIONARIES_TBODY_ID = 'sdch-view-dictionaries-tbody';
39 40
40 cr.addSingletonGetter(SdchView); 41 cr.addSingletonGetter(SdchView);
41 42
42 SdchView.prototype = { 43 SdchView.prototype = {
43 // Inherit the superclass's methods. 44 // Inherit the superclass's methods.
44 __proto__: superClass.prototype, 45 __proto__: superClass.prototype,
45 46
46 onLoadLogFinish: function(data) { 47 onLoadLogFinish: function(data) {
47 return this.onSdchInfoChanged(data.sdchInfo); 48 return this.onSdchInfoChanged(data.sdchInfo);
48 }, 49 },
49 50
50 onSdchInfoChanged: function(sdchInfo) { 51 onSdchInfoChanged: function(sdchInfo) {
51 if (!sdchInfo || typeof(sdchInfo.sdch_enabled) === 'undefined') 52 if (!sdchInfo || typeof(sdchInfo.sdch_enabled) === 'undefined')
52 return false; 53 return false;
53 // TODO(rayraymond): Update DOM without use of jstemplate. 54
54 // var input = new JsEvalContext(sdchInfo); 55 $(SdchView.SDCH_ENABLED_SPAN_ID).textContent =
55 // jstProcess(input, $(SdchView.MAIN_BOX_ID)); 56 !!sdchInfo.sdch_enabled;
57
58 $(SdchView.NUM_DICTIONARIES_LOADED_ID).textContent =
59 sdchInfo.dictionaries.length;
60
61 var tbodyDictionaries = $(SdchView.DICTIONARIES_TBODY_ID);
62 tbodyDictionaries.innerHTML = '';
63
64 // Fill in the dictionaries table.
65 for (var i = 0; i < sdchInfo.dictionaries.length; ++i) {
66 var d = sdchInfo.dictionaries[i];
67 var tr = addNode(tbodyDictionaries, 'tr');
68
69 addNodeWithText(tr, 'td', d.domain);
70 addNodeWithText(tr, 'td', d.path);
71 addNodeWithText(tr, 'td',
72 d.ports ? d.ports.join(', ') : '');
73 addNodeWithText(tr, 'td', d.server_hash);
74 addNodeWithText(tr, 'td', d.client_hash);
75 addNodeWithText(tr, 'td', d.url);
76 }
77
78 var tbodyBlacklist = $(SdchView.BLACKLIST_TBODY_ID);
79 tbodyBlacklist.innerHTML = '';
80
81 // Fill in the blacklisted table.
82 for (var i = 0; i < sdchInfo.blacklisted.length; ++i) {
83 var b = sdchInfo.blacklisted[i];
84 var tr = addNode(tbodyBlacklist, 'tr');
85
86 addNodeWithText(tr, 'td', d.domain);
87 addNodeWithText(tr, 'td', d.sdchProblemCodeToString(reason));
88 addNodeWithText(tr, 'td', d.tries);
89 }
90
56 return true; 91 return true;
57 }, 92 },
58 }; 93 };
59 94
60 return SdchView; 95 return SdchView;
61 })(); 96 })();
62 97
OLDNEW
« no previous file with comments | « netlog_viewer/sdch_view.html ('k') | netlog_viewer/sockets_view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698