OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Interface for a device that receives input events. | 5 // Interface for a device that receives input events. |
6 // This interface handles event messages defined in event.proto. | 6 // This interface handles event messages defined in event.proto. |
7 | 7 |
8 #ifndef REMOTING_PROTOCOL_INPUT_STUB_H_ | 8 #ifndef REMOTING_PROTOCOL_INPUT_STUB_H_ |
9 #define REMOTING_PROTOCOL_INPUT_STUB_H_ | 9 #define REMOTING_PROTOCOL_INPUT_STUB_H_ |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 | 12 |
13 class Task; | 13 class Task; |
14 | 14 |
15 namespace remoting { | 15 namespace remoting { |
16 namespace protocol { | 16 namespace protocol { |
17 | 17 |
18 class KeyEvent; | 18 class KeyEvent; |
19 class MouseEvent; | 19 class MouseEvent; |
20 | 20 |
21 class InputStub { | 21 class InputStub { |
22 public: | 22 public: |
23 InputStub(); | 23 InputStub() {}; |
24 virtual ~InputStub(); | 24 virtual ~InputStub() {}; |
25 | 25 |
26 virtual void InjectKeyEvent(const KeyEvent* event, Task* done) = 0; | 26 virtual void InjectKeyEvent(const KeyEvent* event, Task* done) = 0; |
27 virtual void InjectMouseEvent(const MouseEvent* event, Task* done) = 0; | 27 virtual void InjectMouseEvent(const MouseEvent* event, Task* done) = 0; |
28 | 28 |
29 // TODO(lambroslambrou): Remove OnAuthenticated() and OnClosed() when stubs | |
30 // are refactored not to store authentication state. | |
31 | |
32 // Called when the client has authenticated with the host to enable the | |
33 // input event channel. | |
34 // Before this is called, all input event will be ignored. | |
35 void OnAuthenticated(); | |
36 | |
37 // Called when the client is no longer connected. | |
38 void OnClosed(); | |
39 | |
40 // Has the client successfully authenticated with the host? | |
41 // I.e., should we be processing input events? | |
42 bool authenticated(); | |
43 | |
44 private: | 29 private: |
45 // Initially false, this records whether the client has authenticated with | |
46 // the host. | |
47 bool authenticated_; | |
48 | |
49 DISALLOW_COPY_AND_ASSIGN(InputStub); | 30 DISALLOW_COPY_AND_ASSIGN(InputStub); |
50 }; | 31 }; |
51 | 32 |
52 } // namespace protocol | 33 } // namespace protocol |
53 } // namespace remoting | 34 } // namespace remoting |
54 | 35 |
55 #endif // REMOTING_PROTOCOL_INPUT_STUB_H_ | 36 #endif // REMOTING_PROTOCOL_INPUT_STUB_H_ |
OLD | NEW |