local_hotkey_input_monitor.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 REMOTING_HOST_INPUT_MONITOR_LOCAL_HOTKEY_INPUT_MONITOR_H_
  5. #define REMOTING_HOST_INPUT_MONITOR_LOCAL_HOTKEY_INPUT_MONITOR_H_
  6. #include <memory>
  7. #include "base/callback_forward.h"
  8. #include "base/memory/ref_counted.h"
  9. #include "base/memory/weak_ptr.h"
  10. namespace base {
  11. class SingleThreadTaskRunner;
  12. } // namespace base
  13. namespace remoting {
  14. // Monitors the local input to notify about keyboard hotkeys. If implemented for
  15. // the platform, catches the disconnection keyboard shortcut (Ctrl-Alt-Esc) and
  16. // invokes |disconnect_callback| when this key combination is pressed.
  17. class LocalHotkeyInputMonitor {
  18. public:
  19. virtual ~LocalHotkeyInputMonitor() = default;
  20. // Creates a platform-specific instance of LocalHotkeyInputMonitor.
  21. // |disconnect_callback| is called on the |caller_task_runner| thread.
  22. static std::unique_ptr<LocalHotkeyInputMonitor> Create(
  23. scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
  24. scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
  25. scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
  26. base::OnceClosure disconnect_callback);
  27. protected:
  28. LocalHotkeyInputMonitor() = default;
  29. };
  30. } // namespace remoting
  31. #endif // REMOTING_HOST_INPUT_MONITOR_LOCAL_HOTKEY_INPUT_MONITOR_H_