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

Unified Diff: services/ui/ws/event_dispatcher.cc

Issue 2586333003: Make mash register initial batch of accelerators in single shot. (Closed)
Patch Set: Fix comments. Move inline function to .h Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: services/ui/ws/event_dispatcher.cc
diff --git a/services/ui/ws/event_dispatcher.cc b/services/ui/ws/event_dispatcher.cc
index f954ac546f9c310f43787ea54b3943df91225390..80a0ed68e96dcd34bc2829face8e38639838084b 100644
--- a/services/ui/ws/event_dispatcher.cc
+++ b/services/ui/ws/event_dispatcher.cc
@@ -234,8 +234,17 @@ bool EventDispatcher::AddAccelerator(uint32_t id,
std::unique_ptr<Accelerator> accelerator(new Accelerator(id, *event_matcher));
// If an accelerator with the same id or matcher already exists, then abort.
for (const auto& pair : accelerators_) {
- if (pair.first == id || accelerator->EqualEventMatcher(pair.second.get()))
+ if (pair.first == id) {
+ DVLOG(1) << "duplicate accelerator. Accelerator id=" << accelerator->id()
+ << " type=" << event_matcher->type_matcher->type
+ << " flags=" << event_matcher->flags_matcher->flags;
return false;
+ } else if (accelerator->EqualEventMatcher(pair.second.get())) {
+ DVLOG(1) << "duplicate matcher. Accelerator id=" << accelerator->id()
+ << " type=" << event_matcher->type_matcher->type
+ << " flags=" << event_matcher->flags_matcher->flags;
+ return false;
+ }
}
accelerators_.insert(Entry(id, std::move(accelerator)));
return true;
« no previous file with comments | « chrome/browser/extensions/global_shortcut_listener_chromeos.cc ('k') | ui/base/accelerators/accelerator_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698