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

Side by Side Diff: chrome/browser/resources/options/editable_text_field.js

Issue 2059913002: Remove keyIdentifier usage in chrome/browser/resources/* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix chromeos build Created 4 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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('options', function() { 5 cr.define('options', function() {
6 /** 6 /**
7 * @constructor 7 * @constructor
8 * @extends {HTMLDivElement} 8 * @extends {HTMLDivElement}
9 */ 9 */
10 var EditableTextField = cr.ui.define('div'); 10 var EditableTextField = cr.ui.define('div');
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 /** 326 /**
327 * Called when a key is pressed. Handles committing and canceling edits. 327 * Called when a key is pressed. Handles committing and canceling edits.
328 * @param {Event} e The key down event. 328 * @param {Event} e The key down event.
329 * @private 329 * @private
330 */ 330 */
331 handleKeyDown_: function(e) { 331 handleKeyDown_: function(e) {
332 if (!this.editing) 332 if (!this.editing)
333 return; 333 return;
334 334
335 var endEdit; 335 var endEdit;
336 switch (e.keyIdentifier) { 336 switch (e.key) {
337 case 'U+001B': // Esc 337 case 'Escape':
338 this.editCanceled_ = true; 338 this.editCanceled_ = true;
339 endEdit = true; 339 endEdit = true;
340 break; 340 break;
341 case 'Enter': 341 case 'Enter':
342 if (this.currentInputIsValid) 342 if (this.currentInputIsValid)
343 endEdit = true; 343 endEdit = true;
344 break; 344 break;
345 } 345 }
346 346
347 if (endEdit) { 347 if (endEdit) {
(...skipping 15 matching lines...) Expand all
363 return node instanceof EditableTextField; 363 return node instanceof EditableTextField;
364 }); 364 });
365 if (itemAncestor) 365 if (itemAncestor)
366 document.activeElement.blur(); 366 document.activeElement.blur();
367 }); 367 });
368 368
369 return { 369 return {
370 EditableTextField: EditableTextField, 370 EditableTextField: EditableTextField,
371 }; 371 };
372 }); 372 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/cookies_view.js ('k') | chrome/browser/resources/options/home_page_overlay.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698