OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef REMOTING_HOST_CLIENT_SESSION_H_ |
| 6 #define REMOTING_HOST_CLIENT_SESSION_H_ |
| 7 |
| 8 #include "remoting/protocol/connection_to_client.h" |
| 9 #include "remoting/protocol/host_stub.h" |
| 10 |
| 11 namespace remoting { |
| 12 |
| 13 // A ClientSession keeps a reference to a connection to a client, and maintains |
| 14 // per-client state. |
| 15 class ClientSession : public protocol::HostStub, |
| 16 public base::RefCountedThreadSafe<ClientSession> { |
| 17 public: |
| 18 // Callback interface for passing events to the ChromotingHost. |
| 19 class EventHandler { |
| 20 public: |
| 21 virtual ~EventHandler() {} |
| 22 |
| 23 // Called to signal that local login has succeeded and ChromotingHost can |
| 24 // proceed with the next step. |
| 25 virtual void LocalLoginSucceeded( |
| 26 scoped_refptr<protocol::ConnectionToClient> client) = 0; |
| 27 |
| 28 // Called to signal that local login has failed. |
| 29 virtual void LocalLoginFailed( |
| 30 scoped_refptr<protocol::ConnectionToClient> client) = 0; |
| 31 }; |
| 32 |
| 33 ClientSession(EventHandler* event_handler, |
| 34 scoped_refptr<protocol::ConnectionToClient> connection); |
| 35 |
| 36 // protocol::HostStub interface. |
| 37 virtual void SuggestResolution( |
| 38 const protocol::SuggestResolutionRequest* msg, Task* done); |
| 39 virtual void BeginSessionRequest( |
| 40 const protocol::LocalLoginCredentials* credentials, Task* done); |
| 41 |
| 42 // Disconnect this client session. |
| 43 void Disconnect(); |
| 44 |
| 45 protocol::ConnectionToClient* connection() const; |
| 46 |
| 47 protected: |
| 48 friend class base::RefCountedThreadSafe<ClientSession>; |
| 49 ~ClientSession(); |
| 50 |
| 51 private: |
| 52 EventHandler* event_handler_; |
| 53 scoped_refptr<protocol::ConnectionToClient> connection_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(ClientSession); |
| 56 }; |
| 57 |
| 58 } // namespace remoting |
| 59 |
| 60 #endif // REMOTING_HOST_CLIENT_SESSION_H_ |
OLD | NEW |