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

Side by Side Diff: chrome/browser/extensions/api/commands/command_service.cc

Issue 399783002: Begin whitelisting specific extensions for global key registration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nits; rebase 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/api/commands/command_service.h" 5 #include "chrome/browser/extensions/api/commands/command_service.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/prefs/scoped_user_pref_update.h" 10 #include "base/prefs/scoped_user_pref_update.h"
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 // changed from the previous value. 558 // changed from the previous value.
559 if (IsCommandShortcutUserModified(extension, command.command_name())) 559 if (IsCommandShortcutUserModified(extension, command.command_name()))
560 return false; 560 return false;
561 561
562 if (command.global()) { 562 if (command.global()) {
563 using namespace extensions; 563 using namespace extensions;
564 if (command.command_name() == manifest_values::kBrowserActionCommandEvent || 564 if (command.command_name() == manifest_values::kBrowserActionCommandEvent ||
565 command.command_name() == manifest_values::kPageActionCommandEvent) 565 command.command_name() == manifest_values::kPageActionCommandEvent)
566 return false; // Browser and page actions are not global in nature. 566 return false; // Browser and page actions are not global in nature.
567 567
568 if (extension->permissions_data()->HasAPIPermission(
569 APIPermission::kCommandsAccessibility))
570 return true;
571
568 // Global shortcuts are restricted to (Ctrl|Command)+Shift+[0-9]. 572 // Global shortcuts are restricted to (Ctrl|Command)+Shift+[0-9].
569 #if defined OS_MACOSX 573 #if defined OS_MACOSX
570 if (!command.accelerator().IsCmdDown()) 574 if (!command.accelerator().IsCmdDown())
571 return false; 575 return false;
572 #else 576 #else
573 if (!command.accelerator().IsCtrlDown()) 577 if (!command.accelerator().IsCtrlDown())
574 return false; 578 return false;
575 #endif 579 #endif
576 if (!command.accelerator().IsShiftDown()) 580 if (!command.accelerator().IsShiftDown())
577 return false; 581 return false;
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 return true; 863 return true;
860 } 864 }
861 865
862 template <> 866 template <>
863 void 867 void
864 BrowserContextKeyedAPIFactory<CommandService>::DeclareFactoryDependencies() { 868 BrowserContextKeyedAPIFactory<CommandService>::DeclareFactoryDependencies() {
865 DependsOn(ExtensionCommandsGlobalRegistry::GetFactoryInstance()); 869 DependsOn(ExtensionCommandsGlobalRegistry::GetFactoryInstance());
866 } 870 }
867 871
868 } // namespace extensions 872 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/api/_permission_features.json » ('j') | chrome/common/extensions/command.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698