| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef MEDIA_BASE_USER_INPUT_MONITOR_H_ | 5 #ifndef MEDIA_BASE_USER_INPUT_MONITOR_H_ |
| 6 #define MEDIA_BASE_USER_INPUT_MONITOR_H_ | 6 #define MEDIA_BASE_USER_INPUT_MONITOR_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | |
| 13 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 14 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 15 #include "media/base/media_export.h" | 14 #include "media/base/media_export.h" |
| 16 #include "ui/base/events/event_constants.h" | 15 #include "ui/base/events/event_constants.h" |
| 17 #include "ui/base/keycodes/keyboard_codes.h" | 16 #include "ui/base/keycodes/keyboard_codes.h" |
| 18 | 17 |
| 19 struct SkIPoint; | 18 struct SkIPoint; |
| 20 | 19 |
| 21 namespace base { | 20 namespace base { |
| 22 class SingleThreadTaskRunner; | 21 class SingleThreadTaskRunner; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // listeners. | 74 // listeners. |
| 76 void OnMouseEvent(const SkIPoint& position); | 75 void OnMouseEvent(const SkIPoint& position); |
| 77 void OnKeyboardEvent(ui::EventType event, ui::KeyboardCode key_code); | 76 void OnKeyboardEvent(ui::EventType event, ui::KeyboardCode key_code); |
| 78 | 77 |
| 79 private: | 78 private: |
| 80 virtual void StartMouseMonitoring() = 0; | 79 virtual void StartMouseMonitoring() = 0; |
| 81 virtual void StopMouseMonitoring() = 0; | 80 virtual void StopMouseMonitoring() = 0; |
| 82 virtual void StartKeyboardMonitoring() = 0; | 81 virtual void StartKeyboardMonitoring() = 0; |
| 83 virtual void StopKeyboardMonitoring() = 0; | 82 virtual void StopKeyboardMonitoring() = 0; |
| 84 | 83 |
| 84 // Polling the key state perodically on Mac. |
| 85 void PollKeyState(); |
| 86 |
| 85 base::Lock lock_; | 87 base::Lock lock_; |
| 86 ObserverList<MouseEventListener, true> mouse_listeners_; | 88 ObserverList<MouseEventListener, true> mouse_listeners_; |
| 87 ObserverList<KeyStrokeListener, true> key_stroke_listeners_; | 89 ObserverList<KeyStrokeListener, true> key_stroke_listeners_; |
| 88 bool monitoring_mouse_; | 90 bool monitoring_mouse_; |
| 89 bool monitoring_keyboard_; | 91 bool monitoring_keyboard_; |
| 90 // The set of keys currently held down. Used for convering raw keyboard events | 92 // The set of keys currently held down. Used for convering raw keyboard events |
| 91 // into KeyStrokeListener callbacks. | 93 // into KeyStrokeListener callbacks. |
| 92 std::set<ui::KeyboardCode> pressed_keys_; | 94 std::set<int> pressed_keys_; |
| 93 | 95 |
| 94 DISALLOW_COPY_AND_ASSIGN(UserInputMonitor); | 96 DISALLOW_COPY_AND_ASSIGN(UserInputMonitor); |
| 95 }; | 97 }; |
| 96 | 98 |
| 97 } // namespace media | 99 } // namespace media |
| 98 | 100 |
| 99 #endif // MEDIA_BASE_USER_INPUT_MONITOR_H_ | 101 #endif // MEDIA_BASE_USER_INPUT_MONITOR_H_ |
| OLD | NEW |