| Index: chrome/browser/ui/views/extensions/extension_keybinding_registry_views.cc
|
| ===================================================================
|
| --- chrome/browser/ui/views/extensions/extension_keybinding_registry_views.cc (revision 134889)
|
| +++ chrome/browser/ui/views/extensions/extension_keybinding_registry_views.cc (working copy)
|
| @@ -5,6 +5,8 @@
|
| #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views.h"
|
|
|
| #include "chrome/browser/extensions/extension_browser_event_router.h"
|
| +#include "chrome/browser/extensions/extension_command_service.h"
|
| +#include "chrome/browser/extensions/extension_command_service_factory.h"
|
| #include "chrome/browser/extensions/extension_service.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/common/extensions/extension.h"
|
| @@ -26,9 +28,12 @@
|
|
|
| void ExtensionKeybindingRegistryViews::AddExtensionKeybinding(
|
| const Extension* extension) {
|
| - // Add all the keybindings (except pageAction and browserAction, which are
|
| - // handled elsewhere).
|
| - const Extension::CommandMap& commands = extension->named_commands();
|
| + ExtensionCommandService* command_service =
|
| + ExtensionCommandServiceFactory::GetForProfile(profile_);
|
| + // Add all the active keybindings (except page actions and browser actions,
|
| + // which are handled elsewhere).
|
| + const Extension::CommandMap& commands =
|
| + command_service->GetActiveNamedCommands(extension->id());
|
| Extension::CommandMap::const_iterator iter = commands.begin();
|
| for (; iter != commands.end(); ++iter) {
|
| event_targets_[iter->second.accelerator()] =
|
| @@ -41,12 +46,17 @@
|
|
|
| void ExtensionKeybindingRegistryViews::RemoveExtensionKeybinding(
|
| const Extension* extension) {
|
| - EventTargets::const_iterator iter;
|
| - for (iter = event_targets_.begin(); iter != event_targets_.end(); ++iter) {
|
| - if (iter->second.first != extension->id())
|
| + EventTargets::iterator iter = event_targets_.begin();
|
| + while (iter != event_targets_.end()) {
|
| + if (iter->second.first != extension->id()) {
|
| + ++iter;
|
| continue; // Not the extension we asked for.
|
| + }
|
|
|
| focus_manager_->UnregisterAccelerator(iter->first, this);
|
| +
|
| + EventTargets::iterator old = iter++;
|
| + event_targets_.erase(old);
|
| }
|
| }
|
|
|
|
|