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

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

Issue 10966027: Basic keyboard access for recently_closed menu on NTP. Allows using up and down arrows to navigate,… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Get rid of pointless experimental code" Created 8 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
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('cr.ui', function() { 5 cr.define('cr.ui', function() {
6 /** @const */ var Command = cr.ui.Command; 6 /** @const */ var Command = cr.ui.Command;
7 7
8 /** 8 /**
9 * Creates a new menu item element. 9 * Creates a new menu item element.
10 * @param {Object=} opt_propertyBag Optional properties. 10 * @param {Object=} opt_propertyBag Optional properties.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 * Handles mouseup events. This dispatches an activate event; if there is an 117 * Handles mouseup events. This dispatches an activate event; if there is an
118 * associated command, that command is executed. 118 * associated command, that command is executed.
119 * @param {Event} e The mouseup event object. 119 * @param {Event} e The mouseup event object.
120 * @private 120 * @private
121 */ 121 */
122 handleMouseUp_: function(e) { 122 handleMouseUp_: function(e) {
123 if (!this.disabled && !this.isSeparator() && this.selected) { 123 if (!this.disabled && !this.isSeparator() && this.selected) {
124 // Store |contextElement| since it'll be removed by {Menu} on handling 124 // Store |contextElement| since it'll be removed by {Menu} on handling
125 // 'activate' event. 125 // 'activate' event.
126 var contextElement = this.parentNode.contextElement; 126 var contextElement = this.parentNode.contextElement;
127 var activationEvent = cr.doc.createEvent('Event');
128 activationEvent.initEvent('activate', true, true);
129 activationEvent.originalEvent = e;
127 // Dispatch command event followed by executing the command object. 130 // Dispatch command event followed by executing the command object.
128 if (cr.dispatchSimpleEvent(this, 'activate', true, true)) { 131 if (this.dispatchEvent(activationEvent)) {
129 var command = this.command; 132 var command = this.command;
130 if (command) 133 if (command)
131 command.execute(contextElement); 134 command.execute(contextElement);
132 } 135 }
133 } 136 }
134 }, 137 },
135 138
136 /** 139 /**
137 * Updates command according to the node on which this menu was invoked. 140 * Updates command according to the node on which this menu was invoked.
138 * @param {Node=} opt_node Node on which menu was opened. 141 * @param {Node=} opt_node Node on which menu was opened.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 * Whether the menu item is checked or not. 190 * Whether the menu item is checked or not.
188 * @type {boolean} 191 * @type {boolean}
189 */ 192 */
190 cr.defineProperty(MenuItem, 'checked', cr.PropertyKind.BOOL_ATTR); 193 cr.defineProperty(MenuItem, 'checked', cr.PropertyKind.BOOL_ATTR);
191 194
192 // Export 195 // Export
193 return { 196 return {
194 MenuItem: MenuItem 197 MenuItem: MenuItem
195 }; 198 };
196 }); 199 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698