| OLD | NEW |
| 1 /* Copyright 2016 The Chromium Authors. All rights reserved. | 1 /* Copyright 2016 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 cr.define('signin.error', function() { | 5 cr.define('signin.error', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 function initialize() { | 8 function initialize() { |
| 9 document.addEventListener('keydown', onKeyDown); | 9 document.addEventListener('keydown', onKeyDown); |
| 10 $('confirmButton').addEventListener('click', onConfirm); | 10 $('confirmButton').addEventListener('click', onConfirm); |
| 11 $('closeButton').addEventListener('click', onConfirm); | 11 $('closeButton').addEventListener('click', onConfirm); |
| 12 $('switchButton').addEventListener('click', onSwitchToExistingProfile); | 12 $('switchButton').addEventListener('click', onSwitchToExistingProfile); |
| 13 $('learnMoreLink').addEventListener('click', onLearnMore); | 13 $('learnMoreLink').addEventListener('click', onLearnMore); |
| 14 if (loadTimeData.getBoolean('isSystemProfile')) { |
| 15 $('learnMoreLink').hidden = true; |
| 16 } |
| 14 chrome.send('initializedWithSize', [document.body.scrollHeight]); | 17 chrome.send('initializedWithSize', [document.body.scrollHeight]); |
| 15 } | 18 } |
| 16 | 19 |
| 17 function onKeyDown(e) { | 20 function onKeyDown(e) { |
| 18 // If the currently focused element isn't something that performs an action | 21 // If the currently focused element isn't something that performs an action |
| 19 // on "enter" being pressed and the user hits "enter", perform the default | 22 // on "enter" being pressed and the user hits "enter", perform the default |
| 20 // action of the dialog, which is "OK". | 23 // action of the dialog, which is "OK". |
| 21 if (e.key == 'Enter' && | 24 if (e.key == 'Enter' && |
| 22 !/^(A|PAPER-BUTTON)$/.test(document.activeElement.tagName)) { | 25 !/^(A|PAPER-BUTTON)$/.test(document.activeElement.tagName)) { |
| 23 $('confirmButton').click(); | 26 $('confirmButton').click(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 48 } | 51 } |
| 49 | 52 |
| 50 return { | 53 return { |
| 51 initialize: initialize, | 54 initialize: initialize, |
| 52 clearFocus: clearFocus, | 55 clearFocus: clearFocus, |
| 53 removeSwitchButton: removeSwitchButton | 56 removeSwitchButton: removeSwitchButton |
| 54 }; | 57 }; |
| 55 }); | 58 }); |
| 56 | 59 |
| 57 document.addEventListener('DOMContentLoaded', signin.error.initialize); | 60 document.addEventListener('DOMContentLoaded', signin.error.initialize); |
| OLD | NEW |