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

Side by Side Diff: chrome/browser/resources/chromeos/keyboard/keyboard_utils.js

Issue 2921783003: WebUI: Fix/suppress some existing violations of no-restricted-globals. (Closed)
Patch Set: Fix svg Created 3 years, 6 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
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 * Namespace for keyboard utility functions. 6 * Namespace for keyboard utility functions.
7 */ 7 */
8 var keyboard = {}; 8 var keyboard = {};
9 9
10 /** 10 /**
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // This file also gets embedded inside of the CfM/hotrod enrollment webview. 78 // This file also gets embedded inside of the CfM/hotrod enrollment webview.
79 // Events will bubble down into the webview, which means that the event 79 // Events will bubble down into the webview, which means that the event
80 // handler from the webui will steal the events meant for the webview. So we 80 // handler from the webui will steal the events meant for the webview. So we
81 // have to disable the webui handler if the active element is the webview. 81 // have to disable the webui handler if the active element is the webview.
82 // 82 //
83 // $ is defined differently depending on how this file gets executed; we have 83 // $ is defined differently depending on how this file gets executed; we have
84 // to use document.getElementById to get consistent behavior. 84 // to use document.getElementById to get consistent behavior.
85 // 85 //
86 // See crbug.com/543865. 86 // See crbug.com/543865.
87 if (document.activeElement === 87 if (document.activeElement ===
88 document.getElementById('oauth-enroll-auth-view')) 88 // eslint-disable-next-line no-restricted-properties
89 document.getElementById('oauth-enroll-auth-view')) {
89 return; 90 return;
91 }
90 92
91 // If we are in networks list dropdown container, let network_dropdown.js 93 // If we are in networks list dropdown container, let network_dropdown.js
92 // handle keyboard events. 94 // handle keyboard events.
93 if (document.activeElement.classList.contains('dropdown-container')) 95 if (document.activeElement.classList.contains('dropdown-container'))
94 return; 96 return;
95 97
96 // Do not map arrow key events to tab events if the user is currently 98 // Do not map arrow key events to tab events if the user is currently
97 // focusing an input element and hits the left or right. 99 // focusing an input element and hits the left or right.
98 var needsLeftRightKey = 100 var needsLeftRightKey =
99 (event.key == 'ArrowLeft' || event.key == 'ArrowRight') && 101 (event.key == 'ArrowLeft' || event.key == 'ArrowRight') &&
(...skipping 30 matching lines...) Expand all
130 keyboard.initializeKeyboardFlow = function(injected) { 132 keyboard.initializeKeyboardFlow = function(injected) {
131 document.addEventListener('keydown', 133 document.addEventListener('keydown',
132 keyboard.onKeyDown_, true); 134 keyboard.onKeyDown_, true);
133 document.addEventListener('keypress', 135 document.addEventListener('keypress',
134 keyboard.onKeyIgnore_, true); 136 keyboard.onKeyIgnore_, true);
135 document.addEventListener('keyup', 137 document.addEventListener('keyup',
136 keyboard.onKeyIgnore_, true); 138 keyboard.onKeyIgnore_, true);
137 if (injected) 139 if (injected)
138 window.addEventListener('message', keyboard.onInitMessage_); 140 window.addEventListener('message', keyboard.onInitMessage_);
139 }; 141 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698