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

Side by Side Diff: chrome/browser/resources/extensions/extension_command_list.js

Issue 350943003: Support global keyboard commands on Chrome OS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test updates Created 6 years, 5 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 | Annotate | Revision Log
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 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Creates a new list of extension commands. 9 * Creates a new list of extension commands.
10 * @param {Object=} opt_propertyBag Optional properties. 10 * @param {Object=} opt_propertyBag Optional properties.
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } else { 257 } else {
258 shortcutNode.textContent = command.keybinding; 258 shortcutNode.textContent = command.keybinding;
259 } 259 }
260 260
261 var commandClear = node.querySelector('.command-clear'); 261 var commandClear = node.querySelector('.command-clear');
262 commandClear.id = this.createElementId_( 262 commandClear.id = this.createElementId_(
263 'clear', command.extension_id, command.command_name); 263 'clear', command.extension_id, command.command_name);
264 commandClear.title = loadTimeData.getString('extensionCommandsDelete'); 264 commandClear.title = loadTimeData.getString('extensionCommandsDelete');
265 commandClear.addEventListener('click', this.handleClear_.bind(this)); 265 commandClear.addEventListener('click', this.handleClear_.bind(this));
266 266
267 if (command.scope_ui_visible) { 267 var select = node.querySelector('.command-scope');
268 var select = node.querySelector('.command-scope'); 268 select.id = this.createElementId_(
269 select.id = this.createElementId_( 269 'setCommandScope', command.extension_id, command.command_name);
270 'setCommandScope', command.extension_id, command.command_name); 270 select.hidden = false;
271 select.hidden = false; 271 // Add the 'In Chrome' option.
272 // Add the 'In Chrome' option. 272 var option = document.createElement('option');
273 var option = document.createElement('option'); 273 option.textContent = loadTimeData.getString('extensionCommandsRegular');
274 option.textContent = loadTimeData.getString('extensionCommandsRegular'); 274 select.appendChild(option);
275 if (command.extension_action) {
276 // Extension actions cannot be global, so we might as well disable the
277 // combo box, to signify that.
278 select.disabled = true;
279 } else {
280 // Add the 'Global' option.
281 option = document.createElement('option');
282 option.textContent = loadTimeData.getString('extensionCommandsGlobal');
275 select.appendChild(option); 283 select.appendChild(option);
276 if (command.extension_action) { 284 select.selectedIndex = command.global ? 1 : 0;
277 // Extension actions cannot be global, so we might as well disable the
278 // combo box, to signify that.
279 select.disabled = true;
280 } else {
281 // Add the 'Global' option.
282 option = document.createElement('option');
283 option.textContent =
284 loadTimeData.getString('extensionCommandsGlobal');
285 select.appendChild(option);
286 select.selectedIndex = command.global ? 1 : 0;
287 285
288 select.addEventListener( 286 select.addEventListener(
289 'change', this.handleSetCommandScope_.bind(this)); 287 'change', this.handleSetCommandScope_.bind(this));
290 }
291 } 288 }
292 289
293 this.appendChild(node); 290 this.appendChild(node);
294 }, 291 },
295 292
296 /** 293 /**
297 * Starts keystroke capture to determine which key to use for a particular 294 * Starts keystroke capture to determine which key to use for a particular
298 * extension command. 295 * extension command.
299 * @param {Event} event The keyboard event to consider. 296 * @param {Event} event The keyboard event to consider.
300 * @private 297 * @private
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 namespace.length + 1 + kExtensionIdLength), 534 namespace.length + 1 + kExtensionIdLength),
538 commandName: id.substring(namespace.length + 1 + kExtensionIdLength + 1) 535 commandName: id.substring(namespace.length + 1 + kExtensionIdLength + 1)
539 }; 536 };
540 }, 537 },
541 }; 538 };
542 539
543 return { 540 return {
544 ExtensionCommandList: ExtensionCommandList 541 ExtensionCommandList: ExtensionCommandList
545 }; 542 };
546 }); 543 });
OLDNEW
« no previous file with comments | « chrome/browser/extensions/global_shortcut_listener_chromeos.cc ('k') | chrome/common/extensions/command.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698