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 /** | 5 /** |
6 * @fileoverview Out of the box experience flow (OOBE). | 6 * @fileoverview Out of the box experience flow (OOBE). |
7 * This is the main code for the OOBE WebUI implementation. | 7 * This is the main code for the OOBE WebUI implementation. |
8 */ | 8 */ |
9 | 9 |
10 var localStrings = new LocalStrings(); | 10 var localStrings = new LocalStrings(); |
(...skipping 25 matching lines...) Expand all Loading... |
36 */ | 36 */ |
37 Oobe.setupSelect = function(select, list, callback) { | 37 Oobe.setupSelect = function(select, list, callback) { |
38 select.options.length = 0; | 38 select.options.length = 0; |
39 for (var i = 0; i < list.length; ++i) { | 39 for (var i = 0; i < list.length; ++i) { |
40 var item = list[i]; | 40 var item = list[i]; |
41 var option = | 41 var option = |
42 new Option(item.title, item.value, item.selected, item.selected); | 42 new Option(item.title, item.value, item.selected, item.selected); |
43 select.appendChild(option); | 43 select.appendChild(option); |
44 } | 44 } |
45 if (callback) { | 45 if (callback) { |
46 select.addEventListener('blur', function(event) { | 46 var send_callback = function() { |
47 chrome.send(callback, [select.options[select.selectedIndex].value]); | 47 chrome.send(callback, [select.options[select.selectedIndex].value]); |
| 48 }; |
| 49 select.addEventListener('blur', function(event) { send_callback(); }); |
| 50 select.addEventListener('click', function(event) { send_callback(); }); |
| 51 select.addEventListener('keyup', function(event) { |
| 52 var keycode_interested = [ |
| 53 9, // Tab |
| 54 13, // Enter |
| 55 27, // Escape |
| 56 ]; |
| 57 if (keycode_interested.indexOf(event.keyCode) >= 0) |
| 58 send_callback(); |
48 }); | 59 }); |
49 } | 60 } |
50 } | 61 } |
51 | 62 |
52 /** | 63 /** |
53 * Initializes the OOBE flow. This will cause all C++ handlers to | 64 * Initializes the OOBE flow. This will cause all C++ handlers to |
54 * be invoked to do final setup. | 65 * be invoked to do final setup. |
55 */ | 66 */ |
56 Oobe.initialize = function() { | 67 Oobe.initialize = function() { |
57 oobe.NetworkScreen.register(); | 68 oobe.NetworkScreen.register(); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 return { | 293 return { |
283 Oobe: Oobe | 294 Oobe: Oobe |
284 }; | 295 }; |
285 }); | 296 }); |
286 | 297 |
287 var Oobe = cr.ui.Oobe; | 298 var Oobe = cr.ui.Oobe; |
288 | 299 |
289 disableTextSelectAndDrag(); | 300 disableTextSelectAndDrag(); |
290 | 301 |
291 document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize); | 302 document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize); |
OLD | NEW |