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

Side by Side Diff: chrome/browser/resources/shared/js/cr/ui/context_menu_handler.js

Issue 8422008: TaskManager: minor UI cleanup (consume Esc with context menu opened, use classList). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/resources/task_manager/main.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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('cr.ui', function() { 5 cr.define('cr.ui', function() {
6 6
7 const Menu = cr.ui.Menu; 7 const Menu = cr.ui.Menu;
8 8
9 /** 9 /**
10 * Handles context menus. 10 * Handles context menus.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 case 'mousedown': 125 case 'mousedown':
126 if (!this.menu.contains(e.target)) 126 if (!this.menu.contains(e.target))
127 this.hideMenu(); 127 this.hideMenu();
128 else 128 else
129 e.preventDefault(); 129 e.preventDefault();
130 break; 130 break;
131 case 'keydown': 131 case 'keydown':
132 // keyIdentifier does not report 'Esc' correctly 132 // keyIdentifier does not report 'Esc' correctly
133 if (e.keyCode == 27 /* Esc */) { 133 if (e.keyCode == 27 /* Esc */) {
134 this.hideMenu(); 134 this.hideMenu();
135 e.stopPropagation();
136 e.preventDefault();
135 137
136 // If the menu is visible we let it handle all the keyboard events. 138 // If the menu is visible we let it handle all the keyboard events.
137 } else if (this.menu) { 139 } else if (this.menu) {
138 this.menu.handleKeyDown(e); 140 this.menu.handleKeyDown(e);
139 e.preventDefault(); 141 e.preventDefault();
140 e.stopPropagation(); 142 e.stopPropagation();
141 } 143 }
142 break; 144 break;
143 145
144 case 'activate': 146 case 'activate':
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 * The singleton context menu handler. 218 * The singleton context menu handler.
217 * @type {!ContextMenuHandler} 219 * @type {!ContextMenuHandler}
218 */ 220 */
219 var contextMenuHandler = new ContextMenuHandler; 221 var contextMenuHandler = new ContextMenuHandler;
220 222
221 // Export 223 // Export
222 return { 224 return {
223 contextMenuHandler: contextMenuHandler 225 contextMenuHandler: contextMenuHandler
224 }; 226 };
225 }); 227 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/task_manager/main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698