This source file includes following definitions.
- GetKeyPressCount
- StartKeyboardMonitoring
- StopKeyboardMonitoring
- StartMouseMonitoring
- StopMouseMonitoring
- Create
#include "media/base/user_input_monitor.h"
#include <ApplicationServices/ApplicationServices.h>
namespace media {
namespace {
class UserInputMonitorMac : public UserInputMonitor {
public:
UserInputMonitorMac();
virtual ~UserInputMonitorMac();
virtual size_t GetKeyPressCount() const OVERRIDE;
private:
virtual void StartKeyboardMonitoring() OVERRIDE;
virtual void StopKeyboardMonitoring() OVERRIDE;
virtual void StartMouseMonitoring() OVERRIDE;
virtual void StopMouseMonitoring() OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(UserInputMonitorMac);
};
UserInputMonitorMac::UserInputMonitorMac() {}
UserInputMonitorMac::~UserInputMonitorMac() {}
size_t UserInputMonitorMac::GetKeyPressCount() const {
return CGEventSourceCounterForEventType(kCGEventSourceStateHIDSystemState,
kCGEventKeyDown);
}
void UserInputMonitorMac::StartKeyboardMonitoring() {}
void UserInputMonitorMac::StopKeyboardMonitoring() {}
void UserInputMonitorMac::StartMouseMonitoring() { NOTIMPLEMENTED(); }
void UserInputMonitorMac::StopMouseMonitoring() { NOTIMPLEMENTED(); }
}
scoped_ptr<UserInputMonitor> UserInputMonitor::Create(
const scoped_refptr<base::SingleThreadTaskRunner>& input_task_runner,
const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner) {
return scoped_ptr<UserInputMonitor>(new UserInputMonitorMac());
}
}