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/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/extensions/api/commands/commands.h" | 10 #include "chrome/browser/extensions/api/commands/commands.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 const ui::Accelerator& accelerator) { | 31 const ui::Accelerator& accelerator) { |
32 return extensions::Command::CommandPlatform() + ":" + | 32 return extensions::Command::CommandPlatform() + ":" + |
33 UTF16ToUTF8(accelerator.GetShortcutText()); | 33 UTF16ToUTF8(accelerator.GetShortcutText()); |
34 } | 34 } |
35 | 35 |
36 } // namespace | 36 } // namespace |
37 | 37 |
38 namespace extensions { | 38 namespace extensions { |
39 | 39 |
40 // static | 40 // static |
41 void CommandService::RegisterUserPrefs( | 41 void CommandService::RegisterProfilePrefs( |
42 user_prefs::PrefRegistrySyncable* registry) { | 42 user_prefs::PrefRegistrySyncable* registry) { |
43 registry->RegisterDictionaryPref( | 43 registry->RegisterDictionaryPref( |
44 prefs::kExtensionCommands, | 44 prefs::kExtensionCommands, |
45 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 45 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
46 } | 46 } |
47 | 47 |
48 CommandService::CommandService(Profile* profile) | 48 CommandService::CommandService(Profile* profile) |
49 : profile_(profile) { | 49 : profile_(profile) { |
50 ExtensionFunctionRegistry::GetInstance()-> | 50 ExtensionFunctionRegistry::GetInstance()-> |
51 RegisterFunction<GetAllCommandsFunction>(); | 51 RegisterFunction<GetAllCommandsFunction>(); |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 return false; | 354 return false; |
355 | 355 |
356 *command = *requested_command; | 356 *command = *requested_command; |
357 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN) | 357 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN) |
358 command->set_accelerator(shortcut_assigned); | 358 command->set_accelerator(shortcut_assigned); |
359 | 359 |
360 return true; | 360 return true; |
361 } | 361 } |
362 | 362 |
363 } // namespace extensions | 363 } // namespace extensions |
OLD | NEW |