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 21 matching lines...) Expand all Loading... |
32 const ui::Accelerator& accelerator) { | 32 const ui::Accelerator& accelerator) { |
33 return extensions::Command::CommandPlatform() + ":" + | 33 return extensions::Command::CommandPlatform() + ":" + |
34 UTF16ToUTF8(accelerator.GetShortcutText()); | 34 UTF16ToUTF8(accelerator.GetShortcutText()); |
35 } | 35 } |
36 | 36 |
37 } // namespace | 37 } // namespace |
38 | 38 |
39 namespace extensions { | 39 namespace extensions { |
40 | 40 |
41 // static | 41 // static |
42 void CommandService::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 42 void CommandService::RegisterUserPrefs( |
43 registry->RegisterDictionaryPref(prefs::kExtensionCommands, | 43 user_prefs::PrefRegistrySyncable* registry) { |
44 PrefRegistrySyncable::SYNCABLE_PREF); | 44 registry->RegisterDictionaryPref( |
| 45 prefs::kExtensionCommands, |
| 46 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
45 } | 47 } |
46 | 48 |
47 CommandService::CommandService(Profile* profile) | 49 CommandService::CommandService(Profile* profile) |
48 : profile_(profile) { | 50 : profile_(profile) { |
49 (new CommandsHandler)->Register(); | 51 (new CommandsHandler)->Register(); |
50 | 52 |
51 ExtensionFunctionRegistry::GetInstance()-> | 53 ExtensionFunctionRegistry::GetInstance()-> |
52 RegisterFunction<GetAllCommandsFunction>(); | 54 RegisterFunction<GetAllCommandsFunction>(); |
53 | 55 |
54 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, | 56 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 return false; | 355 return false; |
354 | 356 |
355 *command = *requested_command; | 357 *command = *requested_command; |
356 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN) | 358 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN) |
357 command->set_accelerator(shortcut_assigned); | 359 command->set_accelerator(shortcut_assigned); |
358 | 360 |
359 return true; | 361 return true; |
360 } | 362 } |
361 | 363 |
362 } // namespace extensions | 364 } // namespace extensions |
OLD | NEW |