Index: chrome/common/extensions/api/commands/commands_handler.cc |
diff --git a/chrome/common/extensions/api/commands/commands_handler.cc b/chrome/common/extensions/api/commands/commands_handler.cc |
index d49a1056240f4ad8f3c57c01532116b8c1eb1b25..ed28d8dddad53904a2f8654ba46805370bd99a49 100644 |
--- a/chrome/common/extensions/api/commands/commands_handler.cc |
+++ b/chrome/common/extensions/api/commands/commands_handler.cc |
@@ -90,7 +90,19 @@ bool CommandsHandler::Parse(Extension* extension, base::string16* error) { |
return false; // |error| already set. |
if (binding->accelerator().key_code() != ui::VKEY_UNKNOWN) { |
- if (++keybindings_found > kMaxCommandsWithKeybindingPerExtension) { |
+ if (binding->accelerator().modifiers() != 0) { |
+ ++keybindings_found; |
+ } else { |
+ // We only allow media keys to work without modifiers, and they should |
Finnur
2014/02/28 11:02:26
s/We only allow media keys/Only media keys are all
zhchbin
2014/02/28 11:45:22
Done.
|
+ // not count towards the max of four shotcuts per extension. See |
Finnur
2014/02/28 11:02:26
s/shotcuts/shortcuts/
zhchbin
2014/02/28 11:45:22
Done.
|
+ // http://crbug.com/329870. |
Finnur
2014/02/28 11:02:26
The bug doesn't add much to the understanding of t
zhchbin
2014/02/28 11:45:22
Done.
|
+ DCHECK(binding->accelerator().key_code() == ui::VKEY_MEDIA_NEXT_TRACK || |
+ binding->accelerator().key_code() == ui::VKEY_MEDIA_PREV_TRACK || |
+ binding->accelerator().key_code() == ui::VKEY_MEDIA_PLAY_PAUSE || |
+ binding->accelerator().key_code() == ui::VKEY_MEDIA_STOP); |
Finnur
2014/02/28 11:02:26
DCHECK(CommandService::IsMediaKey(binding->acceler
zhchbin
2014/02/28 11:45:22
I didn't use CommandService::IsMediaKey because it
Finnur
2014/02/28 12:31:00
I don't see a problem with one additional header i
zhchbin
2014/02/28 12:44:21
Actually, I got the following message when 'git cl
|
+ } |
+ |
+ if (keybindings_found > kMaxCommandsWithKeybindingPerExtension) { |
*error = ErrorUtils::FormatErrorMessageUTF16( |
manifest_errors::kInvalidKeyBindingTooMany, |
base::IntToString(kMaxCommandsWithKeybindingPerExtension)); |