| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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_PROTOCOL_SESSION_H_ | 5 #ifndef REMOTING_PROTOCOL_SESSION_H_ |
| 6 #define REMOTING_PROTOCOL_SESSION_H_ | 6 #define REMOTING_PROTOCOL_SESSION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "remoting/protocol/chromotocol_config.h" | 11 #include "remoting/protocol/session_config.h" |
| 12 | 12 |
| 13 class MessageLoop; | 13 class MessageLoop; |
| 14 class Task; | 14 class Task; |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 class Socket; | 17 class Socket; |
| 18 } // namespace net | 18 } // namespace net |
| 19 | 19 |
| 20 namespace remoting { | 20 namespace remoting { |
| 21 | |
| 22 namespace protocol { | 21 namespace protocol { |
| 23 | 22 |
| 24 // Generic interface for Chromotocol connection used by both client and host. | 23 // Generic interface for Chromotocol connection used by both client and host. |
| 25 // Provides access to the connection channels, but doesn't depend on the | 24 // Provides access to the connection channels, but doesn't depend on the |
| 26 // protocol used for each channel. | 25 // protocol used for each channel. |
| 27 // TODO(sergeyu): Remove refcounting? | 26 // TODO(sergeyu): Remove refcounting? |
| 28 class Session : public base::RefCountedThreadSafe<Session> { | 27 class Session : public base::RefCountedThreadSafe<Session> { |
| 29 public: | 28 public: |
| 30 enum State { | 29 enum State { |
| 31 INITIALIZING, | 30 INITIALIZING, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 57 | 56 |
| 58 // JID of the other side. | 57 // JID of the other side. |
| 59 virtual const std::string& jid() = 0; | 58 virtual const std::string& jid() = 0; |
| 60 | 59 |
| 61 // Message loop that must be used to access the channels of this connection. | 60 // Message loop that must be used to access the channels of this connection. |
| 62 virtual MessageLoop* message_loop() = 0; | 61 virtual MessageLoop* message_loop() = 0; |
| 63 | 62 |
| 64 // Configuration of the protocol that was sent or received in the | 63 // Configuration of the protocol that was sent or received in the |
| 65 // session-initiate jingle message. Returned pointer is valid until | 64 // session-initiate jingle message. Returned pointer is valid until |
| 66 // connection is closed. | 65 // connection is closed. |
| 67 virtual const CandidateChromotocolConfig* candidate_config() = 0; | 66 virtual const CandidateSessionConfig* candidate_config() = 0; |
| 68 | 67 |
| 69 // Protocol configuration. Can be called only after session has been accepted. | 68 // Protocol configuration. Can be called only after session has been accepted. |
| 70 // Returned pointer is valid until connection is closed. | 69 // Returned pointer is valid until connection is closed. |
| 71 virtual const ChromotocolConfig* config() = 0; | 70 virtual const SessionConfig* config() = 0; |
| 72 | 71 |
| 73 // Set protocol configuration for an incoming session. Must be called | 72 // Set protocol configuration for an incoming session. Must be called |
| 74 // on the host before the connection is accepted, from | 73 // on the host before the connection is accepted, from |
| 75 // ChromotocolServer::IncomingConnectionCallback. Ownership of |config| is | 74 // ChromotocolServer::IncomingConnectionCallback. Ownership of |config| is |
| 76 // given to the connection. | 75 // given to the connection. |
| 77 virtual void set_config(const ChromotocolConfig* config) = 0; | 76 virtual void set_config(const SessionConfig* config) = 0; |
| 78 | 77 |
| 79 // Closes connection. Callbacks are guaranteed not to be called after | 78 // Closes connection. Callbacks are guaranteed not to be called after |
| 80 // |closed_task| is executed. | 79 // |closed_task| is executed. |
| 81 virtual void Close(Task* closed_task) = 0; | 80 virtual void Close(Task* closed_task) = 0; |
| 82 | 81 |
| 83 protected: | 82 protected: |
| 84 friend class base::RefCountedThreadSafe<Session>; | 83 friend class base::RefCountedThreadSafe<Session>; |
| 85 | 84 |
| 86 Session() { } | 85 Session() { } |
| 87 virtual ~Session() { } | 86 virtual ~Session() { } |
| 88 | 87 |
| 89 private: | 88 private: |
| 90 DISALLOW_COPY_AND_ASSIGN(Session); | 89 DISALLOW_COPY_AND_ASSIGN(Session); |
| 91 }; | 90 }; |
| 92 | 91 |
| 93 } // namespace protocol | 92 } // namespace protocol |
| 94 | |
| 95 } // namespace remoting | 93 } // namespace remoting |
| 96 | 94 |
| 97 #endif // REMOTING_PROTOCOL_SESSION_H_ | 95 #endif // REMOTING_PROTOCOL_SESSION_H_ |
| OLD | NEW |