| 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 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 // static | 41 // static |
| 42 void CommandService::RegisterUserPrefs(PrefServiceSyncable* user_prefs) { | 42 void CommandService::RegisterUserPrefs(PrefServiceSyncable* user_prefs) { |
| 43 user_prefs->RegisterDictionaryPref(prefs::kExtensionCommands, | 43 user_prefs->RegisterDictionaryPref(prefs::kExtensionCommands, |
| 44 PrefServiceSyncable::SYNCABLE_PREF); | 44 PrefServiceSyncable::SYNCABLE_PREF); |
| 45 } | 45 } |
| 46 | 46 |
| 47 CommandService::CommandService(Profile* profile) | 47 CommandService::CommandService(Profile* profile) |
| 48 : profile_(profile) { | 48 : profile_(profile) { |
| 49 ManifestHandler::Register(extension_manifest_keys::kCommands, | 49 ManifestHandler::Register(extension_manifest_keys::kCommands, |
| 50 new CommandsHandler); | 50 make_linked_ptr(new CommandsHandler)); |
| 51 | 51 |
| 52 ExtensionFunctionRegistry::GetInstance()-> | 52 ExtensionFunctionRegistry::GetInstance()-> |
| 53 RegisterFunction<GetAllCommandsFunction>(); | 53 RegisterFunction<GetAllCommandsFunction>(); |
| 54 | 54 |
| 55 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, | 55 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, |
| 56 content::Source<Profile>(profile)); | 56 content::Source<Profile>(profile)); |
| 57 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, | 57 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, |
| 58 content::Source<Profile>(profile)); | 58 content::Source<Profile>(profile)); |
| 59 } | 59 } |
| 60 | 60 |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 return false; | 357 return false; |
| 358 | 358 |
| 359 *command = *requested_command; | 359 *command = *requested_command; |
| 360 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN) | 360 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN) |
| 361 command->set_accelerator(shortcut_assigned); | 361 command->set_accelerator(shortcut_assigned); |
| 362 | 362 |
| 363 return true; | 363 return true; |
| 364 } | 364 } |
| 365 | 365 |
| 366 } // namespace extensions | 366 } // namespace extensions |
| OLD | NEW |