Check-in [16fd3e5408]
Overview
SHA1:16fd3e5408d2748d8fece94286e77919d37ccecb
Date: 2016-02-13 15:43:19
User: rkeene
Comment:ChromeOS: More work towards making the PIN entry more useful
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2016-02-15
05:16
[a655f43d3b] ChromeOS: Converted callback storage from an array to a hash, since we don't care about ordering (user: rkeene, tags: trunk)
2016-02-13
15:43
[16fd3e5408] ChromeOS: More work towards making the PIN entry more useful (user: rkeene, tags: trunk)
10:09
[78f6a43a4e] ChromeOS: Whitespace cleanup (user: rkeene, tags: trunk)
Changes

Modified build/chrome/cackey.js from [130898c1ff] to [7034902175].

    18     18    */
    19     19   var cackeyOutstandingCallbacks = []
    20     20   var cackeyOutstandingCallbackCounter = -1;
    21     21   
    22     22   /*
    23     23    * Communication with the PIN entry window
    24     24    */
    25         -var pinWindowDidWork = 0;
           25  +var pinWindowPINValue = "";
           26  +var pinWindowPreviousHandle = null;
    26     27   
    27     28   /*
    28     29    * Handle a response from the NaCl side regarding certificates available
    29     30    */
    30     31   function cackeyMessageIncomingListCertificates(message, chromeCallback) {
    31     32   	var idx;
    32     33   	var certificates = [];
................................................................................
    97     98   		case "error":
    98     99   			console.error("[cackey] Failed to execute command '" + messageEvent.data.command + "': " + messageEvent.data.error);
    99    100   
   100    101   			chromeCallback();
   101    102   
   102    103   			break;
   103    104   		case "retry":
   104         -			pinWindowDidWork = 0;
          105  +			pinWindowPINValue = "";
          106  +
          107  +			if (pinWindowPreviousHandle) {
          108  +				/*
          109  +				 * An existing PIN entry is in progress
          110  +				 * Wait for it to complete and tie this request to that one.
          111  +				 */
          112  +
          113  +				/* XXX:TODO */
          114  +			}
   105    115   
   106    116   			chrome.app.window.create("pin.html", {
   107    117   				"id": "cackeyPINEntry",
   108    118   				"resizable": false,
   109    119   				"alwaysOnTop": true,
   110    120   				"focused": true,
   111    121   				"visibleOnAllWorkspaces": true,
................................................................................
   118    128   			}, function(pinWindow) {
   119    129   				if (!pinWindow) {
   120    130   					console.log("[cackey] No window was provided for PIN entry, this will not go well.");
   121    131   
   122    132   					return;
   123    133   				}
   124    134   
          135  +				pinWindowPreviousHandle = pinWindow;
          136  +
   125    137   				pinWindow.drawAttention();
   126    138   				pinWindow.focus();
   127    139   
   128    140   				/*
   129    141   				 * Register a handler to handle the window being closed without
   130    142   				 * having sent anything
   131    143   				 */
   132    144   				pinWindow.onClosed.addListener(function() {
   133         -					if (pinWindowDidWork != 1) {
          145  +					pinWindowPreviousHandle = null;
          146  +
          147  +					if (pinWindowPINValue == "") {
   134    148   						console.log("[cackey] The PIN dialog was closed without resubmitting the request, treating it as a failure");
   135    149   
   136    150   						messageEvent.data.status = "error";
   137    151   						messageEvent.data.error = "PIN window closed without a PIN being provided";
   138    152   
   139    153   						cackeyMessageIncoming(messageEvent);
   140    154   					}
................................................................................
   172    186   	}
   173    187   
   174    188   	if (nextFunction != null) {
   175    189   		nextFunction(messageEvent.data, chromeCallback);
   176    190   	}
   177    191   
   178    192   	delete cackeyOutstandingCallbacks[messageEvent.data.id];
          193  +
          194  +	pinWindowPINValue = "";
   179    195   
   180    196   	return;
   181    197   }
   182    198   
   183    199   /*
   184    200    * Handler for messages from Chrome related to listing certificates
   185    201    */

Modified build/chrome/pin.js from [73ed093e1a] to [6612ae670c].

     1      1   function clickOk() {
     2         -
     3         -	parentWindow.pinWindowDidWork = 1;
            2  +	parentWindow.pinWindowPINValue = document.getElementById('pin').value;
     4      3   
     5      4   	window.close();
     6      5   
     7      6   	return;
     8      7   }
     9      8   
    10      9   function clickCancel() {