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

Unified Diff: chrome/browser/resources/extensions/extension_command_list.js

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/extensions/extension_command_list.js
diff --git a/chrome/browser/resources/extensions/extension_command_list.js b/chrome/browser/resources/extensions/extension_command_list.js
index eca1797c75babb20359c27eed7ca1ea225ca5e77..e94ca8bbbcff0d6559dce90678fb4857d93a6bf2 100644
--- a/chrome/browser/resources/extensions/extension_command_list.js
+++ b/chrome/browser/resources/extensions/extension_command_list.js
@@ -73,8 +73,9 @@ cr.define('extensions', function() {
extension.state == chrome.developerPrivate.ExtensionState.DISABLED)
return;
- var template = $('template-collection-extension-commands').querySelector(
- '.extension-command-list-extension-item-wrapper');
+ var template =
+ $('template-collection-extension-commands')
+ .querySelector('.extension-command-list-extension-item-wrapper');
var node = template.cloneNode(true);
var title = node.querySelector('.extension-title');
@@ -97,8 +98,9 @@ cr.define('extensions', function() {
* @private
*/
createNodeForCommand_: function(extensionId, command) {
- var template = $('template-collection-extension-commands').querySelector(
- '.extension-command-list-command-item-wrapper');
+ var template =
+ $('template-collection-extension-commands')
+ .querySelector('.extension-command-list-command-item-wrapper');
var node = template.cloneNode(true);
node.id = this.createElementId_('command', extensionId, command.name);
@@ -106,8 +108,7 @@ cr.define('extensions', function() {
description.textContent = command.description;
var shortcutNode = node.querySelector('.command-shortcut-text');
- shortcutNode.addEventListener('mouseup',
- this.startCapture_.bind(this));
+ shortcutNode.addEventListener('mouseup', this.startCapture_.bind(this));
shortcutNode.addEventListener('focus', this.handleFocus_.bind(this));
shortcutNode.addEventListener('blur', this.handleBlur_.bind(this));
shortcutNode.addEventListener('keydown', this.handleKeyDown_.bind(this));
@@ -123,14 +124,14 @@ cr.define('extensions', function() {
}
var commandClear = node.querySelector('.command-clear');
- commandClear.id = this.createElementId_(
- 'clear', extensionId, command.name);
+ commandClear.id =
+ this.createElementId_('clear', extensionId, command.name);
commandClear.title = loadTimeData.getString('extensionCommandsDelete');
commandClear.addEventListener('click', this.handleClear_.bind(this));
var select = node.querySelector('.command-scope');
- select.id = this.createElementId_(
- 'setCommandScope', extensionId, command.name);
+ select.id =
+ this.createElementId_('setCommandScope', extensionId, command.name);
select.hidden = false;
// Add the 'In Chrome' option.
var option = document.createElement('option');
@@ -147,8 +148,8 @@ cr.define('extensions', function() {
option.textContent = loadTimeData.getString('extensionCommandsGlobal');
select.appendChild(option);
select.selectedIndex =
- command.scope == chrome.developerPrivate.CommandScope.GLOBAL ?
- 1 : 0;
+ command.scope == chrome.developerPrivate.CommandScope.GLOBAL ? 1 :
+ 0;
select.addEventListener(
'change', this.handleSetCommandScope_.bind(this));
@@ -179,7 +180,7 @@ cr.define('extensions', function() {
shortcutNode.parentElement.querySelector('.command-clear');
commandClear.hidden = true;
- this.capturingElement_ = /** @type {HTMLElement} */(event.target);
+ this.capturingElement_ = /** @type {HTMLElement} */ (event.target);
},
/**
@@ -252,7 +253,7 @@ cr.define('extensions', function() {
* @private
*/
handleKeyDown_: function(event) {
- event = /** @type {KeyboardEvent} */(event);
+ event = /** @type {KeyboardEvent} */ (event);
if (event.keyCode == extensions.Key.Escape) {
if (!this.capturingElement_) {
// If we're not currently capturing, allow escape to propagate (so it
@@ -261,7 +262,8 @@ cr.define('extensions', function() {
}
// Otherwise, escape cancels capturing.
this.endCapture_(event);
- var parsed = this.parseElementId_('clear',
+ var parsed = this.parseElementId_(
+ 'clear',
event.target.parentElement.querySelector('.command-clear').id);
chrome.developerPrivate.updateExtensionCommand({
extensionId: parsed.extensionId,
@@ -289,7 +291,7 @@ cr.define('extensions', function() {
* @private
*/
handleKeyUp_: function(event) {
- event = /** @type {KeyboardEvent} */(event);
+ event = /** @type {KeyboardEvent} */ (event);
if (event.keyCode == extensions.Key.Tab ||
event.keyCode == extensions.Key.Escape) {
// We need to allow tab propagation for keyboard navigation, and escapes
@@ -351,10 +353,11 @@ cr.define('extensions', function() {
// Ending the capture must occur before calling
// setExtensionCommandShortcut to ensure the shortcut is set.
this.endCapture_(event);
- chrome.developerPrivate.updateExtensionCommand(
- {extensionId: parsed.extensionId,
- commandName: parsed.commandName,
- keybinding: keystroke});
+ chrome.developerPrivate.updateExtensionCommand({
+ extensionId: parsed.extensionId,
+ commandName: parsed.commandName,
+ keybinding: keystroke
+ });
}
},
@@ -365,10 +368,11 @@ cr.define('extensions', function() {
*/
handleClear_: function(event) {
var parsed = this.parseElementId_('clear', event.target.id);
- chrome.developerPrivate.updateExtensionCommand(
- {extensionId: parsed.extensionId,
- commandName: parsed.commandName,
- keybinding: ''});
+ chrome.developerPrivate.updateExtensionCommand({
+ extensionId: parsed.extensionId,
+ commandName: parsed.commandName,
+ keybinding: ''
+ });
},
/**
@@ -383,10 +387,11 @@ cr.define('extensions', function() {
var scope = element.selectedIndex == 1 ?
chrome.developerPrivate.CommandScope.GLOBAL :
chrome.developerPrivate.CommandScope.CHROME;
- chrome.developerPrivate.updateExtensionCommand(
- {extensionId: parsed.extensionId,
- commandName: parsed.commandName,
- scope: scope});
+ chrome.developerPrivate.updateExtensionCommand({
+ extensionId: parsed.extensionId,
+ commandName: parsed.commandName,
+ scope: scope
+ });
},
/**
@@ -412,14 +417,12 @@ cr.define('extensions', function() {
parseElementId_: function(namespace, id) {
var kExtensionIdLength = 32;
return {
- extensionId: id.substring(namespace.length + 1,
- namespace.length + 1 + kExtensionIdLength),
+ extensionId: id.substring(
+ namespace.length + 1, namespace.length + 1 + kExtensionIdLength),
commandName: id.substring(namespace.length + 1 + kExtensionIdLength + 1)
};
},
};
- return {
- ExtensionCommandList: ExtensionCommandList
- };
+ return {ExtensionCommandList: ExtensionCommandList};
});

Powered by Google App Engine
This is Rietveld 408576698