OLD | NEW |
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 t.textContent = result.domain; | 127 t.textContent = result.domain; |
128 | 128 |
129 addTextNode(this.queryOutputDiv_, ' is_preloaded:'); | 129 addTextNode(this.queryOutputDiv_, ' is_preloaded:'); |
130 | 130 |
131 t = addNode(this.queryOutputDiv_, 'tt'); | 131 t = addNode(this.queryOutputDiv_, 'tt'); |
132 t.textContent = result.preloaded; | 132 t.textContent = result.preloaded; |
133 | 133 |
134 addTextNode(this.queryOutputDiv_, ' pubkey_hashes:'); | 134 addTextNode(this.queryOutputDiv_, ' pubkey_hashes:'); |
135 | 135 |
136 t = addNode(this.queryOutputDiv_, 'tt'); | 136 t = addNode(this.queryOutputDiv_, 'tt'); |
| 137 |
137 // |public_key_hashes| is an old synonym for what is now | 138 // |public_key_hashes| is an old synonym for what is now |
138 // |preloaded_spki_hashes|. Look for both, and also for | 139 // |preloaded_spki_hashes|, which in turn is a legacy synonym for |
| 140 // |static_spki_hashes|. Look for all three, and also for |
139 // |dynamic_spki_hashes|. | 141 // |dynamic_spki_hashes|. |
140 if (typeof result.public_key_hashes === 'undefined') | 142 if (typeof result.public_key_hashes === 'undefined') |
141 result.public_key_hashes = ''; | 143 result.public_key_hashes = ''; |
142 if (typeof result.preloaded_spki_hashes === 'undefined') | 144 if (typeof result.preloaded_spki_hashes === 'undefined') |
143 result.preloaded_spki_hashes = ''; | 145 result.preloaded_spki_hashes = ''; |
| 146 if (typeof result.static_spki_hashes === 'undefined') |
| 147 result.static_spki_hashes = ''; |
144 if (typeof result.dynamic_spki_hashes === 'undefined') | 148 if (typeof result.dynamic_spki_hashes === 'undefined') |
145 result.dynamic_spki_hashes = ''; | 149 result.dynamic_spki_hashes = ''; |
146 | 150 |
147 var hashes = []; | 151 var hashes = []; |
148 if (result.public_key_hashes) | 152 if (result.public_key_hashes) |
149 hashes.push(result.public_key_hashes); | 153 hashes.push(result.public_key_hashes); |
150 if (result.preloaded_spki_hashes) | 154 if (result.preloaded_spki_hashes) |
151 hashes.push(result.preloaded_spki_hashes); | 155 hashes.push(result.preloaded_spki_hashes); |
| 156 if (result.static_spki_hashes) |
| 157 hashes.push(result.static_spki_hashes); |
152 if (result.dynamic_spki_hashes) | 158 if (result.dynamic_spki_hashes) |
153 hashes.push(result.dynamic_spki_hashes); | 159 hashes.push(result.dynamic_spki_hashes); |
154 | 160 |
155 t.textContent = hashes.join(','); | 161 t.textContent = hashes.join(','); |
156 yellowFade(this.queryOutputDiv_); | 162 yellowFade(this.queryOutputDiv_); |
157 } | 163 } |
158 }; | 164 }; |
159 | 165 |
160 function modeToString(m) { | 166 function modeToString(m) { |
| 167 // These numbers must match those in |
| 168 // TransportSecurityState::DomainState::UpgradeMode. |
161 if (m == 0) { | 169 if (m == 0) { |
162 return 'STRICT'; | 170 return 'STRICT'; |
163 } else if (m == 1) { | 171 } else if (m == 1) { |
164 return 'OPPORTUNISTIC'; | 172 return 'OPPORTUNISTIC'; |
165 } else if (m == 2) { | |
166 return 'SPDY'; | |
167 } else if (m == 3) { | |
168 return 'NONE'; | |
169 } else { | 173 } else { |
170 return 'UNKNOWN'; | 174 return 'UNKNOWN'; |
171 } | 175 } |
172 } | 176 } |
173 | 177 |
174 function yellowFade(element) { | 178 function yellowFade(element) { |
175 element.style.webkitTransitionProperty = 'background-color'; | 179 element.style.webkitTransitionProperty = 'background-color'; |
176 element.style.webkitTransitionDuration = '0'; | 180 element.style.webkitTransitionDuration = '0'; |
177 element.style.backgroundColor = '#fffccf'; | 181 element.style.backgroundColor = '#fffccf'; |
178 setTimeout(function() { | 182 setTimeout(function() { |
179 element.style.webkitTransitionDuration = '1000ms'; | 183 element.style.webkitTransitionDuration = '1000ms'; |
180 element.style.backgroundColor = '#fff'; | 184 element.style.backgroundColor = '#fff'; |
181 }, 0); | 185 }, 0); |
182 } | 186 } |
183 | 187 |
184 return HSTSView; | 188 return HSTSView; |
185 })(); | 189 })(); |
OLD | NEW |