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 <include src="../user_images_grid.js"></include> | 10 <include src="../user_images_grid.js"></include> |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 */ | 57 */ |
58 Oobe.setupSelect = function(select, list, callback) { | 58 Oobe.setupSelect = function(select, list, callback) { |
59 select.options.length = 0; | 59 select.options.length = 0; |
60 for (var i = 0; i < list.length; ++i) { | 60 for (var i = 0; i < list.length; ++i) { |
61 var item = list[i]; | 61 var item = list[i]; |
62 var option = | 62 var option = |
63 new Option(item.title, item.value, item.selected, item.selected); | 63 new Option(item.title, item.value, item.selected, item.selected); |
64 select.appendChild(option); | 64 select.appendChild(option); |
65 } | 65 } |
66 if (callback) { | 66 if (callback) { |
67 var send_callback = function() { | 67 var sendCallback = function() { |
68 chrome.send(callback, [select.options[select.selectedIndex].value]); | 68 chrome.send(callback, [select.options[select.selectedIndex].value]); |
69 }; | 69 }; |
70 select.addEventListener('blur', function(event) { send_callback(); }); | 70 select.addEventListener('blur', sendCallback); |
71 select.addEventListener('click', function(event) { send_callback(); }); | 71 select.addEventListener('click', sendCallback); |
72 select.addEventListener('keyup', function(event) { | 72 select.addEventListener('keyup', function(event) { |
73 var keycode_interested = [ | 73 var keycodeInterested = [ |
74 9, // Tab | 74 9, // Tab |
75 13, // Enter | 75 13, // Enter |
76 27, // Escape | 76 27, // Escape |
77 ]; | 77 ]; |
78 if (keycode_interested.indexOf(event.keyCode) >= 0) | 78 if (keycodeInterested.indexOf(event.keyCode) >= 0) |
79 send_callback(); | 79 sendCallback(); |
80 }); | 80 }); |
81 } | 81 } |
82 }; | 82 }; |
83 | 83 |
84 /** | 84 /** |
85 * Initializes the OOBE flow. This will cause all C++ handlers to | 85 * Initializes the OOBE flow. This will cause all C++ handlers to |
86 * be invoked to do final setup. | 86 * be invoked to do final setup. |
87 */ | 87 */ |
88 Oobe.initialize = function() { | 88 Oobe.initialize = function() { |
89 DisplayManager.initialize(); | 89 DisplayManager.initialize(); |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 // Allow selection events on components with editable text (password field) | 549 // Allow selection events on components with editable text (password field) |
550 // bug (http://code.google.com/p/chromium/issues/detail?id=125863) | 550 // bug (http://code.google.com/p/chromium/issues/detail?id=125863) |
551 disableTextSelectAndDrag(function(e) { | 551 disableTextSelectAndDrag(function(e) { |
552 var src = e.target; | 552 var src = e.target; |
553 return src instanceof HTMLTextAreaElement || | 553 return src instanceof HTMLTextAreaElement || |
554 src instanceof HTMLInputElement && | 554 src instanceof HTMLInputElement && |
555 /text|password|search/.test(src.type); | 555 /text|password|search/.test(src.type); |
556 }); | 556 }); |
557 | 557 |
558 document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize); | 558 document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize); |
OLD | NEW |