OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |