| 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_CHROMOTOCOL_CONNECTION_H_ | 5 #ifndef REMOTING_PROTOCOL_SESSION_H_ |
| 6 #define REMOTING_PROTOCOL_CHROMOTOCOL_CONNECTION_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/chromotocol_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 | 21 |
| 22 namespace protocol { |
| 23 |
| 22 // Generic interface for Chromotocol connection used by both client and host. | 24 // Generic interface for Chromotocol connection used by both client and host. |
| 23 // Provides access to the connection channels, but doesn't depend on the | 25 // Provides access to the connection channels, but doesn't depend on the |
| 24 // protocol used for each channel. | 26 // protocol used for each channel. |
| 25 // TODO(sergeyu): Remove refcounting? | 27 // TODO(sergeyu): Remove refcounting? |
| 26 class ChromotocolConnection | 28 class Session |
| 27 : public base::RefCountedThreadSafe<ChromotocolConnection> { | 29 : public base::RefCountedThreadSafe<Session> { |
| 28 public: | 30 public: |
| 29 enum State { | 31 enum State { |
| 30 INITIALIZING, | 32 INITIALIZING, |
| 31 CONNECTING, | 33 CONNECTING, |
| 32 CONNECTED, | 34 CONNECTED, |
| 33 CLOSED, | 35 CLOSED, |
| 34 FAILED, | 36 FAILED, |
| 35 }; | 37 }; |
| 36 | 38 |
| 37 typedef Callback1<State>::Type StateChangeCallback; | 39 typedef Callback1<State>::Type StateChangeCallback; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // on the host before the connection is accepted, from | 75 // on the host before the connection is accepted, from |
| 74 // ChromotocolServer::IncomingConnectionCallback. Ownership of |config| is | 76 // ChromotocolServer::IncomingConnectionCallback. Ownership of |config| is |
| 75 // given to the connection. | 77 // given to the connection. |
| 76 virtual void set_config(const ChromotocolConfig* config) = 0; | 78 virtual void set_config(const ChromotocolConfig* config) = 0; |
| 77 | 79 |
| 78 // Closes connection. Callbacks are guaranteed not to be called after | 80 // Closes connection. Callbacks are guaranteed not to be called after |
| 79 // |closed_task| is executed. | 81 // |closed_task| is executed. |
| 80 virtual void Close(Task* closed_task) = 0; | 82 virtual void Close(Task* closed_task) = 0; |
| 81 | 83 |
| 82 protected: | 84 protected: |
| 83 friend class base::RefCountedThreadSafe<ChromotocolConnection>; | 85 friend class base::RefCountedThreadSafe<Session>; |
| 84 | 86 |
| 85 ChromotocolConnection() { } | 87 Session() { } |
| 86 virtual ~ChromotocolConnection() { } | 88 virtual ~Session() { } |
| 87 | 89 |
| 88 private: | 90 private: |
| 89 DISALLOW_COPY_AND_ASSIGN(ChromotocolConnection); | 91 DISALLOW_COPY_AND_ASSIGN(Session); |
| 90 }; | 92 }; |
| 91 | 93 |
| 94 } // namespace protocol |
| 95 |
| 92 } // namespace remoting | 96 } // namespace remoting |
| 93 | 97 |
| 94 #endif // REMOTING_PROTOCOL_CHROMOTOCOL_CONNECTION_H_ | 98 #endif // REMOTING_PROTOCOL_SESSION_H_ |
| OLD | NEW |