1 // Copyright (c) 2012 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_PROTOCOL_INPUT_FILTER_H_ 6 #define REMOTING_PROTOCOL_INPUT_FILTER_H_ 7 8 #include "base/basictypes.h" 9 #include "base/compiler_specific.h" 10 #include "remoting/protocol/input_stub.h" 11 12 namespace remoting { 13 namespace protocol { 14 15 // Forwards input events to |input_stub|, if configured. Input forwarding may 16 // also be disabled independently of the |input_stub| being set. InputFilters 17 // initially have input forwarding enabled. 18 class InputFilter : public InputStub { 19 public: 20 InputFilter(); 21 explicit InputFilter(InputStub* input_stub); 22 virtual ~InputFilter(); 23 24 // Set the InputStub that events will be forwarded to. 25 void set_input_stub(InputStub* input_stub) { 26 input_stub_ = input_stub; 27 } 28 29 // Enable/disable routing of events to the InputStub. 30 void set_enabled(bool enabled) { 31 enabled_ = enabled; 32 } 33 bool enabled() const { 34 return enabled_; 35 } 36 37 // InputStub interface. 38 virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; 39 virtual void InjectTextEvent(const TextEvent& event) OVERRIDE; 40 virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; 41 42 private: 43 InputStub* input_stub_; 44 bool enabled_; 45 46 DISALLOW_COPY_AND_ASSIGN(InputFilter); 47 }; 48 49 } // namespace protocol 50 } // namespace remoting 51 52 #endif // REMOTING_PROTOCOL_INPUT_FILTER_H_ 53