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

Side by Side Diff: chrome/browser/resources/net_internals/hsts_view.js

Issue 12974003: Improve TransportSecurityState data storage. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 * HSTS is HTTPS Strict Transport Security: a way for sites to elect to always 6 * HSTS is HTTPS Strict Transport Security: a way for sites to elect to always
7 * use HTTPS. See http://dev.chromium.org/sts 7 * use HTTPS. See http://dev.chromium.org/sts
8 * 8 *
9 * This UI allows a user to query and update the browser's list of HSTS domains. 9 * This UI allows a user to query and update the browser's list of HSTS domains.
10 * It also allows users to query and update the browser's list of public key 10 * It also allows users to query and update the browser's list of public key
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 if (result.result == false) { 105 if (result.result == false) {
106 this.queryOutputDiv_.innerHTML = '<b>Not found</b>'; 106 this.queryOutputDiv_.innerHTML = '<b>Not found</b>';
107 yellowFade(this.queryOutputDiv_); 107 yellowFade(this.queryOutputDiv_);
108 return; 108 return;
109 } 109 }
110 110
111 this.queryOutputDiv_.innerHTML = ''; 111 this.queryOutputDiv_.innerHTML = '';
112 112
113 var s = addNode(this.queryOutputDiv_, 'span'); 113 var s = addNode(this.queryOutputDiv_, 'span');
114 s.innerHTML = '<b>Found</b>: mode: '; 114 s.innerHTML = '<b>Found</b>: ';
115 115
116 var t = addNode(this.queryOutputDiv_, 'tt'); 116 var propertyNamesToDisplay = ['HSTS', 'Public_Key_Pins_Good',
117 t.textContent = modeToString(result.mode); 117 'Public_Key_Pins_Bad'];
118 118
119 addTextNode(this.queryOutputDiv_, ' include_subdomains:'); 119 for (var i = 0; i < propertyNamesToDisplay.length; ++i) {
120 120 var propName = propertyNamesToDisplay[i];
121 t = addNode(this.queryOutputDiv_, 'tt'); 121 var prop = result[propName];
122 t.textContent = result.subdomains; 122 if (prop != undefined) {
123 123 addTextNode(this.queryOutputDiv_, ' ' + propName + ':');
124 addTextNode(this.queryOutputDiv_, ' domain:'); 124 var t = addNode(this.queryOutputDiv_, 'tt');
125 125 t.textContent = prop;
126 t = addNode(this.queryOutputDiv_, 'tt'); 126 }
127 t.textContent = result.domain; 127 }
128
129 addTextNode(this.queryOutputDiv_, ' pubkey_hashes:');
130
131 t = addNode(this.queryOutputDiv_, 'tt');
132
133 // |public_key_hashes| is an old synonym for what is now
134 // |preloaded_spki_hashes|, which in turn is a legacy synonym for
135 // |static_spki_hashes|. Look for all three, and also for
136 // |dynamic_spki_hashes|.
137 if (typeof result.public_key_hashes === 'undefined')
138 result.public_key_hashes = '';
139 if (typeof result.preloaded_spki_hashes === 'undefined')
140 result.preloaded_spki_hashes = '';
141 if (typeof result.static_spki_hashes === 'undefined')
142 result.static_spki_hashes = '';
143 if (typeof result.dynamic_spki_hashes === 'undefined')
144 result.dynamic_spki_hashes = '';
145
146 var hashes = [];
147 if (result.public_key_hashes)
148 hashes.push(result.public_key_hashes);
149 if (result.preloaded_spki_hashes)
150 hashes.push(result.preloaded_spki_hashes);
151 if (result.static_spki_hashes)
152 hashes.push(result.static_spki_hashes);
153 if (result.dynamic_spki_hashes)
154 hashes.push(result.dynamic_spki_hashes);
155
156 t.textContent = hashes.join(',');
157 yellowFade(this.queryOutputDiv_); 128 yellowFade(this.queryOutputDiv_);
158 } 129 }
159 }; 130 };
160 131
161 function modeToString(m) {
162 // These numbers must match those in
163 // TransportSecurityState::DomainState::UpgradeMode.
164 if (m == 0) {
165 return 'STRICT';
166 } else if (m == 1) {
167 return 'OPPORTUNISTIC';
168 } else {
169 return 'UNKNOWN';
170 }
171 }
172
173 function yellowFade(element) { 132 function yellowFade(element) {
174 element.style.webkitTransitionProperty = 'background-color'; 133 element.style.webkitTransitionProperty = 'background-color';
175 element.style.webkitTransitionDuration = '0'; 134 element.style.webkitTransitionDuration = '0';
176 element.style.backgroundColor = '#fffccf'; 135 element.style.backgroundColor = '#fffccf';
177 setTimeout(function() { 136 setTimeout(function() {
178 element.style.webkitTransitionDuration = '1000ms'; 137 element.style.webkitTransitionDuration = '1000ms';
179 element.style.backgroundColor = '#fff'; 138 element.style.backgroundColor = '#fff';
180 }, 0); 139 }, 0);
181 } 140 }
182 141
183 return HSTSView; 142 return HSTSView;
184 })(); 143 })();
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_io_data.cc ('k') | chrome/browser/ui/webui/net_internals/net_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698