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

Unified Diff: chrome/browser/extensions/api/commands/command_service.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: Move IsMediaKey from c/b/e/a/c/command_service.h &&.cc to c/c/e/command.h && .cc 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/browser/extensions/api/commands/command_service.cc
diff --git a/chrome/browser/extensions/api/commands/command_service.cc b/chrome/browser/extensions/api/commands/command_service.cc
index 7beb4e517c9f390352863f118763a11baf977862..a4344c72c6ea7d8311cffb660220e6e9ae5f7c7a 100644
--- a/chrome/browser/extensions/api/commands/command_service.cc
+++ b/chrome/browser/extensions/api/commands/command_service.cc
@@ -54,7 +54,7 @@ std::string GetPlatformKeybindingKeyForAccelerator(
// shortcut (1-to-1 relationship). That means two or more extensions can
// register for the same media key so the extension ID needs to be added to
// the key to make sure the key is unique.
- if (extensions::CommandService::IsMediaKey(accelerator))
+ if (extensions::Command::IsMediaKey(accelerator))
key += ":" + extension_id;
return key;
@@ -90,7 +90,7 @@ bool CanAutoAssign(const ui::Accelerator& accelerator,
bool is_named_command,
bool is_global) {
// Media Keys are non-exclusive, so allow auto-assigning them.
- if (extensions::CommandService::IsMediaKey(accelerator))
+ if (extensions::Command::IsMediaKey(accelerator))
return true;
if (is_global) {
@@ -169,17 +169,6 @@ CommandService* CommandService::Get(content::BrowserContext* context) {
}
// static
-bool CommandService::IsMediaKey(const ui::Accelerator& accelerator) {
- if (accelerator.modifiers() != 0)
- return false;
-
- return (accelerator.key_code() == ui::VKEY_MEDIA_NEXT_TRACK ||
- accelerator.key_code() == ui::VKEY_MEDIA_PREV_TRACK ||
- accelerator.key_code() == ui::VKEY_MEDIA_PLAY_PAUSE ||
- accelerator.key_code() == ui::VKEY_MEDIA_STOP);
-}
-
-// static
bool CommandService::RemovesBookmarkShortcut(
const extensions::Extension* extension) {
using extensions::SettingsOverrides;
@@ -261,7 +250,7 @@ bool CommandService::AddKeybindingPref(
return false;
// Media Keys are allowed to be used by named command only.
- DCHECK(!IsMediaKey(accelerator) ||
+ DCHECK(!Command::IsMediaKey(accelerator) ||
(command_name != manifest_values::kPageActionCommandEvent &&
command_name != manifest_values::kBrowserActionCommandEvent));
« no previous file with comments | « chrome/browser/extensions/api/commands/command_service.h ('k') | chrome/browser/extensions/extension_keybinding_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698