| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 Oobe reset screen implementation. | 6 * @fileoverview Oobe reset screen implementation. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 login.createScreen('KioskEnableScreen', 'kiosk-enable', function() { | 9 login.createScreen('KioskEnableScreen', 'kiosk-enable', function() { |
| 10 return { | 10 return { |
| 11 EXTERNAL_API: ['enableKioskForTesting', | 11 EXTERNAL_API: ['enableKioskForTesting', 'onCompleted'], |
| 12 'onCompleted'], | |
| 13 /** | 12 /** |
| 14 * Header text of the screen. | 13 * Header text of the screen. |
| 15 * @type {string} | 14 * @type {string} |
| 16 */ | 15 */ |
| 17 get header() { | 16 get header() { |
| 18 return loadTimeData.getString('kioskEnableTitle'); | 17 return loadTimeData.getString('kioskEnableTitle'); |
| 19 }, | 18 }, |
| 20 | 19 |
| 21 /** | 20 /** |
| 22 * Buttons in oobe wizard's button strip. | 21 * Buttons in oobe wizard's button strip. |
| 23 * @type {array} Array of Buttons. | 22 * @type {array} Array of Buttons. |
| 24 */ | 23 */ |
| 25 get buttons() { | 24 get buttons() { |
| 26 var buttons = []; | 25 var buttons = []; |
| 27 | 26 |
| 28 var confirmButton = this.ownerDocument.createElement('button'); | 27 var confirmButton = this.ownerDocument.createElement('button'); |
| 29 confirmButton.id = 'kiosk-enable-button'; | 28 confirmButton.id = 'kiosk-enable-button'; |
| 30 confirmButton.textContent = | 29 confirmButton.textContent = loadTimeData.getString('kioskEnableButton'); |
| 31 loadTimeData.getString('kioskEnableButton'); | |
| 32 confirmButton.addEventListener('click', function(e) { | 30 confirmButton.addEventListener('click', function(e) { |
| 33 chrome.send('kioskOnEnable'); | 31 chrome.send('kioskOnEnable'); |
| 34 e.stopPropagation(); | 32 e.stopPropagation(); |
| 35 }); | 33 }); |
| 36 buttons.push(confirmButton); | 34 buttons.push(confirmButton); |
| 37 | 35 |
| 38 var cancelButton = this.ownerDocument.createElement('button'); | 36 var cancelButton = this.ownerDocument.createElement('button'); |
| 39 cancelButton.id = 'kiosk-cancel-button'; | 37 cancelButton.id = 'kiosk-cancel-button'; |
| 40 cancelButton.textContent = | 38 cancelButton.textContent = loadTimeData.getString('kioskCancelButton'); |
| 41 loadTimeData.getString('kioskCancelButton'); | |
| 42 cancelButton.addEventListener('click', function(e) { | 39 cancelButton.addEventListener('click', function(e) { |
| 43 chrome.send('kioskOnClose'); | 40 chrome.send('kioskOnClose'); |
| 44 e.stopPropagation(); | 41 e.stopPropagation(); |
| 45 }); | 42 }); |
| 46 buttons.push(cancelButton); | 43 buttons.push(cancelButton); |
| 47 | 44 |
| 48 var okButton = this.ownerDocument.createElement('button'); | 45 var okButton = this.ownerDocument.createElement('button'); |
| 49 okButton.id = 'kiosk-ok-button'; | 46 okButton.id = 'kiosk-ok-button'; |
| 50 okButton.hidden = true; | 47 okButton.hidden = true; |
| 51 okButton.textContent = | 48 okButton.textContent = loadTimeData.getString('kioskOKButton'); |
| 52 loadTimeData.getString('kioskOKButton'); | |
| 53 okButton.addEventListener('click', function(e) { | 49 okButton.addEventListener('click', function(e) { |
| 54 chrome.send('kioskOnClose'); | 50 chrome.send('kioskOnClose'); |
| 55 e.stopPropagation(); | 51 e.stopPropagation(); |
| 56 }); | 52 }); |
| 57 buttons.push(okButton); | 53 buttons.push(okButton); |
| 58 return buttons; | 54 return buttons; |
| 59 }, | 55 }, |
| 60 | 56 |
| 61 /** | 57 /** |
| 62 * Event handler invoked when the page is shown and ready. | 58 * Event handler invoked when the page is shown and ready. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 81 */ | 77 */ |
| 82 cancel: function() { | 78 cancel: function() { |
| 83 chrome.send('kioskOnClose'); | 79 chrome.send('kioskOnClose'); |
| 84 }, | 80 }, |
| 85 | 81 |
| 86 /** | 82 /** |
| 87 * Initiates enable/cancel response for testing. | 83 * Initiates enable/cancel response for testing. |
| 88 * @param {boolean} confirm True if the screen should confirm auto-launch. | 84 * @param {boolean} confirm True if the screen should confirm auto-launch. |
| 89 */ | 85 */ |
| 90 enableKioskForTesting: function(confirm) { | 86 enableKioskForTesting: function(confirm) { |
| 91 var button = confirm ? $('kiosk-enable-button') : | 87 var button = |
| 92 $('kiosk-cancel-button'); | 88 confirm ? $('kiosk-enable-button') : $('kiosk-cancel-button'); |
| 93 var clickEvent = cr.doc.createEvent('Event'); | 89 var clickEvent = cr.doc.createEvent('Event'); |
| 94 clickEvent.initEvent('click', true, true); | 90 clickEvent.initEvent('click', true, true); |
| 95 button.dispatchEvent(clickEvent); | 91 button.dispatchEvent(clickEvent); |
| 96 }, | 92 }, |
| 97 | 93 |
| 98 /** | 94 /** |
| 99 * Updates completion message on the screen. | 95 * Updates completion message on the screen. |
| 100 * @param {boolean} success True if consumer kiosk was successfully enabled. | 96 * @param {boolean} success True if consumer kiosk was successfully enabled. |
| 101 */ | 97 */ |
| 102 onCompleted: function(success) { | 98 onCompleted: function(success) { |
| 103 $('kiosk-enable-button').hidden = true; | 99 $('kiosk-enable-button').hidden = true; |
| 104 $('kiosk-cancel-button').hidden = true; | 100 $('kiosk-cancel-button').hidden = true; |
| 105 $('kiosk-ok-button').hidden = false; | 101 $('kiosk-ok-button').hidden = false; |
| 106 $('kiosk-enable-details').textContent = | 102 $('kiosk-enable-details').textContent = loadTimeData.getString( |
| 107 loadTimeData.getString(success ? 'kioskEnableSuccessMsg' : | 103 success ? 'kioskEnableSuccessMsg' : 'kioskEnableErrorMsg'); |
| 108 'kioskEnableErrorMsg'); | |
| 109 } | 104 } |
| 110 }; | 105 }; |
| 111 }); | 106 }); |
| 112 | |
| 113 | |
| 114 | |
| OLD | NEW |