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 5d38936f1aba3355f5fa43942d57741e4bc2eae1..5672e4366fb24737701f6fa618c1d1abe68e7538 100644 |
--- a/chrome/browser/extensions/api/commands/command_service.cc |
+++ b/chrome/browser/extensions/api/commands/command_service.cc |
@@ -9,6 +9,7 @@ |
#include "base/strings/utf_string_conversions.h" |
#include "chrome/browser/chrome_notification_types.h" |
#include "chrome/browser/extensions/api/commands/commands.h" |
+#include "chrome/browser/extensions/extension_commands_global_registry.h" |
#include "chrome/browser/extensions/extension_function_registry.h" |
#include "chrome/browser/extensions/extension_keybinding_registry.h" |
#include "chrome/browser/extensions/extension_service.h" |
@@ -74,6 +75,8 @@ CommandService::CommandService(Profile* profile) |
ExtensionFunctionRegistry::GetInstance()-> |
RegisterFunction<GetAllCommandsFunction>(); |
+ ExtensionCommandsGlobalRegistry::GetFactoryInstance()->GetForProfile(profile); |
+ |
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, |
content::Source<Profile>(profile)); |
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, |
@@ -125,6 +128,7 @@ bool CommandService::GetScriptBadgeCommand( |
bool CommandService::GetNamedCommands(const std::string& extension_id, |
QueryType type, |
+ CommandScope scope, |
extensions::CommandMap* command_map) { |
const ExtensionSet* extensions = |
ExtensionSystem::Get(profile_)->extension_service()->extensions(); |
@@ -146,6 +150,9 @@ bool CommandService::GetNamedCommands(const std::string& extension_id, |
continue; |
extensions::Command command = iter->second; |
+ if (scope != ANY_SCOPE && ((scope == GLOBAL) != command.global())) |
+ continue; |
+ |
if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN) |
command.set_accelerator(shortcut_assigned); |