| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_CONNECTION_TO_HOST_H_ | 5 #ifndef REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
| 6 #define REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ | 6 #define REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 class ClientControlDispatcher; | 34 class ClientControlDispatcher; |
| 35 class ClientEventDispatcher; | 35 class ClientEventDispatcher; |
| 36 class ClientStub; | 36 class ClientStub; |
| 37 class HostStub; | 37 class HostStub; |
| 38 class InputStub; | 38 class InputStub; |
| 39 class SessionConfig; | 39 class SessionConfig; |
| 40 class VideoReader; | 40 class VideoReader; |
| 41 class VideoStub; | 41 class VideoStub; |
| 42 | 42 |
| 43 class ConnectionToHost : public SignalStrategy::StatusObserver, | 43 class ConnectionToHost : public SignalStrategy::Listener, |
| 44 public SessionManager::Listener { | 44 public SessionManager::Listener { |
| 45 public: | 45 public: |
| 46 enum State { | 46 enum State { |
| 47 CONNECTING, | 47 CONNECTING, |
| 48 CONNECTED, | 48 CONNECTED, |
| 49 FAILED, | 49 FAILED, |
| 50 CLOSED, | 50 CLOSED, |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 enum Error { | 53 enum Error { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 82 | 82 |
| 83 virtual void Disconnect(const base::Closure& shutdown_task); | 83 virtual void Disconnect(const base::Closure& shutdown_task); |
| 84 | 84 |
| 85 virtual const SessionConfig& config(); | 85 virtual const SessionConfig& config(); |
| 86 | 86 |
| 87 virtual InputStub* input_stub(); | 87 virtual InputStub* input_stub(); |
| 88 | 88 |
| 89 virtual HostStub* host_stub(); | 89 virtual HostStub* host_stub(); |
| 90 | 90 |
| 91 // SignalStrategy::StatusObserver interface. | 91 // SignalStrategy::StatusObserver interface. |
| 92 virtual void OnStateChange( | 92 virtual void OnSignalStrategyStateChange( |
| 93 SignalStrategy::StatusObserver::State state) OVERRIDE; | 93 SignalStrategy::State state) OVERRIDE; |
| 94 virtual void OnJidChange(const std::string& full_jid) OVERRIDE; | |
| 95 | 94 |
| 96 // SessionManager::Listener interface. | 95 // SessionManager::Listener interface. |
| 97 virtual void OnSessionManagerInitialized() OVERRIDE; | 96 virtual void OnSessionManagerReady() OVERRIDE; |
| 98 virtual void OnIncomingSession( | 97 virtual void OnIncomingSession( |
| 99 Session* session, | 98 Session* session, |
| 100 SessionManager::IncomingSessionResponse* response) OVERRIDE; | 99 SessionManager::IncomingSessionResponse* response) OVERRIDE; |
| 101 | 100 |
| 102 // Called when the host accepts the client authentication. | 101 // Called when the host accepts the client authentication. |
| 103 void OnClientAuthenticated(); | 102 void OnClientAuthenticated(); |
| 104 | 103 |
| 105 // Return the current state of ConnectionToHost. | 104 // Return the current state of ConnectionToHost. |
| 106 State state() const; | 105 State state() const; |
| 107 | 106 |
| 108 private: | 107 private: |
| 109 // Called on the jingle thread after we've successfully to XMPP server. Starts | |
| 110 // P2P connection to the host. | |
| 111 void InitSession(); | |
| 112 | |
| 113 // Callback for |session_|. | 108 // Callback for |session_|. |
| 114 void OnSessionStateChange(Session::State state); | 109 void OnSessionStateChange(Session::State state); |
| 115 | 110 |
| 116 // Callbacks for channel initialization | 111 // Callbacks for channel initialization |
| 117 void OnChannelInitialized(bool successful); | 112 void OnChannelInitialized(bool successful); |
| 118 | 113 |
| 119 void NotifyIfChannelsReady(); | 114 void NotifyIfChannelsReady(); |
| 120 | 115 |
| 121 // Callback for |video_reader_|. | 116 // Callback for |video_reader_|. |
| 122 void OnVideoPacket(VideoPacket* packet); | 117 void OnVideoPacket(VideoPacket* packet); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 136 std::string host_public_key_; | 131 std::string host_public_key_; |
| 137 std::string access_code_; | 132 std::string access_code_; |
| 138 | 133 |
| 139 HostEventCallback* event_callback_; | 134 HostEventCallback* event_callback_; |
| 140 | 135 |
| 141 // Stub for incoming messages. | 136 // Stub for incoming messages. |
| 142 ClientStub* client_stub_; | 137 ClientStub* client_stub_; |
| 143 VideoStub* video_stub_; | 138 VideoStub* video_stub_; |
| 144 | 139 |
| 145 scoped_ptr<SignalStrategy> signal_strategy_; | 140 scoped_ptr<SignalStrategy> signal_strategy_; |
| 146 std::string local_jid_; | |
| 147 scoped_ptr<SessionManager> session_manager_; | 141 scoped_ptr<SessionManager> session_manager_; |
| 148 scoped_ptr<Session> session_; | 142 scoped_ptr<Session> session_; |
| 149 | 143 |
| 150 scoped_ptr<VideoReader> video_reader_; | 144 scoped_ptr<VideoReader> video_reader_; |
| 151 scoped_ptr<ClientControlDispatcher> control_dispatcher_; | 145 scoped_ptr<ClientControlDispatcher> control_dispatcher_; |
| 152 scoped_ptr<ClientEventDispatcher> event_dispatcher_; | 146 scoped_ptr<ClientEventDispatcher> event_dispatcher_; |
| 153 | 147 |
| 154 // Internal state of the connection. | 148 // Internal state of the connection. |
| 155 State state_; | 149 State state_; |
| 156 Error error_; | 150 Error error_; |
| 157 | 151 |
| 158 private: | 152 private: |
| 159 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); | 153 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); |
| 160 }; | 154 }; |
| 161 | 155 |
| 162 } // namespace protocol | 156 } // namespace protocol |
| 163 } // namespace remoting | 157 } // namespace remoting |
| 164 | 158 |
| 165 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ | 159 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
| OLD | NEW |