Allow key events to continue propagation for commands without any event listeners.
commitfa5d9da251c9aa5333ab5a22ddd0bb51f44d1db2
authordtseng <dtseng@chromium.org>
Tue, 2 Sep 2014 20:54:54 +0000 (2 13:54 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 2 Sep 2014 21:11:10 +0000 (2 21:11 +0000)
treec443ce3cbdc862ac4b806d32f2597af9adc2ba8b
parenta838f5d5ede321bf4852ca0c9c5b8be07a95b416
Allow key events to continue propagation for commands without any event listeners.

Rather than complicating the API with proposals of key re injection, or runtime registration/deregistration (which we might want for other reasons in the future), here's a very simple change that would probably give us the same functionality. If an extension remove all chrome.commands.onCommand listeners, then they will no longer receive the onCommand event and thereafter, the browser should continue propagating the key event and not drop it. I think this is actually the correct behavior, but also allows extension authors to have a little more control over when a command should be processed.

BUG=407163

Review URL: https://codereview.chromium.org/504183004

Cr-Commit-Position: refs/heads/master@{#292997}
chrome/browser/extensions/extension_keybinding_apitest.cc
chrome/browser/extensions/extension_keybinding_registry.cc
chrome/test/data/extensions/api_test/keybinding/continue_propagation/background.js [new file with mode: 0644]
chrome/test/data/extensions/api_test/keybinding/continue_propagation/injected.js [new file with mode: 0644]
chrome/test/data/extensions/api_test/keybinding/continue_propagation/manifest.json [new file with mode: 0644]