user_input_monitor.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2018 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. #ifndef SERVICES_AUDIO_USER_INPUT_MONITOR_H_
  5. #define SERVICES_AUDIO_USER_INPUT_MONITOR_H_
  6. #include <memory>
  7. #include "base/memory/read_only_shared_memory_region.h"
  8. #include "media/base/user_input_monitor.h"
  9. namespace audio {
  10. // TODO(https://crbug.com/836226) remove inheritance after switching to audio
  11. // service input streams.
  12. class UserInputMonitor : public media::UserInputMonitor {
  13. public:
  14. explicit UserInputMonitor(base::ReadOnlySharedMemoryMapping memory_mapping);
  15. UserInputMonitor(const UserInputMonitor&) = delete;
  16. UserInputMonitor& operator=(const UserInputMonitor&) = delete;
  17. ~UserInputMonitor() override;
  18. // Returns nullptr for invalid handle.
  19. static std::unique_ptr<UserInputMonitor> Create(
  20. base::ReadOnlySharedMemoryRegion keypress_count_buffer);
  21. void EnableKeyPressMonitoring() override;
  22. void DisableKeyPressMonitoring() override;
  23. uint32_t GetKeyPressCount() const override;
  24. private:
  25. base::ReadOnlySharedMemoryMapping key_press_count_mapping_;
  26. };
  27. } // namespace audio
  28. #endif // SERVICES_AUDIO_USER_INPUT_MONITOR_H_