| 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 // Suspend/Resume normal shortcut handling. | 130 ExtensionCommandsGlobalRegistry::Get(Profile::FromWebUI(web_ui()))-> |
| 131 ExtensionKeybindingRegistry::SetShortcutHandlingSuspended(suspended); | 131 SetShortcutHandlingSuspended(suspended); |
| 132 | |
| 133 // Suspend/Resume global shortcut handling. | |
| 134 ExtensionCommandsGlobalRegistry::SetShortcutHandlingSuspended(suspended); | |
| 135 } | 132 } |
| 136 } | 133 } |
| 137 | 134 |
| 138 void CommandHandler::GetAllCommands(base::DictionaryValue* commands) { | 135 void CommandHandler::GetAllCommands(base::DictionaryValue* commands) { |
| 139 base::ListValue* results = new base::ListValue; | 136 base::ListValue* results = new base::ListValue; |
| 140 | 137 |
| 141 Profile* profile = Profile::FromWebUI(web_ui()); | 138 Profile* profile = Profile::FromWebUI(web_ui()); |
| 142 CommandService* command_service = CommandService::Get(profile); | 139 CommandService* command_service = CommandService::Get(profile); |
| 143 | 140 |
| 144 const ExtensionSet& extensions = | 141 const ExtensionSet& extensions = |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 if (!extensions_list->empty()) { | 191 if (!extensions_list->empty()) { |
| 195 extension_dict->Set("commands", extensions_list.release()); | 192 extension_dict->Set("commands", extensions_list.release()); |
| 196 results->Append(extension_dict.release()); | 193 results->Append(extension_dict.release()); |
| 197 } | 194 } |
| 198 } | 195 } |
| 199 | 196 |
| 200 commands->Set("commands", results); | 197 commands->Set("commands", results); |
| 201 } | 198 } |
| 202 | 199 |
| 203 } // namespace extensions | 200 } // namespace extensions |
| OLD | NEW |