Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: remoting/protocol/session_manager.h

Issue 4313001: Rename classes for Chromoting: (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: Resolve merge conflicts Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/session.h ('k') | remoting/protocol/stream_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 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 // The purprose of SessionManager is to facilitate creation of chromotocol
6 // sessions. Both host and client use it to establish chromotocol
7 // sessions. JingleChromotocolServer implements this inteface using
8 // libjingle.
9 //
10 // OUTGOING SESSIONS
11 // Connect() must be used to create new session to a remote host. The
12 // returned sessionion is initially in INITIALIZING state. Later state is
13 // changed to CONNECTED if the session is accepted by the host or CLOSED
14 // if the session is rejected.
15 //
16 // INCOMING SESSIONS
17 // The IncomingSessionCallback is called when a client attempts to connect.
18 // The callback function decides whether the session should be accepted or
19 // rejected.
20 //
21 // SESSION OWNERSHIP AND SHUTDOWN
22 // SessionManager owns all Chromotocol Session it creates. The server
23 // must not be closed while sessions created by the server are still in use.
24 // When shutting down the Close() method for the sessionion and the server
25 // objects must be called in the following order: Session,
26 // SessionManager, JingleClient. The same order must be followed in the case
27 // of rejected and failed sessions.
28 //
29 // PROTOCOL VERSION NEGOTIATION
30 // When client connects to a host it sends a session-initiate stanza with list
31 // of supported configurations for each channel. If the host decides to accept
32 // session, then it selects configuration that is supported by both sides
33 // and then replies with the session-accept stanza that contans selected
34 // configuration. The configuration specified in the session-accept is used
35 // for the session.
36 //
37 // The CandidateChromotocolConfig class represents list of configurations
38 // supported by an endpoint. The |chromotocol_config| argument in the Connect()
39 // specifies configuration supported on the client side. When the host receives
40 // session-initiate stanza, the IncomingSessionCallback is called. The
41 // configuration sent in the session-intiate staza is available via
42 // ChromotocolConnnection::candidate_config(). If an incoming session is
43 // being accepted then the IncomingSessionCallback callback function must
44 // select session configuration and then set it with Session::set_config().
45
46 #ifndef REMOTING_PROTOCOL_SESSION_MANAGER_H_
47 #define REMOTING_PROTOCOL_SESSION_MANAGER_H_
48
49 #include <string>
50
51 #include "base/callback.h"
52 #include "base/ref_counted.h"
53 #include "remoting/protocol/session.h"
54
55 class Task;
56
57 namespace remoting {
58
59 namespace protocol {
60
61 // Generic interface for Chromoting session manager.
62 class SessionManager : public base::RefCountedThreadSafe<SessionManager> {
63 public:
64 enum IncomingSessionResponse {
65 ACCEPT,
66 INCOMPATIBLE,
67 DECLINE,
68 };
69
70 // IncomingSessionCallback is called when a new session is received. If
71 // the callback decides to accept the session it should set the second
72 // argument to ACCEPT. Otherwise it should set it to DECLINE, or
73 // INCOMPATIBLE. INCOMPATIBLE indicates that the session has incompatible
74 // configuration, and cannot be accepted.
75 // If the callback accepts session then it must also set configuration
76 // for the new session using Session::set_config().
77 typedef Callback2<Session*, IncomingSessionResponse*>::Type
78 IncomingSessionCallback;
79
80 // Initializes session to the host |jid|. Ownership of the
81 // |chromotocol_config| is passed to the new session.
82 virtual scoped_refptr<Session> Connect(
83 const std::string& jid,
84 CandidateChromotocolConfig* chromotocol_config,
85 Session::StateChangeCallback* state_change_callback) = 0;
86
87 // Close session manager and all current sessions. |close_task| is executed
88 // after the session client is actually closed. No callbacks are called after
89 // |closed_task| is executed.
90 virtual void Close(Task* closed_task) = 0;
91
92 protected:
93 friend class base::RefCountedThreadSafe<SessionManager>;
94
95 SessionManager() { }
96 virtual ~SessionManager() { }
97
98 private:
99 DISALLOW_COPY_AND_ASSIGN(SessionManager);
100 };
101
102 } // namespace protocol
103
104 } // namespace remoting
105
106 #endif // REMOTING_PROTOCOL_SESSION_MANAGER_H_
OLDNEW
« no previous file with comments | « remoting/protocol/session.h ('k') | remoting/protocol/stream_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698