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

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: add linux impl 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 };
DaleCurtis 2013/08/07 18:58:02 Needs protected virtual destructor with empty impl
32
33 // Monitors and notifies about mouse movements and keyboard events.
34 class UserInputMonitor {
35 public:
36 // Bit masks for specifying input events of interest.
37 enum InputEvent {
38 MOUSE_MOVEMENT = 0x1,
39 KEYBOARD_EVENT = 0x2,
40 };
41
42 virtual ~UserInputMonitor() {}
DaleCurtis 2013/08/07 18:58:02 protected.
43
44 // Creates a platform-specific instance of UserInputMonitor.
45 // |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
46 // on Linux; |ui_task_runner| is the task runner for a UI thread to process
47 // events on Mac and Windows.
48 // |observer_task_runner| is the task runner to run callbacks to the
49 // |observer|.
50 // |events_of_interests| specifies the events the caller is interested to
51 // receive notifications for.
52 // |observer| is the notification receiver and dereferenced on the
53 // |observer_task_runner|.
54 static scoped_ptr<UserInputMonitor> Create(
55 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
DaleCurtis 2013/08/07 18:58:02 const & ? ditto for the other two.
56 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
57 scoped_refptr<base::SingleThreadTaskRunner> observer_task_runner,
58 uint8 events_of_interest,
DaleCurtis 2013/08/07 18:58:02 input_event_mask ?
59 base::WeakPtr<UserInputObserver> observer);
60
61 protected:
62 UserInputMonitor() {}
63 };
64
65 } // namespace media
66
67 #endif // MEDIA_BASE_USER_INPUT_MONITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698