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

Side by Side Diff: chrome/browser/ui/views/extensions/extension_keybinding_registry_views.cc

Issue 10387224: Rename ExtensionCommand* to Command* within the extension namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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/ui/views/extensions/extension_keybinding_registry_views .h" 5 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views .h"
6 6
7 #include "chrome/browser/extensions/api/commands/extension_command_service.h" 7 #include "chrome/browser/extensions/api/commands/command_service.h"
8 #include "chrome/browser/extensions/api/commands/extension_command_service_facto ry.h" 8 #include "chrome/browser/extensions/api/commands/command_service_factory.h"
9 #include "chrome/browser/extensions/extension_browser_event_router.h" 9 #include "chrome/browser/extensions/extension_browser_event_router.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/extensions/extension.h" 12 #include "chrome/common/extensions/extension.h"
13 #include "ui/views/focus/focus_manager.h" 13 #include "ui/views/focus/focus_manager.h"
14 14
15 ExtensionKeybindingRegistryViews::ExtensionKeybindingRegistryViews( 15 ExtensionKeybindingRegistryViews::ExtensionKeybindingRegistryViews(
16 Profile* profile, views::FocusManager* focus_manager) 16 Profile* profile, views::FocusManager* focus_manager)
17 : ExtensionKeybindingRegistry(profile), 17 : ExtensionKeybindingRegistry(profile),
18 profile_(profile), 18 profile_(profile),
19 focus_manager_(focus_manager) { 19 focus_manager_(focus_manager) {
20 Init(); 20 Init();
21 } 21 }
22 22
23 ExtensionKeybindingRegistryViews::~ExtensionKeybindingRegistryViews() { 23 ExtensionKeybindingRegistryViews::~ExtensionKeybindingRegistryViews() {
24 EventTargets::const_iterator iter; 24 EventTargets::const_iterator iter;
25 for (iter = event_targets_.begin(); iter != event_targets_.end(); ++iter) 25 for (iter = event_targets_.begin(); iter != event_targets_.end(); ++iter)
26 focus_manager_->UnregisterAccelerator(iter->first, this); 26 focus_manager_->UnregisterAccelerator(iter->first, this);
27 } 27 }
28 28
29 void ExtensionKeybindingRegistryViews::AddExtensionKeybinding( 29 void ExtensionKeybindingRegistryViews::AddExtensionKeybinding(
30 const extensions::Extension* extension) { 30 const extensions::Extension* extension) {
31 extensions::ExtensionCommandService* command_service = 31 extensions::CommandService* command_service =
32 extensions::ExtensionCommandServiceFactory::GetForProfile(profile_); 32 extensions::CommandServiceFactory::GetForProfile(profile_);
33 // Add all the active keybindings (except page actions and browser actions, 33 // Add all the active keybindings (except page actions and browser actions,
34 // which are handled elsewhere). 34 // which are handled elsewhere).
35 const extensions::CommandMap& commands = 35 const extensions::CommandMap& commands =
36 command_service->GetNamedCommands( 36 command_service->GetNamedCommands(
37 extension->id(), 37 extension->id(), extensions::CommandService::ACTIVE_ONLY);
38 extensions::ExtensionCommandService::ACTIVE_ONLY);
39 extensions::CommandMap::const_iterator iter = commands.begin(); 38 extensions::CommandMap::const_iterator iter = commands.begin();
40 for (; iter != commands.end(); ++iter) { 39 for (; iter != commands.end(); ++iter) {
41 event_targets_[iter->second.accelerator()] = 40 event_targets_[iter->second.accelerator()] =
42 std::make_pair(extension->id(), iter->second.command_name()); 41 std::make_pair(extension->id(), iter->second.command_name());
43 focus_manager_->RegisterAccelerator( 42 focus_manager_->RegisterAccelerator(
44 iter->second.accelerator(), 43 iter->second.accelerator(),
45 ui::AcceleratorManager::kHighPriority, this); 44 ui::AcceleratorManager::kHighPriority, this);
46 } 45 }
47 } 46 }
48 47
(...skipping 25 matching lines...) Expand all
74 73
75 service->browser_event_router()->CommandExecuted( 74 service->browser_event_router()->CommandExecuted(
76 profile_, it->second.first, it->second.second); 75 profile_, it->second.first, it->second.second);
77 76
78 return true; 77 return true;
79 } 78 }
80 79
81 bool ExtensionKeybindingRegistryViews::CanHandleAccelerators() const { 80 bool ExtensionKeybindingRegistryViews::CanHandleAccelerators() const {
82 return true; 81 return true;
83 } 82 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698