Index: netlog_viewer/sdch_view.js |
diff --git a/netlog_viewer/sdch_view.js b/netlog_viewer/sdch_view.js |
index 59ac07bea8886e3b718adeec36a5db691a035958..1dd40e46b8eebc9517c5065e7a1e3b37c6b08828 100644 |
--- a/netlog_viewer/sdch_view.js |
+++ b/netlog_viewer/sdch_view.js |
@@ -34,8 +34,9 @@ var SdchView = (function() { |
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'; |
+ SdchView.BLACKLIST_TBODY_ID = 'sdch-view-blacklist-tbody'; |
+ SdchView.NUM_DICTIONARIES_LOADED_ID = 'sdch-view-num-dictionaries-loaded'; |
+ SdchView.DICTIONARIES_TBODY_ID = 'sdch-view-dictionaries-tbody'; |
cr.addSingletonGetter(SdchView); |
@@ -50,9 +51,43 @@ var SdchView = (function() { |
onSdchInfoChanged: function(sdchInfo) { |
if (!sdchInfo || typeof(sdchInfo.sdch_enabled) === 'undefined') |
return false; |
- // TODO(rayraymond): Update DOM without use of jstemplate. |
- // var input = new JsEvalContext(sdchInfo); |
- // jstProcess(input, $(SdchView.MAIN_BOX_ID)); |
+ |
+ $(SdchView.SDCH_ENABLED_SPAN_ID).textContent = |
+ !!sdchInfo.sdch_enabled; |
+ |
+ $(SdchView.NUM_DICTIONARIES_LOADED_ID).textContent = |
+ sdchInfo.dictionaries.length; |
+ |
+ var tbodyDictionaries = $(SdchView.DICTIONARIES_TBODY_ID); |
+ tbodyDictionaries.innerHTML = ''; |
+ |
+ // Fill in the dictionaries table. |
+ for (var i = 0; i < sdchInfo.dictionaries.length; ++i) { |
+ var d = sdchInfo.dictionaries[i]; |
+ var tr = addNode(tbodyDictionaries, 'tr'); |
+ |
+ addNodeWithText(tr, 'td', d.domain); |
+ addNodeWithText(tr, 'td', d.path); |
+ addNodeWithText(tr, 'td', |
+ d.ports ? d.ports.join(', ') : ''); |
+ addNodeWithText(tr, 'td', d.server_hash); |
+ addNodeWithText(tr, 'td', d.client_hash); |
+ addNodeWithText(tr, 'td', d.url); |
+ } |
+ |
+ var tbodyBlacklist = $(SdchView.BLACKLIST_TBODY_ID); |
+ tbodyBlacklist.innerHTML = ''; |
+ |
+ // Fill in the blacklisted table. |
+ for (var i = 0; i < sdchInfo.blacklisted.length; ++i) { |
+ var b = sdchInfo.blacklisted[i]; |
+ var tr = addNode(tbodyBlacklist, 'tr'); |
+ |
+ addNodeWithText(tr, 'td', d.domain); |
+ addNodeWithText(tr, 'td', d.sdchProblemCodeToString(reason)); |
+ addNodeWithText(tr, 'td', d.tries); |
+ } |
+ |
return true; |
}, |
}; |