| 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 "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/extensions/api/commands/commands.h" | 10 #include "chrome/browser/extensions/api/commands/commands.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 const ui::Accelerator& accelerator) { | 33 const ui::Accelerator& accelerator) { |
| 34 return extensions::Command::CommandPlatform() + ":" + | 34 return extensions::Command::CommandPlatform() + ":" + |
| 35 UTF16ToUTF8(accelerator.GetShortcutText()); | 35 UTF16ToUTF8(accelerator.GetShortcutText()); |
| 36 } | 36 } |
| 37 | 37 |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| 40 namespace extensions { | 40 namespace extensions { |
| 41 | 41 |
| 42 // static | 42 // static |
| 43 void CommandService::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 43 void CommandService::RegisterUserPrefs( |
| 44 registry->RegisterDictionaryPref(prefs::kExtensionCommands, | 44 user_prefs::PrefRegistrySyncable* registry) { |
| 45 PrefRegistrySyncable::SYNCABLE_PREF); | 45 registry->RegisterDictionaryPref( |
| 46 prefs::kExtensionCommands, |
| 47 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 46 } | 48 } |
| 47 | 49 |
| 48 CommandService::CommandService(Profile* profile) | 50 CommandService::CommandService(Profile* profile) |
| 49 : profile_(profile) { | 51 : profile_(profile) { |
| 50 (new CommandsHandler)->Register(); | 52 (new CommandsHandler)->Register(); |
| 51 | 53 |
| 52 ExtensionFunctionRegistry::GetInstance()-> | 54 ExtensionFunctionRegistry::GetInstance()-> |
| 53 RegisterFunction<GetAllCommandsFunction>(); | 55 RegisterFunction<GetAllCommandsFunction>(); |
| 54 | 56 |
| 55 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, | 57 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 return false; | 368 return false; |
| 367 | 369 |
| 368 *command = *requested_command; | 370 *command = *requested_command; |
| 369 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN) | 371 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN) |
| 370 command->set_accelerator(shortcut_assigned); | 372 command->set_accelerator(shortcut_assigned); |
| 371 | 373 |
| 372 return true; | 374 return true; |
| 373 } | 375 } |
| 374 | 376 |
| 375 } // namespace extensions | 377 } // namespace extensions |
| OLD | NEW |