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

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

Issue 504183004: Continue key propagation for extensions without any listeners to chrome.commands.onCommand. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 return false; 227 return false;
228 } 228 }
229 229
230 bool ExtensionKeybindingRegistry::ExecuteCommands( 230 bool ExtensionKeybindingRegistry::ExecuteCommands(
231 const ui::Accelerator& accelerator, 231 const ui::Accelerator& accelerator,
232 const std::string& extension_id) { 232 const std::string& extension_id) {
233 EventTargets::iterator targets = event_targets_.find(accelerator); 233 EventTargets::iterator targets = event_targets_.find(accelerator);
234 if (targets == event_targets_.end() || targets->second.empty()) 234 if (targets == event_targets_.end() || targets->second.empty())
235 return false; 235 return false;
236 236
237 if (!extensions::EventRouter::Get(browser_context_)
Finnur 2014/08/27 11:28:31 Be careful here: extension_id can be empty (see No
David Tseng 2014/08/27 16:34:22 You're totally right; this broke the majority of t
238 ->ExtensionHasEventListener(
239 extension_id,
240 "commands.onCommand"))
Finnur 2014/08/27 11:28:31 This string literal also appears on line 118, so a
David Tseng 2014/08/27 16:34:22 Done.
241 return false;
242
Finnur 2014/08/27 11:28:31 I'd like to see tests added for this functionality
David Tseng 2014/08/27 16:34:22 Working on some tests now; the existing tests appe
237 bool executed = false; 243 bool executed = false;
238 for (TargetList::const_iterator it = targets->second.begin(); 244 for (TargetList::const_iterator it = targets->second.begin();
239 it != targets->second.end(); it++) { 245 it != targets->second.end(); it++) {
240 if (extension_id.empty() || it->first == extension_id) { 246 if (extension_id.empty() || it->first == extension_id) {
241 CommandExecuted(it->first, it->second); 247 CommandExecuted(it->first, it->second);
242 executed = true; 248 executed = true;
243 } 249 }
244 } 250 }
245 251
246 return executed; 252 return executed;
247 } 253 }
248 254
249 } // namespace extensions 255 } // 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