Index: chrome/browser/resources/md_extensions/service.js |
diff --git a/chrome/browser/resources/md_extensions/service.js b/chrome/browser/resources/md_extensions/service.js |
index 40ddf4c9d2448f9bf3854d514f54ca11fc3922b5..4f1f35cd9cac735f1d6e4b574349ea3fb6578523 100644 |
--- a/chrome/browser/resources/md_extensions/service.js |
+++ b/chrome/browser/resources/md_extensions/service.js |
@@ -24,6 +24,16 @@ cr.define('extensions', function() { |
this.manager_.sidebar.setDelegate(this); |
this.manager_.set('itemDelegate', this); |
this.manager_.$['pack-dialog'].set('delegate', this); |
+ var keyboardShortcuts = this.manager_.$['keyboard-shortcuts']; |
+ keyboardShortcuts.addEventListener( |
+ 'shortcut-updated', |
+ this.onExtensionCommandUpdated_.bind(this)); |
+ keyboardShortcuts.addEventListener( |
+ 'shortcut-capture-started', |
+ this.onShortcutCaptureChanged_.bind(this, true)); |
+ keyboardShortcuts.addEventListener( |
+ 'shortcut-capture-ended', |
+ this.onShortcutCaptureChanged_.bind(this, false)); |
chrome.developerPrivate.onProfileStateChanged.addListener( |
this.onProfileStateChanged_.bind(this)); |
chrome.developerPrivate.onItemStateChanged.addListener( |
@@ -111,6 +121,34 @@ cr.define('extensions', function() { |
}); |
}, |
+ /** |
+ * Updates an extension command. |
+ * @param {!CustomEvent} e |
+ * @private |
+ */ |
+ onExtensionCommandUpdated_: function(e) { |
+ chrome.developerPrivate.updateExtensionCommand({ |
+ extensionId: e.detail.item, |
+ commandName: e.detail.commandName, |
+ keybinding: e.detail.keybinding, |
+ }); |
+ }, |
+ |
+ /** |
+ * Called when shortcut capturing changes in order to suspend or re-enable |
+ * global shortcut handling. This is important so that the shortcuts aren't |
+ * processed normally as the user types them. |
+ * TODO(devlin): From very brief experimentation, it looks like preventing |
+ * the default handling on the event also does this. Investigate more in the |
+ * future. |
+ * @param {boolean} isCapturing |
+ * @param {!CustomEvent} e |
+ * @private |
+ */ |
+ onShortcutCaptureChanged_: function(isCapturing, e) { |
+ chrome.developerPrivate.setShortcutHandlingSuspended(isCapturing); |
+ }, |
+ |
/** @override */ |
deleteItem: function(id) { |
if (this.isDeleting_) |