| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 10 |
| 11 * @constructor | 11 * @constructor |
| 12 */ | 12 */ |
| 13 function HSTSView(mainBoxId, queryInputId, formId, queryOutputDivId, | 13 function HSTSView(mainBoxId, queryInputId, formId, queryOutputDivId, |
| 14 addInputId, addFormId, addCheckId, | 14 addInputId, addFormId, addCheckId, addPinsId, |
| 15 deleteInputId, deleteFormId) { | 15 deleteInputId, deleteFormId) { |
| 16 DivView.call(this, mainBoxId); | 16 DivView.call(this, mainBoxId); |
| 17 | 17 |
| 18 this.queryInput_ = document.getElementById(queryInputId); | 18 this.queryInput_ = document.getElementById(queryInputId); |
| 19 this.addCheck_ = document.getElementById(addCheckId); | 19 this.addCheck_ = document.getElementById(addCheckId); |
| 20 this.addInput_ = document.getElementById(addInputId); | 20 this.addInput_ = document.getElementById(addInputId); |
| 21 this.addPins_ = document.getElementById(addPinsId); |
| 21 this.deleteInput_ = document.getElementById(deleteInputId); | 22 this.deleteInput_ = document.getElementById(deleteInputId); |
| 22 this.queryOutputDiv_ = document.getElementById(queryOutputDivId); | 23 this.queryOutputDiv_ = document.getElementById(queryOutputDivId); |
| 23 | 24 |
| 24 var form = document.getElementById(formId); | 25 var form = document.getElementById(formId); |
| 25 form.addEventListener('submit', this.onSubmitQuery_.bind(this), false); | 26 form.addEventListener('submit', this.onSubmitQuery_.bind(this), false); |
| 26 form = document.getElementById(addFormId); | 27 form = document.getElementById(addFormId); |
| 27 form.addEventListener('submit', this.onSubmitAdd_.bind(this), false); | 28 form.addEventListener('submit', this.onSubmitAdd_.bind(this), false); |
| 28 form = document.getElementById(deleteFormId); | 29 form = document.getElementById(deleteFormId); |
| 29 form.addEventListener('submit', this.onSubmitDelete_.bind(this), false); | 30 form.addEventListener('submit', this.onSubmitDelete_.bind(this), false); |
| 30 | 31 |
| 31 g_browser.addHSTSObserver(this); | 32 g_browser.addHSTSObserver(this); |
| 32 } | 33 } |
| 33 | 34 |
| 34 inherits(HSTSView, DivView); | 35 inherits(HSTSView, DivView); |
| 35 | 36 |
| 36 HSTSView.prototype.onSubmitQuery_ = function(event) { | 37 HSTSView.prototype.onSubmitQuery_ = function(event) { |
| 37 g_browser.sendHSTSQuery(this.queryInput_.value); | 38 g_browser.sendHSTSQuery(this.queryInput_.value); |
| 38 event.preventDefault(); | 39 event.preventDefault(); |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 HSTSView.prototype.onSubmitAdd_ = function(event) { | 42 HSTSView.prototype.onSubmitAdd_ = function(event) { |
| 42 g_browser.sendHSTSAdd(this.addInput_.value, this.addCheck_.checked); | 43 g_browser.sendHSTSAdd(this.addInput_.value, |
| 44 this.addCheck_.checked, |
| 45 this.addPins_.value); |
| 43 g_browser.sendHSTSQuery(this.addInput_.value); | 46 g_browser.sendHSTSQuery(this.addInput_.value); |
| 44 this.queryInput_.value = this.addInput_.value; | 47 this.queryInput_.value = this.addInput_.value; |
| 45 this.addCheck_.checked = false; | 48 this.addCheck_.checked = false; |
| 46 this.addInput_.value = ''; | 49 this.addInput_.value = ''; |
| 50 this.addPins_.value = ''; |
| 47 event.preventDefault(); | 51 event.preventDefault(); |
| 48 }; | 52 }; |
| 49 | 53 |
| 50 HSTSView.prototype.onSubmitDelete_ = function(event) { | 54 HSTSView.prototype.onSubmitDelete_ = function(event) { |
| 51 g_browser.sendHSTSDelete(this.deleteInput_.value); | 55 g_browser.sendHSTSDelete(this.deleteInput_.value); |
| 52 this.deleteInput_.value = ''; | 56 this.deleteInput_.value = ''; |
| 53 event.preventDefault(); | 57 event.preventDefault(); |
| 54 }; | 58 }; |
| 55 | 59 |
| 56 function hstsModeToString(m) { | 60 function hstsModeToString(m) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 addTextNode(this.queryOutputDiv_, ' domain:'); | 111 addTextNode(this.queryOutputDiv_, ' domain:'); |
| 108 | 112 |
| 109 t = addNode(this.queryOutputDiv_, 'tt'); | 113 t = addNode(this.queryOutputDiv_, 'tt'); |
| 110 t.innerText = result.domain; | 114 t.innerText = result.domain; |
| 111 | 115 |
| 112 addTextNode(this.queryOutputDiv_, ' is_preloaded:'); | 116 addTextNode(this.queryOutputDiv_, ' is_preloaded:'); |
| 113 | 117 |
| 114 t = addNode(this.queryOutputDiv_, 'tt'); | 118 t = addNode(this.queryOutputDiv_, 'tt'); |
| 115 t.innerText = result.preloaded; | 119 t.innerText = result.preloaded; |
| 116 | 120 |
| 121 addTextNode(this.queryOutputDiv_, ' cert_pins:'); |
| 122 |
| 123 t = addNode(this.queryOutputDiv_, 'tt'); |
| 124 t.innerText = result.cert_pins; |
| 125 |
| 117 yellowFade(this.queryOutputDiv_); | 126 yellowFade(this.queryOutputDiv_); |
| 118 } | 127 } |
| OLD | NEW |