Overview
Comment: | ChromeOS: Made PIN entry dialog much more robust |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
2c6a5fb7ddeccb1df5d9feb52202588b |
User & Date: | rkeene on 2016-02-13 10:05:49 |
Other Links: | manifest | tags |
Context
2016-02-13
| ||
10:08 | ChromeOS: Made PIN entry failure code slightly cleaner check-in: 233d1929c2 user: rkeene tags: trunk | |
10:05 | ChromeOS: Made PIN entry dialog much more robust check-in: 2c6a5fb7dd user: rkeene tags: trunk | |
07:19 | ChromeOS: Added start of PIN entry dialog check-in: 32182121df user: rkeene tags: trunk | |
Changes
Modified build/chrome/Makefile from [d4c1056478] to [1d85794fd7].
︙ | ︙ | |||
24 25 26 27 28 29 30 | ifeq (,${NACL_SDK_ROOT}) $(error "Please set NACL_SDK_ROOT") endif export NACL_SDK_ROOT all: cackey.crx | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | ifeq (,${NACL_SDK_ROOT}) $(error "Please set NACL_SDK_ROOT") endif export NACL_SDK_ROOT all: cackey.crx cackey.crx: cackey.pexe cackey.nmf manifest.json cackey.js google-pcsc.js pin.html pin.js pin-icon.png rm -f cackey.crx zip cackey.crx.new $^ mv cackey.crx.new cackey.crx cackey.pexe: cackey-chrome.o cackey-chrome-init.o lib/libcackey.a lib/libpcsc.a lib/libz.a $(CXX) $(CXXFLAGS) $(LDFLAGS) -o cackey.pexe.new cackey-chrome.o cackey-chrome-init.o $(LIBS) $(FINALIZE) cackey.pexe.new |
︙ | ︙ |
Modified build/chrome/cackey.js from [097e060f29] to [5dbcaf75a3].
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | /* * Handle and ID for outstanding callbacks */ var cackeyOutstandingCallbacks = [] var cackeyOutstandingCallbackCounter = -1; /* * Handle a response from the NaCl side regarding certificates available */ function cackeyMessageIncomingListCertificates(message, chromeCallback) { var idx; var certificates = []; | > > > > > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | /* * Handle and ID for outstanding callbacks */ var cackeyOutstandingCallbacks = [] var cackeyOutstandingCallbackCounter = -1; /* * Communication with the PIN entry window */ var pinWindowDidWork = 0; /* * Handle a response from the NaCl side regarding certificates available */ function cackeyMessageIncomingListCertificates(message, chromeCallback) { var idx; var certificates = []; |
︙ | ︙ | |||
84 85 86 87 88 89 90 | if (chromeCallback == null) { console.log("[cackey] Discarding outdated message"); return; } | | > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | > > | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | if (chromeCallback == null) { console.log("[cackey] Discarding outdated message"); return; } switch (messageEvent.data.status) { case "error": console.error("[cackey] Failed to execute command '" + messageEvent.data.command + "': " + messageEvent.data.error); chromeCallback(); break; case "retry": pinWindowDidWork = 0; chrome.app.window.create("pin.html", { "id": "cackeyPINEntry", "resizable": false, "alwaysOnTop": true, "focused": true, "visibleOnAllWorkspaces": true, "innerBounds": { "width": 350, "minWidth": 350, "height": 135, "minHeight": 135 } }, function(pinWindow) { if (!pinWindow) { console.log("[cackey] No window was provided for PIN entry, this will not go well."); return; } pinWindow.drawAttention(); pinWindow.focus(); /* * Register a handler to handle the window being closed without * having sent anything */ pinWindow.onClosed.addListener(function() { if (pinWindowDidWork != 1) { console.log("[cackey] The PIN dialog was closed without resubmitting the request, treating it as a failure"); cackeyMessageIncoming( { "data": { "target": "cackey", "command": messageEvent.data.command, "id": messageEvent.data.id, "status": "error", "error": "PIN window closed without a PIN being provided" } } ) } return; }) /* * Pass this message off to the other window so that it may resubmit the request. */ pinWindow.contentWindow.parentWindow = window; pinWindow.contentWindow.messageEvent = messageEvent; return; }); /* * We return here instead of break to avoid deleting the callback * entry. */ return; case "success": switch (messageEvent.data.command) { case "listcertificates": nextFunction = cackeyMessageIncomingListCertificates; break; case "sign": nextFunction = cackeyMessageIncomingSignMessage; break; } break; } if (nextFunction != null) { nextFunction(messageEvent.data, chromeCallback); } delete cackeyOutstandingCallbacks[messageEvent.data.id]; |
︙ | ︙ |
Modified build/chrome/pin.html from [fee4932709] to [80f230e669].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <html> <head> <title>CACKey PIN Entry</title> </head> <body bgcolor="#e4e4e4" color="#000000"> <form> <table width="100%" border="0" cellspacing="5" cellpadding="0"> <tr width="100%" align="left" valign="bottom"> <td rowspan="4"><img src="pin-icon.png" alt=""></td> </tr> <tr width="100%" align="left" valign="bottom"> <td></td> <td colspan="2"><div id="prompt" style="font-size: 0.8em;">PIN Entry Required</div></td> </tr> <tr width="100%" align="left" valign="center"> <td></td> <td>PIN:</td> | > > > > > > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | <html> <head> <title>CACKey PIN Entry</title> <style> body { margin: 0px; } </style> <script type="text/javascript" src="pin.js"></script> </head> <body bgcolor="#e4e4e4" color="#000000"> <form> <table width="100%" border="0" cellspacing="5" cellpadding="0"> <tr width="100%" align="left" valign="bottom"> <td rowspan="4"><img src="pin-icon.png" alt=""></td> </tr> <tr width="100%" align="left" valign="bottom"> <td></td> <td colspan="2"><div id="prompt" style="font-size: 0.8em;">PIN Entry Required</div></td> </tr> <tr width="100%" align="left" valign="center"> <td></td> <td>PIN:</td> <td><input type="password" name="pin" id="pin" style="width: 100%;" autofocus></td> </tr> <tr width="100%" align="right" valign="top"> <td></td> <td colspan="2"> <input type="button" class="button" name="ok" id="ok" value="OK" style="min-width: 4em;"> <input type="button" class="button" name="cancel" id="cancel" value="Cancel" style="min-width: 4em;"> </td> </tr> </table> </form> </body> </html> |
Added build/chrome/pin.js version [73ed093e1a].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | function clickOk() { parentWindow.pinWindowDidWork = 1; window.close(); return; } function clickCancel() { window.close(); return; } function focusPin() { window.focus(); document.getElementById('pin').focus(); return; } setTimeout(function() { var noFocusObjects, idx; document.getElementById('ok').onclick = function() { clickOk(); }; document.getElementById('cancel').onclick = function() { clickCancel(); }; window.onfocus = function() { focusPin(); } document.getElementById('pin').onblur = function() { setTimeout(function() { if (document.activeElement.className != "button") { focusPin(); } }, 1); } }, 1); |