Comment #27 on issue 131612 by
fin...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612
I'm worried that we are getting too bogged down on supporting the Media
Keys specifically, and not focused enough on providing a general purpose
solution for global Commands. A Media key is just one type of key it should
support and I think it would help nudge the design in the right direction
if we assume (just for the sake of discussing the design) that we're not
going to support any Media keys. For example, how would this look if we
were trying to support Ctrl+Shift+A (or something) globally? (Once we have
that working it is easy to add MediaKeys to the mix.
From an API standpoint we talked about (see proposal
https://docs.google.com/a/google.com/document/d/1mFmxLoYrcwdg1pouXpC_MC4SF-nMWDzWaMNrIHgM1pM/edit)
adding a global flag, such as:
"commands": {
"next-track": {
"suggested_key": {
"default": "MediaKeyNext",
"global": true <- This.
},
"description": "Go to the next track in Rdio."
},
},
It follows from this proposal that we need changes on these fronts (and
this is also the order of how I would attack the problem):
1) We should add a global handler that keeps a registry of keys that
extensions want to listen to globally.
2) The global handler needs to handle not just the Media keys eventually
but also the other keys we can parse from the manifest (ie. Ctrl+Shift+A).
3) We should add MediaKey* keys as keys that we can parse from the manifest
(see ParseImpl of chrome/common/extensions/command.cc).
4) The non-global (current) Command handler needs to handle the new Media
keys and I think we get that for free assuming Chrome sees the media keys
when it has focus -- I don't have such a keyboard to test it.
I don't quite understand why we'd need a separate enable_media_keys flag or
a separate mediaKeys permission.
The latter may be an attempt to get around the fact that Apps by design
don't have access to the Commands permission/object (which is intentional
because they already have a more powerful JS API available to them that
they should use) but if that's the case, then I'd rather open this API up
to apps but restrict Apps to use only global shortcuts (trying to register
shortcuts in Apps without specifying global:true should then result in an
error).