Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: chrome/browser/extensions/api/commands/command_service_new.cc

Issue 14694010: Consolidate manifest handler registration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "chrome/browser/extensions/extension_function_registry.h" 11 #include "chrome/browser/extensions/extension_function_registry.h"
12 #include "chrome/browser/extensions/extension_keybinding_registry.h" 12 #include "chrome/browser/extensions/extension_keybinding_registry.h"
13 #include "chrome/browser/extensions/extension_service.h" 13 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/extensions/extension_system.h" 14 #include "chrome/browser/extensions/extension_system.h"
15 #include "chrome/browser/prefs/scoped_user_pref_update.h" 15 #include "chrome/browser/prefs/scoped_user_pref_update.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/common/chrome_notification_types.h" 17 #include "chrome/common/chrome_notification_types.h"
18 #include "chrome/common/extensions/api/commands/commands_handler.h"
19 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
20 #include "components/user_prefs/pref_registry_syncable.h" 19 #include "components/user_prefs/pref_registry_syncable.h"
21 #include "content/public/browser/notification_details.h" 20 #include "content/public/browser/notification_details.h"
22 #include "content/public/browser/notification_service.h" 21 #include "content/public/browser/notification_service.h"
23 22
24 using extensions::Extension; 23 using extensions::Extension;
25 24
26 namespace { 25 namespace {
27 26
28 const char kExtension[] = "extension"; 27 const char kExtension[] = "extension";
(...skipping 10 matching lines...) Expand all
39 namespace extensions { 38 namespace extensions {
40 39
41 // static 40 // static
42 void CommandService::RegisterUserPrefs(PrefRegistrySyncable* registry) { 41 void CommandService::RegisterUserPrefs(PrefRegistrySyncable* registry) {
43 registry->RegisterDictionaryPref(prefs::kExtensionCommands, 42 registry->RegisterDictionaryPref(prefs::kExtensionCommands,
44 PrefRegistrySyncable::SYNCABLE_PREF); 43 PrefRegistrySyncable::SYNCABLE_PREF);
45 } 44 }
46 45
47 CommandService::CommandService(Profile* profile) 46 CommandService::CommandService(Profile* profile)
48 : profile_(profile) { 47 : profile_(profile) {
49 (new CommandsHandler)->Register();
50
51 ExtensionFunctionRegistry::GetInstance()-> 48 ExtensionFunctionRegistry::GetInstance()->
52 RegisterFunction<GetAllCommandsFunction>(); 49 RegisterFunction<GetAllCommandsFunction>();
53 50
54 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, 51 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED,
55 content::Source<Profile>(profile)); 52 content::Source<Profile>(profile));
56 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, 53 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
57 content::Source<Profile>(profile)); 54 content::Source<Profile>(profile));
58 } 55 }
59 56
60 CommandService::~CommandService() { 57 CommandService::~CommandService() {
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 return false; 350 return false;
354 351
355 *command = *requested_command; 352 *command = *requested_command;
356 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN) 353 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN)
357 command->set_accelerator(shortcut_assigned); 354 command->set_accelerator(shortcut_assigned);
358 355
359 return true; 356 return true;
360 } 357 }
361 358
362 } // namespace extensions 359 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698