| 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 cr.define('cert_viewer', function() { | 5 cr.define('cert_viewer', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Initialize the certificate viewer dialog by wiring up the close button, | 9 * Initialize the certificate viewer dialog by wiring up the close button, |
| 10 * substituting in translated strings and requesting certificate details. | 10 * substituting in translated strings and requesting certificate details. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 setTimeout(initializeDetailTab, 200); | 39 setTimeout(initializeDetailTab, 200); |
| 40 | 40 |
| 41 $('tabbox').addEventListener('selectedChange', function f(e) { | 41 $('tabbox').addEventListener('selectedChange', function f(e) { |
| 42 $('tabbox').removeEventListener('selectedChange', f); | 42 $('tabbox').removeEventListener('selectedChange', f); |
| 43 initializeDetailTab(); | 43 initializeDetailTab(); |
| 44 }, true); | 44 }, true); |
| 45 | 45 |
| 46 stripGtkAccessorKeys(); | 46 stripGtkAccessorKeys(); |
| 47 | 47 |
| 48 $('export').onclick = exportCertificate; | 48 $('export').onclick = exportCertificate; |
| 49 | |
| 50 // TODO(kochi): ESC key should be handled in the views window side. | |
| 51 document.addEventListener('keydown', function(e) { | |
| 52 if (e.keyCode == 27) // ESC | |
| 53 chrome.send('DialogClose'); | |
| 54 }); | |
| 55 } | 49 } |
| 56 | 50 |
| 57 /** | 51 /** |
| 58 * Decorate a function so that it can only be invoked once. | 52 * Decorate a function so that it can only be invoked once. |
| 59 */ | 53 */ |
| 60 function oneShot(fn) { | 54 function oneShot(fn) { |
| 61 var fired = false; | 55 var fired = false; |
| 62 return function() { | 56 return function() { |
| 63 if (fired) return; | 57 if (fired) return; |
| 64 fired = true; | 58 fired = true; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 chrome.send('exportCertificate', [item.detail.payload.index]); | 204 chrome.send('exportCertificate', [item.detail.payload.index]); |
| 211 } | 205 } |
| 212 | 206 |
| 213 return { | 207 return { |
| 214 initialize: initialize, | 208 initialize: initialize, |
| 215 getCertificateFields: getCertificateFields, | 209 getCertificateFields: getCertificateFields, |
| 216 }; | 210 }; |
| 217 }); | 211 }); |
| 218 | 212 |
| 219 document.addEventListener('DOMContentLoaded', cert_viewer.initialize); | 213 document.addEventListener('DOMContentLoaded', cert_viewer.initialize); |
| OLD | NEW |