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

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

18
19
20
21
22
23
24
25

26
27
28
29
30
31
32
 */
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 = [];







|
>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 */
var cackeyOutstandingCallbacks = []
var cackeyOutstandingCallbackCounter = -1;

/*
 * Communication with the PIN entry window
 */
var pinWindowPINValue = "";
var pinWindowPreviousHandle = null;

/*
 * Handle a response from the NaCl side regarding certificates available
 */
function cackeyMessageIncomingListCertificates(message, chromeCallback) {
	var idx;
	var certificates = [];
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
		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");

						messageEvent.data.status = "error";
						messageEvent.data.error = "PIN window closed without a PIN being provided";

						cackeyMessageIncoming(messageEvent);
					}







|
>
>
>
>
>
>
>
>
>




















>
>








>
>
|







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
		case "error":
			console.error("[cackey] Failed to execute command '" + messageEvent.data.command + "': " + messageEvent.data.error);

			chromeCallback();

			break;
		case "retry":
			pinWindowPINValue = "";

			if (pinWindowPreviousHandle) {
				/*
				 * An existing PIN entry is in progress
				 * Wait for it to complete and tie this request to that one.
				 */

				/* XXX:TODO */
			}

			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;
				}

				pinWindowPreviousHandle = pinWindow;

				pinWindow.drawAttention();
				pinWindow.focus();

				/*
				 * Register a handler to handle the window being closed without
				 * having sent anything
				 */
				pinWindow.onClosed.addListener(function() {
					pinWindowPreviousHandle = null;

					if (pinWindowPINValue == "") {
						console.log("[cackey] The PIN dialog was closed without resubmitting the request, treating it as a failure");

						messageEvent.data.status = "error";
						messageEvent.data.error = "PIN window closed without a PIN being provided";

						cackeyMessageIncoming(messageEvent);
					}
172
173
174
175
176
177
178


179
180
181
182
183
184
185
	}

	if (nextFunction != null) {
		nextFunction(messageEvent.data, chromeCallback);
	}

	delete cackeyOutstandingCallbacks[messageEvent.data.id];



	return;
}

/*
 * Handler for messages from Chrome related to listing certificates
 */







>
>







186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
	}

	if (nextFunction != null) {
		nextFunction(messageEvent.data, chromeCallback);
	}

	delete cackeyOutstandingCallbacks[messageEvent.data.id];

	pinWindowPINValue = "";

	return;
}

/*
 * Handler for messages from Chrome related to listing certificates
 */

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

1
2
3
4
5
6
7
8
9
10
function clickOk() {

	parentWindow.pinWindowDidWork = 1;

	window.close();

	return;
}

function clickCancel() {

<
|







1

2
3
4
5
6
7
8
9
function clickOk() {

	parentWindow.pinWindowPINValue = document.getElementById('pin').value;

	window.close();

	return;
}

function clickCancel() {