Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / media / base / user_input_monitor_mac.cc
blobe469cbd65acb1b79063693d72ba5558d92b95b93
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>
9 namespace media {
10 namespace {
12 class UserInputMonitorMac : public UserInputMonitor {
13 public:
14 UserInputMonitorMac();
15 ~UserInputMonitorMac() override;
17 size_t GetKeyPressCount() const override;
19 private:
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,
36 kCGEventKeyDown);
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(); }
49 } // namespace
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());
57 } // namespace media