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