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