summaryrefslogtreecommitdiffstats
path: root/remoting/host/client_session.h
diff options
context:
space:
mode:
Diffstat (limited to 'remoting/host/client_session.h')
-rwxr-xr-xremoting/host/client_session.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h
new file mode 100755
index 0000000..620923f
--- /dev/null
+++ b/remoting/host/client_session.h
@@ -0,0 +1,60 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_HOST_CLIENT_SESSION_H_
+#define REMOTING_HOST_CLIENT_SESSION_H_
+
+#include "remoting/protocol/connection_to_client.h"
+#include "remoting/protocol/host_stub.h"
+
+namespace remoting {
+
+// A ClientSession keeps a reference to a connection to a client, and maintains
+// per-client state.
+class ClientSession : public protocol::HostStub,
+ public base::RefCountedThreadSafe<ClientSession> {
+ public:
+ // Callback interface for passing events to the ChromotingHost.
+ class EventHandler {
+ public:
+ virtual ~EventHandler() {}
+
+ // Called to signal that local login has succeeded and ChromotingHost can
+ // proceed with the next step.
+ virtual void LocalLoginSucceeded(
+ scoped_refptr<protocol::ConnectionToClient> client) = 0;
+
+ // Called to signal that local login has failed.
+ virtual void LocalLoginFailed(
+ scoped_refptr<protocol::ConnectionToClient> client) = 0;
+ };
+
+ ClientSession(EventHandler* event_handler,
+ scoped_refptr<protocol::ConnectionToClient> connection);
+
+ // protocol::HostStub interface.
+ virtual void SuggestResolution(
+ const protocol::SuggestResolutionRequest* msg, Task* done);
+ virtual void BeginSessionRequest(
+ const protocol::LocalLoginCredentials* credentials, Task* done);
+
+ // Disconnect this client session.
+ void Disconnect();
+
+ protocol::ConnectionToClient* connection() const;
+
+ protected:
+ friend class base::RefCountedThreadSafe<ClientSession>;
+ ~ClientSession();
+
+ private:
+ EventHandler* event_handler_;
+ scoped_refptr<protocol::ConnectionToClient> connection_;
+
+ DISALLOW_COPY_AND_ASSIGN(ClientSession);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_HOST_CLIENT_SESSION_H_