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
3 // found in the LICENSE file.
5 #include "media/base/user_input_monitor.h"
7 #include <ApplicationServices/ApplicationServices.h>
12 class UserInputMonitorMac
: public UserInputMonitor
{
14 UserInputMonitorMac();
15 ~UserInputMonitorMac() override
;
17 size_t GetKeyPressCount() const override
;
20 void StartKeyboardMonitoring() override
;
21 void StopKeyboardMonitoring() override
;
22 void StartMouseMonitoring() override
;
23 void StopMouseMonitoring() override
;
25 DISALLOW_COPY_AND_ASSIGN(UserInputMonitorMac
);
28 UserInputMonitorMac::UserInputMonitorMac() {}
30 UserInputMonitorMac::~UserInputMonitorMac() {}
32 size_t UserInputMonitorMac::GetKeyPressCount() const {
33 // Use |kCGEventSourceStateHIDSystemState| since we only want to count
34 // hardware generated events.
35 return CGEventSourceCounterForEventType(kCGEventSourceStateHIDSystemState
,
39 void UserInputMonitorMac::StartKeyboardMonitoring() {}
41 void UserInputMonitorMac::StopKeyboardMonitoring() {}
43 // TODO(jiayl): add the impl.
44 void UserInputMonitorMac::StartMouseMonitoring() { NOTIMPLEMENTED(); }
46 // TODO(jiayl): add the impl.
47 void UserInputMonitorMac::StopMouseMonitoring() { NOTIMPLEMENTED(); }
51 scoped_ptr
<UserInputMonitor
> UserInputMonitor::Create(
52 const scoped_refptr
<base::SingleThreadTaskRunner
>& input_task_runner
,
53 const scoped_refptr
<base::SingleThreadTaskRunner
>& ui_task_runner
) {
54 return scoped_ptr
<UserInputMonitor
>(new UserInputMonitorMac());