Chromium Code Reviews| Index: media/base/user_input_monitor.cc |
| diff --git a/media/base/user_input_monitor.cc b/media/base/user_input_monitor.cc |
| index 18b4c8060f64e34437d4e3e9222fde4d18af520a..2307145956c4c6630fc51daf6fff7a61d5bc8e76 100644 |
| --- a/media/base/user_input_monitor.cc |
| +++ b/media/base/user_input_monitor.cc |
| @@ -71,13 +71,24 @@ void UserInputMonitor::OnKeyboardEvent(ui::EventType event, |
| ui::KeyboardCode key_code) { |
| base::AutoLock auto_lock(lock_); |
| // Updates the pressed keys and maybe notifies the key_stroke_listeners_. |
| + // The Mac implementation does not listen to the the key down/up events, but |
| + // polls the key state and only notifies UserInputMonitor when a key is down |
| + // now but not in the previous polling. So we do not check/update |
| + // |pressed_keys_| here. |
| if (event == ui::ET_KEY_PRESSED) { |
| +#if !defined(OS_MACOSX) |
| if (pressed_keys_.find(key_code) != pressed_keys_.end()) |
| return; |
| pressed_keys_.insert(key_code); |
| +#endif |
| + |
| DVLOG(6) << "Key stroke detected."; |
| FOR_EACH_OBSERVER(KeyStrokeListener, key_stroke_listeners_, OnKeyStroke()); |
| } else { |
| +#if defined(OS_MACOSX) |
| + DCHECK(false); |
|
Mark Mentovai
2013/08/21 18:32:43
Oh, so NOTREACHED?
You still should write “return
jiayl
2013/08/21 22:58:22
Done.
|
| +#endif |
| + |
| DCHECK_EQ(ui::ET_KEY_RELEASED, event); |
| DCHECK(pressed_keys_.find(key_code) != pressed_keys_.end()); |
| pressed_keys_.erase(key_code); |