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

Side by Side Diff: chrome/browser/extensions/extension_commands_global_registry.cc

Issue 2407993002: Remove unnecessary keybinding logging (Closed)
Patch Set: remove additional logging statement Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/extension_commands_global_registry.h" 5 #include "chrome/browser/extensions/extension_commands_global_registry.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "chrome/browser/extensions/api/commands/command_service.h" 8 #include "chrome/browser/extensions/api/commands/command_service.h"
9 #include "chrome/browser/extensions/global_shortcut_listener.h" 9 #include "chrome/browser/extensions/global_shortcut_listener.h"
10 #include "extensions/common/extension.h" 10 #include "extensions/common/extension.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 extensions::CommandService::GLOBAL, 76 extensions::CommandService::GLOBAL,
77 &commands)) 77 &commands))
78 return; 78 return;
79 79
80 extensions::CommandMap::const_iterator iter = commands.begin(); 80 extensions::CommandMap::const_iterator iter = commands.begin();
81 for (; iter != commands.end(); ++iter) { 81 for (; iter != commands.end(); ++iter) {
82 if (!command_name.empty() && (iter->second.command_name() != command_name)) 82 if (!command_name.empty() && (iter->second.command_name() != command_name))
83 continue; 83 continue;
84 const ui::Accelerator& accelerator = iter->second.accelerator(); 84 const ui::Accelerator& accelerator = iter->second.accelerator();
85 85
86 VLOG(0) << "Adding global keybinding for " << extension->name().c_str()
87 << " " << command_name.c_str()
88 << " key: " << accelerator.GetShortcutText();
89
90 if (!IsAcceleratorRegistered(accelerator)) { 86 if (!IsAcceleratorRegistered(accelerator)) {
91 if (!GlobalShortcutListener::GetInstance()->RegisterAccelerator( 87 if (!GlobalShortcutListener::GetInstance()->RegisterAccelerator(
92 accelerator, this)) 88 accelerator, this))
93 continue; 89 continue;
94 } 90 }
95 91
96 AddEventTarget(accelerator, extension->id(), iter->second.command_name()); 92 AddEventTarget(accelerator, extension->id(), iter->second.command_name());
97 } 93 }
98 } 94 }
99 95
100 void ExtensionCommandsGlobalRegistry::RemoveExtensionKeybindingImpl( 96 void ExtensionCommandsGlobalRegistry::RemoveExtensionKeybindingImpl(
101 const ui::Accelerator& accelerator, 97 const ui::Accelerator& accelerator,
102 const std::string& command_name) { 98 const std::string& command_name) {
103 VLOG(0) << "Removing keybinding for " << command_name.c_str();
104
105 GlobalShortcutListener::GetInstance()->UnregisterAccelerator( 99 GlobalShortcutListener::GetInstance()->UnregisterAccelerator(
106 accelerator, this); 100 accelerator, this);
107 } 101 }
108 102
109 void ExtensionCommandsGlobalRegistry::OnShortcutHandlingSuspended( 103 void ExtensionCommandsGlobalRegistry::OnShortcutHandlingSuspended(
110 bool suspended) { 104 bool suspended) {
111 GlobalShortcutListener::GetInstance()->SetShortcutHandlingSuspended( 105 GlobalShortcutListener::GetInstance()->SetShortcutHandlingSuspended(
112 suspended); 106 suspended);
113 if (registry_for_active_window()) 107 if (registry_for_active_window())
114 registry_for_active_window()->SetShortcutHandlingSuspended(suspended); 108 registry_for_active_window()->SetShortcutHandlingSuspended(suspended);
115 } 109 }
116 110
117 void ExtensionCommandsGlobalRegistry::OnKeyPressed( 111 void ExtensionCommandsGlobalRegistry::OnKeyPressed(
118 const ui::Accelerator& accelerator) { 112 const ui::Accelerator& accelerator) {
119 ExtensionKeybindingRegistry::NotifyEventTargets(accelerator); 113 ExtensionKeybindingRegistry::NotifyEventTargets(accelerator);
120 } 114 }
121 115
122 } // namespace extensions 116 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698