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

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: Fix tests. 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..4fc4d22b37753b1f2fb75c5cde35a62c28b9b1ed 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/manifest_handlers/permissions_parser.h"
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 &&
+ !PermissionsParser::HasAPIPermission(
+ extension, APIPermission::kCommandsAccessibility)) {
*error = ErrorUtils::FormatErrorMessageUTF16(
manifest_errors::kInvalidKeyBindingTooMany,
base::IntToString(kMaxCommandsWithKeybindingPerExtension));
« no previous file with comments | « chrome/common/extensions/api/_permission_features.json ('k') | chrome/common/extensions/permissions/chrome_api_permissions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698