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

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

Issue 399783002: Begin whitelisting specific extensions for global key registration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update cl with new permission "commands.accessibility". Created 6 years, 4 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 8d0788b121ceacf37f640f0e2fb5da74e2b154c9..07a9f9571f7c26bd4fc67dbb0a0c90dcb36b972b 100644
--- a/chrome/common/extensions/api/commands/commands_handler.cc
+++ b/chrome/common/extensions/api/commands/commands_handler.cc
@@ -10,6 +10,7 @@
#include "chrome/common/extensions/command.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/manifest_constants.h"
+#include "extensions/common/permissions//permissions_data.h"
Finnur 2014/08/21 11:18:10 nit: double slash.
David Tseng 2014/08/21 16:17:56 Done.
namespace extensions {
@@ -97,7 +98,9 @@ bool CommandsHandler::Parse(Extension* extension, base::string16* error) {
if (!Command::IsMediaKey(binding->accelerator()))
++keybindings_found;
- if (keybindings_found > kMaxCommandsWithKeybindingPerExtension) {
+ if (keybindings_found > kMaxCommandsWithKeybindingPerExtension &&
+ !extension->permissions_data()->HasAPIPermission(
+ APIPermission::kCommandsAccessibility)) {
*error = ErrorUtils::FormatErrorMessageUTF16(
manifest_errors::kInvalidKeyBindingTooMany,
base::IntToString(kMaxCommandsWithKeybindingPerExtension));

Powered by Google App Engine
This is Rietveld 408576698