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

Side by Side Diff: chrome/browser/resources/signin_error/signin_error.js

Issue 2274013002: [Signin Error Dialog] (1/3) Added necessary web components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 * found in the LICENSE file. */
4
5 cr.define('signin.error', function() {
6 'use strict';
7
8 function onConfirm(e) {
9 chrome.send('confirm');
10 }
11
12 function onSwitchToExistingProfile(e) {
13 chrome.send('switchToExistingProfile');
14 }
15
16 function onLearnMore(e) {
17 chrome.send('learnMore');
18 }
19
20 function initialize() {
21 document.addEventListener('keydown', onKeyDown);
22 $('primaryConfirmButton').addEventListener('click', onConfirm);
23 $('secondaryConfirmButton').addEventListener('click', onConfirm);
24 $('switchButton').addEventListener('click', onSwitchToExistingProfile);
25 $('learnMoreLink').addEventListener('click', onLearnMore);
26 chrome.send('initializedWithSize', [document.body.scrollHeight]);
27 }
28
29 function clearFocus() {
tommycli 2016/08/24 17:22:52 Can we confirm that this is still needed? Esp. if
Jane 2016/08/25 16:35:29 Confirmed that on mac, the "Learn more" link would
30 document.activeElement.blur();
31 }
32
33 function onKeyDown(e) {
tommycli 2016/08/24 17:22:52 nit: would be good to make the order of these func
Jane 2016/08/25 16:35:29 Done nit. I talked to anthonyvd@ who did this for
34 // If the currently focused element isn't something that performs an action
35 // on "enter" being pressed and the user hits "enter", perform the default
36 // action of the dialog, which is "OK".
37 if (e.key == 'Enter' &&
38 !/^(A|PAPER-BUTTON)$/.test(document.activeElement.tagName)) {
39 $('primaryConfirmButton').click();
40 e.preventDefault();
41 }
42 }
43
44 function removeSwitchButton() {
45 $('switchButton').style.display = 'none';
46 $('secondaryConfirmButton').style.display = 'none';
47 $('primaryConfirmButton').style.display = '';
48 }
49
50 return {
51 clearFocus: clearFocus,
52 initialize: initialize,
53 removeSwitchButton: removeSwitchButton
54 };
55 });
56
57 document.addEventListener('DOMContentLoaded', signin.error.initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698