OLD | NEW |
1 // Copyright (c) 2011 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 #ifndef REMOTING_HOST_DESKTOP_ENVIRONMENT_H_ | 5 #ifndef REMOTING_HOST_DESKTOP_ENVIRONMENT_H_ |
6 #define REMOTING_HOST_DESKTOP_ENVIRONMENT_H_ | 6 #define REMOTING_HOST_DESKTOP_ENVIRONMENT_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "remoting/protocol/host_stub.h" | |
11 | 10 |
12 namespace remoting { | 11 namespace remoting { |
13 | 12 |
14 namespace protocol { | 13 namespace protocol { |
15 class InputStub; | 14 class InputStub; |
16 } // namespace protocol | 15 } // namespace protocol |
17 | 16 |
18 class Capturer; | 17 class Capturer; |
19 | 18 |
20 class DesktopEnvironment : public protocol::HostStub { | 19 class DesktopEnvironment { |
21 public: | 20 public: |
22 // Callback interface for passing events to the ChromotingHost. | |
23 class EventHandler { | |
24 public: | |
25 virtual ~EventHandler() {} | |
26 | |
27 // Called to signal that local login has succeeded and ChromotingHost can | |
28 // proceed with the next step. | |
29 virtual void LocalLoginSucceeded() = 0; | |
30 | |
31 // Called to signal that local login has failed. | |
32 virtual void LocalLoginFailed() = 0; | |
33 }; | |
34 | |
35 DesktopEnvironment(Capturer* capturer, protocol::InputStub* input_stub); | 21 DesktopEnvironment(Capturer* capturer, protocol::InputStub* input_stub); |
36 virtual ~DesktopEnvironment(); | 22 virtual ~DesktopEnvironment(); |
37 | 23 |
38 Capturer* capturer() const { return capturer_.get(); } | 24 Capturer* capturer() const { return capturer_.get(); } |
39 protocol::InputStub* input_stub() const { return input_stub_.get(); } | 25 protocol::InputStub* input_stub() const { return input_stub_.get(); } |
40 // Called by ChromotingHost constructor | |
41 void set_event_handler(EventHandler* event_handler) { | |
42 event_handler_ = event_handler; | |
43 } | |
44 | |
45 // protocol::HostStub interface. | |
46 virtual void SuggestResolution( | |
47 const protocol::SuggestResolutionRequest* msg, Task* done); | |
48 virtual void BeginSessionRequest( | |
49 const protocol::LocalLoginCredentials* credentials, Task* done); | |
50 | |
51 protected: | |
52 // Allow access by DesktopEnvironmentFake for unittest. | |
53 EventHandler* event_handler_; | |
54 | 26 |
55 private: | 27 private: |
56 // Capturer to be used by ScreenRecorder. Once the ScreenRecorder is | 28 // Capturer to be used by ScreenRecorder. Once the ScreenRecorder is |
57 // constructed this is set to NULL. | 29 // constructed this is set to NULL. |
58 scoped_ptr<Capturer> capturer_; | 30 scoped_ptr<Capturer> capturer_; |
59 | 31 |
60 // InputStub in the host executes input events received from the client. | 32 // InputStub in the host executes input events received from the client. |
61 scoped_ptr<protocol::InputStub> input_stub_; | 33 scoped_ptr<protocol::InputStub> input_stub_; |
62 | 34 |
63 DISALLOW_COPY_AND_ASSIGN(DesktopEnvironment); | 35 DISALLOW_COPY_AND_ASSIGN(DesktopEnvironment); |
64 }; | 36 }; |
65 | 37 |
66 } // namespace remoting | 38 } // namespace remoting |
67 | 39 |
68 #endif // REMOTING_HOST_DESKTOP_ENVIRONMENT_H_ | 40 #endif // REMOTING_HOST_DESKTOP_ENVIRONMENT_H_ |
OLD | NEW |