1 // Copyright 2020 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 5 #ifndef REMOTING_HOST_POINTER_LOCK_DETECTOR_H_ 6 #define REMOTING_HOST_POINTER_LOCK_DETECTOR_H_ 7 8 #include "remoting/protocol/input_filter.h" 9 10 namespace remoting { 11 12 // Non-filtering InputStub implementation which detects changes into or out of 13 // relative pointer mode, which corresponds to client-side pointer lock. 14 class PointerLockDetector : public protocol::InputFilter { 15 public: 16 class EventHandler { 17 public: 18 virtual void OnPointerLockChanged(bool active) = 0; 19 }; 20 21 PointerLockDetector(InputStub* input_stub, EventHandler* event_handler_); 22 ~PointerLockDetector() override; 23 24 // InputStub overrides. 25 void InjectMouseEvent(const protocol::MouseEvent& event) override; 26 27 private: 28 EventHandler* event_handler_; 29 bool has_triggered_ = false; 30 bool is_active_ = false; 31 32 DISALLOW_COPY_AND_ASSIGN(PointerLockDetector); 33 }; 34 35 } // namespace remoting 36 37 #endif // REMOTING_HOST_POINTER_LOCK_DETECTOR_H_ 38