Chromium Code Reviews| 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/ui/webui/extensions/command_handler.h" | 5 #include "chrome/browser/ui/webui/extensions/command_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/extensions/api/commands/command_service.h" | 9 #include "chrome/browser/extensions/api/commands/command_service.h" |
| 10 #include "chrome/browser/extensions/extension_commands_global_registry.h" | 10 #include "chrome/browser/extensions/extension_commands_global_registry.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 Profile* profile = Profile::FromWebUI(web_ui()); | 120 Profile* profile = Profile::FromWebUI(web_ui()); |
| 121 CommandService* command_service = CommandService::Get(profile); | 121 CommandService* command_service = CommandService::Get(profile); |
| 122 if (command_service->SetScope(extension_id, command_name, global)) | 122 if (command_service->SetScope(extension_id, command_name, global)) |
| 123 UpdateCommandDataOnPage(); | 123 UpdateCommandDataOnPage(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void CommandHandler::HandleSetShortcutHandlingSuspended( | 126 void CommandHandler::HandleSetShortcutHandlingSuspended( |
| 127 const base::ListValue* args) { | 127 const base::ListValue* args) { |
| 128 bool suspended; | 128 bool suspended; |
| 129 if (args->GetBoolean(0, &suspended)) { | 129 if (args->GetBoolean(0, &suspended)) { |
| 130 ExtensionCommandsGlobalRegistry* global_registry = | |
| 131 ExtensionCommandsGlobalRegistry::Get(Profile::FromWebUI(web_ui())); | |
| 132 | |
| 130 // Suspend/Resume normal shortcut handling. | 133 // Suspend/Resume normal shortcut handling. |
| 131 ExtensionKeybindingRegistry::SetShortcutHandlingSuspended(suspended); | 134 global_registry->registry_for_active_window()-> |
|
Devlin
2015/01/15 22:41:43
nit: Should this maybe go into the ExtensionComman
Andre
2015/01/16 18:40:15
Done.
| |
| 135 SetShortcutHandlingSuspended(suspended); | |
| 132 | 136 |
| 133 // Suspend/Resume global shortcut handling. | 137 // Suspend/Resume global shortcut handling. |
| 134 ExtensionCommandsGlobalRegistry::SetShortcutHandlingSuspended(suspended); | 138 global_registry->SetShortcutHandlingSuspended(suspended); |
| 135 } | 139 } |
| 136 } | 140 } |
| 137 | 141 |
| 138 void CommandHandler::GetAllCommands(base::DictionaryValue* commands) { | 142 void CommandHandler::GetAllCommands(base::DictionaryValue* commands) { |
| 139 base::ListValue* results = new base::ListValue; | 143 base::ListValue* results = new base::ListValue; |
| 140 | 144 |
| 141 Profile* profile = Profile::FromWebUI(web_ui()); | 145 Profile* profile = Profile::FromWebUI(web_ui()); |
| 142 CommandService* command_service = CommandService::Get(profile); | 146 CommandService* command_service = CommandService::Get(profile); |
| 143 | 147 |
| 144 const ExtensionSet& extensions = | 148 const ExtensionSet& extensions = |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 if (!extensions_list->empty()) { | 198 if (!extensions_list->empty()) { |
| 195 extension_dict->Set("commands", extensions_list.release()); | 199 extension_dict->Set("commands", extensions_list.release()); |
| 196 results->Append(extension_dict.release()); | 200 results->Append(extension_dict.release()); |
| 197 } | 201 } |
| 198 } | 202 } |
| 199 | 203 |
| 200 commands->Set("commands", results); | 204 commands->Set("commands", results); |
| 201 } | 205 } |
| 202 | 206 |
| 203 } // namespace extensions | 207 } // namespace extensions |
| OLD | NEW |