| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "remoting/protocol/errors.h" | 10 #include "remoting/protocol/errors.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // Sent session-initiate, but haven't received session-accept. | 32 // Sent session-initiate, but haven't received session-accept. |
| 33 CONNECTING, | 33 CONNECTING, |
| 34 | 34 |
| 35 // Received session-initiate, but haven't sent session-accept. | 35 // Received session-initiate, but haven't sent session-accept. |
| 36 ACCEPTING, | 36 ACCEPTING, |
| 37 | 37 |
| 38 // Session has been accepted and is pending authentication. | 38 // Session has been accepted and is pending authentication. |
| 39 CONNECTED, | 39 CONNECTED, |
| 40 | 40 |
| 41 // Session has started authenticating. |
| 42 AUTHENTICATING, |
| 43 |
| 41 // Session has been connected and authenticated. | 44 // Session has been connected and authenticated. |
| 42 AUTHENTICATED, | 45 AUTHENTICATED, |
| 43 | 46 |
| 44 // Session has been closed. | 47 // Session has been closed. |
| 45 CLOSED, | 48 CLOSED, |
| 46 | 49 |
| 47 // Connection has failed. | 50 // Connection has failed. |
| 48 FAILED, | 51 FAILED, |
| 49 }; | 52 }; |
| 50 | 53 |
| 51 class EventHandler { | 54 class EventHandler { |
| 52 public: | 55 public: |
| 53 EventHandler() {} | 56 EventHandler() {} |
| 54 virtual ~EventHandler() {} | 57 virtual ~EventHandler() {} |
| 55 | 58 |
| 56 // Called after session state has changed. It is safe to destroy | 59 // Called after session state has changed. It is safe to destroy |
| 57 // the session from within the handler if |state| is CLOSED or | 60 // the session from within the handler if |state| is AUTHENTICATING |
| 58 // FAILED. | 61 // or CLOSED or FAILED. |
| 59 virtual void OnSessionStateChange(State state) = 0; | 62 virtual void OnSessionStateChange(State state) = 0; |
| 60 | 63 |
| 61 // Called whenever route for the channel specified with | 64 // Called whenever route for the channel specified with |
| 62 // |channel_name| changes. Session must not be destroyed by the | 65 // |channel_name| changes. Session must not be destroyed by the |
| 63 // handler of this event. | 66 // handler of this event. |
| 64 virtual void OnSessionRouteChange(const std::string& channel_name, | 67 virtual void OnSessionRouteChange(const std::string& channel_name, |
| 65 const TransportRoute& route) = 0; | 68 const TransportRoute& route) = 0; |
| 66 | 69 |
| 67 // Called when ready state on one of the channels changes. See | 70 // Called when ready state on one of the channels changes. See |
| 68 // comments in transport.h for explanation on what this state | 71 // comments in transport.h for explanation on what this state |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 virtual void Close() = 0; | 114 virtual void Close() = 0; |
| 112 | 115 |
| 113 private: | 116 private: |
| 114 DISALLOW_COPY_AND_ASSIGN(Session); | 117 DISALLOW_COPY_AND_ASSIGN(Session); |
| 115 }; | 118 }; |
| 116 | 119 |
| 117 } // namespace protocol | 120 } // namespace protocol |
| 118 } // namespace remoting | 121 } // namespace remoting |
| 119 | 122 |
| 120 #endif // REMOTING_PROTOCOL_SESSION_H_ | 123 #endif // REMOTING_PROTOCOL_SESSION_H_ |
| OLD | NEW |