Index: media/base/user_input_monitor.h |
diff --git a/media/base/user_input_monitor.h b/media/base/user_input_monitor.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3fea358c13e1c5b666e592540fa0e8a1be36c19a |
--- /dev/null |
+++ b/media/base/user_input_monitor.h |
@@ -0,0 +1,67 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#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/memory/weak_ptr.h" |
+#include "ui/base/events/event_constants.h" |
+#include "ui/base/keycodes/keyboard_codes.h" |
+ |
+struct SkIPoint; |
+ |
+namespace base { |
+class SingleThreadTaskRunner; |
+} // namespace base |
+ |
+namespace media { |
+ |
+// Called on the |observer_task_runner|. |
+class UserInputObserver { |
+ public: |
+ // Called when the mouse is moved. |
+ virtual void OnMouseMoved(const SkIPoint& position) = 0; |
+ // Called when a key is pressed or released. |
+ // |event| can only be ui::ET_KEY_PRESSED or ui::ET_KEY_RELEASED. |
+ virtual void OnKeyboardEvent(ui::EventType event, |
+ ui::KeyboardCode key_code) = 0; |
+}; |
DaleCurtis
2013/08/07 18:58:02
Needs protected virtual destructor with empty impl
|
+ |
+// Monitors and notifies about mouse movements and keyboard events. |
+class UserInputMonitor { |
+ public: |
+ // Bit masks for specifying input events of interest. |
+ enum InputEvent { |
+ MOUSE_MOVEMENT = 0x1, |
+ KEYBOARD_EVENT = 0x2, |
+ }; |
+ |
+ virtual ~UserInputMonitor() {} |
DaleCurtis
2013/08/07 18:58:02
protected.
|
+ |
+ // Creates a platform-specific instance of UserInputMonitor. |
+ // |input_task_runner| is the task runner for an IO thread to process events |
DaleCurtis
2013/08/07 18:58:02
You mention mac / linux / win here, but it's a gen
|
+ // on Linux; |ui_task_runner| is the task runner for a UI thread to process |
+ // events on Mac and Windows. |
+ // |observer_task_runner| is the task runner to run callbacks to the |
+ // |observer|. |
+ // |events_of_interests| specifies the events the caller is interested to |
+ // receive notifications for. |
+ // |observer| is the notification receiver and dereferenced on the |
+ // |observer_task_runner|. |
+ static scoped_ptr<UserInputMonitor> Create( |
+ scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
DaleCurtis
2013/08/07 18:58:02
const & ? ditto for the other two.
|
+ scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
+ scoped_refptr<base::SingleThreadTaskRunner> observer_task_runner, |
+ uint8 events_of_interest, |
DaleCurtis
2013/08/07 18:58:02
input_event_mask ?
|
+ base::WeakPtr<UserInputObserver> observer); |
+ |
+ protected: |
+ UserInputMonitor() {} |
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_BASE_USER_INPUT_MONITOR_H_ |