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

Unified Diff: chrome/common/extensions/api/commands/commands_handler.cc

Issue 180783012: Media Keys should not count towards the max of four shortcuts per extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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/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));

Powered by Google App Engine
This is Rietveld 408576698