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

Unified Diff: media/base/user_input_monitor.h

Issue 23702008: Adds the UserInputMonitor implementation for Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: media/base/user_input_monitor.h
diff --git a/media/base/user_input_monitor.h b/media/base/user_input_monitor.h
index 567907c76f8fc2cbad0554e060fff22a13c6dcf9..890ca5e4f18326146b3cce84328f90ed76af6232 100644
--- a/media/base/user_input_monitor.h
+++ b/media/base/user_input_monitor.h
@@ -5,8 +5,8 @@
#ifndef MEDIA_BASE_USER_INPUT_MONITOR_H_
#define MEDIA_BASE_USER_INPUT_MONITOR_H_
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
-#include "base/observer_list.h"
#include "base/synchronization/lock.h"
#include "media/base/media_export.h"
@@ -19,11 +19,8 @@ class SingleThreadTaskRunner;
namespace media {
// Monitors and notifies about mouse movements and keyboard events.
-// Thread safe. The thread on which the listenters are called is not guaranteed.
-// The callers should not perform expensive/blocking tasks in the callback since
-// it might be called on the browser UI/IO threads.
-// The object must outlive the browser UI/IO threads to make sure the callbacks
-// will not access a deleted object.
+// Thread safe. The listeners are called on the thread where the listeners are
+// added.
class MEDIA_EXPORT UserInputMonitor {
public:
// The interface to receive mouse movement events.
@@ -49,8 +46,8 @@ class MEDIA_EXPORT UserInputMonitor {
// The same |listener| should only be added once.
// The clients should make sure to call Remove*Listener before |listener| is
// destroyed.
- void AddMouseListener(MouseEventListener* listener);
- void RemoveMouseListener(MouseEventListener* listener);
+ virtual void AddMouseListener(MouseEventListener* listener) = 0;
+ virtual void RemoveMouseListener(MouseEventListener* listener) = 0;
// A caller must call EnableKeyPressMonitoring and
// DisableKeyPressMonitoring in pair.
@@ -65,20 +62,11 @@ class MEDIA_EXPORT UserInputMonitor {
// any assumption on the initial value.
virtual size_t GetKeyPressCount() const = 0;
- protected:
- // Called by the platform-specific sub-classes to propagate the events to the
- // listeners.
- void OnMouseEvent(const SkIPoint& position);
-
private:
- virtual void StartMouseMonitoring() = 0;
- virtual void StopMouseMonitoring() = 0;
virtual void StartKeyboardMonitoring() = 0;
virtual void StopKeyboardMonitoring() = 0;
base::Lock lock_;
- ObserverList<MouseEventListener, true> mouse_listeners_;
- bool monitoring_mouse_;
size_t key_press_counter_references_;
DISALLOW_COPY_AND_ASSIGN(UserInputMonitor);

Powered by Google App Engine
This is Rietveld 408576698