| 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 namespace extensions { | 40 namespace extensions { |
| 41 | 41 |
| 42 // static | 42 // static |
| 43 void CommandService::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 43 void CommandService::RegisterUserPrefs(PrefRegistrySyncable* registry) { |
| 44 registry->RegisterDictionaryPref(prefs::kExtensionCommands, | 44 registry->RegisterDictionaryPref(prefs::kExtensionCommands, |
| 45 PrefRegistrySyncable::SYNCABLE_PREF); | 45 PrefRegistrySyncable::SYNCABLE_PREF); |
| 46 } | 46 } |
| 47 | 47 |
| 48 CommandService::CommandService(Profile* profile) | 48 CommandService::CommandService(Profile* profile) |
| 49 : profile_(profile) { | 49 : profile_(profile) { |
| 50 (new CommandsHandler)->Register(); | |
| 51 | |
| 52 ExtensionFunctionRegistry::GetInstance()-> | 50 ExtensionFunctionRegistry::GetInstance()-> |
| 53 RegisterFunction<GetAllCommandsFunction>(); | 51 RegisterFunction<GetAllCommandsFunction>(); |
| 54 | 52 |
| 55 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, | 53 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, |
| 56 content::Source<Profile>(profile)); | 54 content::Source<Profile>(profile)); |
| 57 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, | 55 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, |
| 58 content::Source<Profile>(profile)); | 56 content::Source<Profile>(profile)); |
| 59 } | 57 } |
| 60 | 58 |
| 61 CommandService::~CommandService() { | 59 CommandService::~CommandService() { |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 return false; | 364 return false; |
| 367 | 365 |
| 368 *command = *requested_command; | 366 *command = *requested_command; |
| 369 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN) | 367 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN) |
| 370 command->set_accelerator(shortcut_assigned); | 368 command->set_accelerator(shortcut_assigned); |
| 371 | 369 |
| 372 return true; | 370 return true; |
| 373 } | 371 } |
| 374 | 372 |
| 375 } // namespace extensions | 373 } // namespace extensions |
| OLD | NEW |