Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3087)

Unified Diff: chrome/browser/resources/signin_error/signin_error.js

Issue 2255413002: [Signin Error Dialog] (3/3) Added the triggering code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: anthonyvd's first pass Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..f15efe6589d4d86d7d243b9ad27a1f03deb57289
--- /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 onSwitchToExistingProfile(e) {
+ chrome.send('switchToExistingProfile');
+ }
+
+ function onLearnMore(e) {
+ chrome.send('learnMore');
+ }
+
+ function initialize() {
+ document.addEventListener('keydown', onKeyDown);
+ $('primaryConfirmButton').addEventListener('click', onConfirm);
+ $('secondaryConfirmButton').addEventListener('click', onConfirm);
+ $('switchButton').addEventListener('click', onSwitchToExistingProfile);
+ $('learnMoreLink').addEventListener('click', onLearnMore);
+ chrome.send('initializedWithSize', [document.body.scrollHeight]);
+ $('primaryConfirmButton').style.display = 'none';
tommycli 2016/08/23 19:15:39 Instead of dynamically making it hidden, can we us
Jane 2016/08/24 13:40:31 Done.
+ }
+
+ 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);

Powered by Google App Engine
This is Rietveld 408576698