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

Unified Diff: chrome/browser/resources/md_extensions/service.js

Issue 2101933005: [MD Extensions] Implement keyboard shortcuts page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits + latest master Created 4 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 side-by-side diff with in-line comments
Download patch
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_)

Powered by Google App Engine
This is Rietveld 408576698