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

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

Issue 547783002: Fixes HasEventListener check in ExtensionKeybindingRegistry::ExecuteCommands. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chromevox_commands
Patch Set: Created 6 years, 3 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) 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/extension_keybinding_registry.h" 5 #include "chrome/browser/extensions/extension_keybinding_registry.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/extensions/active_tab_permission_granter.h" 8 #include "chrome/browser/extensions/active_tab_permission_granter.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 case PLATFORM_APPS_ONLY: 226 case PLATFORM_APPS_ONLY:
227 return extension->is_platform_app(); 227 return extension->is_platform_app();
228 default: 228 default:
229 NOTREACHED(); 229 NOTREACHED();
230 } 230 }
231 return false; 231 return false;
232 } 232 }
233 233
234 bool ExtensionKeybindingRegistry::ExecuteCommands( 234 bool ExtensionKeybindingRegistry::ExecuteCommands(
235 const ui::Accelerator& accelerator, 235 const ui::Accelerator& accelerator,
236 const std::string& extension_id) { 236 const std::string& extension_id) {
Finnur 2014/09/08 15:23:15 I wonder if we should add a comment in here, since
237 EventTargets::iterator targets = event_targets_.find(accelerator); 237 EventTargets::iterator targets = event_targets_.find(accelerator);
238 if (targets == event_targets_.end() || targets->second.empty()) 238 if (targets == event_targets_.end() || targets->second.empty())
239 return false; 239 return false;
240 240
241 if (!extension_id.empty() &&
242 !extensions::EventRouter::Get(browser_context_)
243 ->ExtensionHasEventListener(extension_id, kOnCommandEventName))
244 return false;
245
246 bool executed = false; 241 bool executed = false;
247 for (TargetList::const_iterator it = targets->second.begin(); 242 for (TargetList::const_iterator it = targets->second.begin();
248 it != targets->second.end(); it++) { 243 it != targets->second.end(); it++) {
244 if (!extensions::EventRouter::Get(browser_context_)
245 ->ExtensionHasEventListener(it->first, kOnCommandEventName))
246 continue;
247
249 if (extension_id.empty() || it->first == extension_id) { 248 if (extension_id.empty() || it->first == extension_id) {
250 CommandExecuted(it->first, it->second); 249 CommandExecuted(it->first, it->second);
251 executed = true; 250 executed = true;
252 } 251 }
253 } 252 }
254 253
255 return executed; 254 return executed;
256 } 255 }
257 256
258 } // namespace extensions 257 } // 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