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

Side by Side Diff: chrome/browser/extensions/api/commands/command_service.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"
(...skipping 29 matching lines...) Expand all
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698