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

Side by Side Diff: components/mus/ws/event_dispatcher.cc

Issue 1819413002: Don't DCHECK in EventDispatcher::RemoveAccelerator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/mus/ws/event_dispatcher.h" 5 #include "components/mus/ws/event_dispatcher.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "cc/surfaces/surface_hittest.h" 10 #include "cc/surfaces/surface_hittest.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 for (const auto& pair : accelerators_) { 308 for (const auto& pair : accelerators_) {
309 if (pair.first == id || matcher.Equals(pair.second)) 309 if (pair.first == id || matcher.Equals(pair.second))
310 return false; 310 return false;
311 } 311 }
312 accelerators_.insert(Entry(id, matcher)); 312 accelerators_.insert(Entry(id, matcher));
313 return true; 313 return true;
314 } 314 }
315 315
316 void EventDispatcher::RemoveAccelerator(uint32_t id) { 316 void EventDispatcher::RemoveAccelerator(uint32_t id) {
317 auto it = accelerators_.find(id); 317 auto it = accelerators_.find(id);
318 DCHECK(it != accelerators_.end()); 318 // Clients may pass bogus ids.
319 accelerators_.erase(it); 319 if (it != accelerators_.end())
320 accelerators_.erase(it);
320 } 321 }
321 322
322 void EventDispatcher::ProcessEvent(const ui::Event& event) { 323 void EventDispatcher::ProcessEvent(const ui::Event& event) {
323 if (!root_) 324 if (!root_)
324 return; 325 return;
325 326
326 if (event.IsKeyEvent()) { 327 if (event.IsKeyEvent()) {
327 const ui::KeyEvent* key_event = event.AsKeyEvent(); 328 const ui::KeyEvent* key_event = event.AsKeyEvent();
328 if (event.type() == ui::ET_KEY_PRESSED && !key_event->is_char()) { 329 if (event.type() == ui::ET_KEY_PRESSED && !key_event->is_char()) {
329 uint32_t accelerator = 0u; 330 uint32_t accelerator = 0u;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 562
562 void EventDispatcher::OnWindowDestroyed(ServerWindow* window) { 563 void EventDispatcher::OnWindowDestroyed(ServerWindow* window) {
563 CancelPointerEventsToTarget(window); 564 CancelPointerEventsToTarget(window);
564 565
565 if (mouse_cursor_source_window_ == window) 566 if (mouse_cursor_source_window_ == window)
566 mouse_cursor_source_window_ = nullptr; 567 mouse_cursor_source_window_ = nullptr;
567 } 568 }
568 569
569 } // namespace ws 570 } // namespace ws
570 } // namespace mus 571 } // namespace mus
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