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

Side by Side Diff: media/base/user_input_monitor.h

Issue 21183002: Adding key press detection in the browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 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
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_BASE_USER_INPUT_MONITOR_H_
6 #define MEDIA_BASE_USER_INPUT_MONITOR_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "ui/base/events/event_constants.h"
12 #include "ui/base/keycodes/keyboard_codes.h"
13
14 struct SkIPoint;
15
16 namespace base {
17 class SingleThreadTaskRunner;
18 } // namespace base
19
20 namespace media {
21
22 // Called on the |observer_task_runner|.
23 class UserInputObserver {
24 public:
25 // Called when the mouse is moved.
26 virtual void OnMouseMoved(const SkIPoint& position) = 0;
27 // Called when a key is pressed or released.
28 // |event| can only be ui::ET_KEY_PRESSED or ui::ET_KEY_RELEASED.
29 virtual void OnKeyboardEvent(ui::EventType event,
30 ui::KeyboardCode key_code) = 0;
31
32 protected:
33 virtual ~UserInputObserver() {}
34 };
35
36 // Monitors and notifies about mouse movements and keyboard events.
37 class UserInputMonitor {
38 public:
39 // Bit masks for specifying input events of interest.
40 enum InputEvent {
41 MOUSE_MOVEMENT = 0x1,
Sergey Ulanov 2013/08/08 01:25:48 MOUSE_EVENT (enum name and the other already have
jiayl 2013/08/09 23:30:14 Removed now.
42 KEYBOARD_EVENT = 0x2,
43 };
44
45 virtual ~UserInputMonitor() {}
46
47 // Creates a platform-specific instance of UserInputMonitor.
48 // |input_task_runner| is the task runner for an IO thread.
49 // |ui_task_runner| is the task runner for a UI thread.
50 // |observer_task_runner| is the task runner to run callbacks to the
51 // |observer|.
52 // |input_event_mask| specifies the events the caller is interested to
53 // receive notifications for.
54 // |observer| is the notification receiver and dereferenced on the
55 // |observer_task_runner|.
56 static scoped_ptr<UserInputMonitor> Create(
57 const scoped_refptr<base::SingleThreadTaskRunner>& input_task_runner,
58 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner,
59 const scoped_refptr<base::SingleThreadTaskRunner>& observer_task_runner,
60 uint8 input_event_mask,
61 const base::WeakPtr<UserInputObserver>& observer);
62
63 protected:
64 UserInputMonitor() {}
65 };
66
67 } // namespace media
68
69 #endif // MEDIA_BASE_USER_INPUT_MONITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698