| Index: chrome/browser/resources/signin_error/signin_error.js
|
| diff --git a/chrome/browser/resources/signin_error/signin_error.js b/chrome/browser/resources/signin_error/signin_error.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a0cc9503de7fda59b7f879da159b2971d230b385
|
| --- /dev/null
|
| +++ b/chrome/browser/resources/signin_error/signin_error.js
|
| @@ -0,0 +1,58 @@
|
| +/* Copyright 2016 The Chromium Authors. All rights reserved.
|
| + * Use of this source code is governed by a BSD-style license that can be
|
| + * found in the LICENSE file. */
|
| +
|
| +cr.define('signin.error', function() {
|
| + 'use strict';
|
| +
|
| + function onConfirm(e) {
|
| + chrome.send('confirm');
|
| + }
|
| +
|
| + function onSwitch(e) {
|
| + chrome.send('switch');
|
| + }
|
| +
|
| + function onLearnMore(e) {
|
| + chrome.send('learnMore');
|
| + }
|
| +
|
| + function initialize() {
|
| + document.addEventListener('keydown', onKeyDown);
|
| + $('primaryConfirmButton').addEventListener('click', onConfirm);
|
| + $('secondaryConfirmButton').addEventListener('click', onConfirm);
|
| + $('switchButton').addEventListener('click', onSwitch);
|
| + $('learnMoreLink').addEventListener('click', onLearnMore);
|
| + chrome.send('initializedWithSize', [document.body.scrollHeight]);
|
| + $('primaryConfirmButton').style.display = 'none';
|
| + }
|
| +
|
| + function clearFocus() {
|
| + document.activeElement.blur();
|
| + }
|
| +
|
| + function onKeyDown(e) {
|
| + // If the currently focused element isn't something that performs an action
|
| + // on "enter" being pressed and the user hits "enter", perform the default
|
| + // action of the dialog, which is "OK".
|
| + if (e.key == 'Enter' &&
|
| + !/^(A|PAPER-BUTTON)$/.test(document.activeElement.tagName)) {
|
| + $('primaryConfirmButton').click();
|
| + e.preventDefault();
|
| + }
|
| + }
|
| +
|
| + function removeSwitchButton() {
|
| + $('switchButton').style.display = 'none';
|
| + $('secondaryConfirmButton').style.display = 'none';
|
| + $('primaryConfirmButton').style.display = '';
|
| + }
|
| +
|
| + return {
|
| + clearFocus: clearFocus,
|
| + initialize: initialize,
|
| + removeSwitchButton: removeSwitchButton
|
| + };
|
| +});
|
| +
|
| +document.addEventListener('DOMContentLoaded', signin.error.initialize);
|
|
|