| 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_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 <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
| 15 #include "remoting/proto/internal.pb.h" | 15 #include "remoting/proto/internal.pb.h" |
| 16 #include "remoting/protocol/channel_dispatcher_base.h" |
| 16 #include "remoting/protocol/clipboard_filter.h" | 17 #include "remoting/protocol/clipboard_filter.h" |
| 17 #include "remoting/protocol/errors.h" | 18 #include "remoting/protocol/errors.h" |
| 18 #include "remoting/protocol/input_filter.h" | 19 #include "remoting/protocol/input_filter.h" |
| 19 #include "remoting/protocol/message_reader.h" | 20 #include "remoting/protocol/message_reader.h" |
| 20 #include "remoting/protocol/monitored_video_stub.h" | 21 #include "remoting/protocol/monitored_video_stub.h" |
| 21 #include "remoting/protocol/session.h" | 22 #include "remoting/protocol/session.h" |
| 22 #include "remoting/protocol/session_config.h" | 23 #include "remoting/protocol/session_config.h" |
| 23 #include "remoting/protocol/session_manager.h" | 24 #include "remoting/protocol/session_manager.h" |
| 24 #include "remoting/signaling/signal_strategy.h" | 25 #include "remoting/signaling/signal_strategy.h" |
| 25 | 26 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 40 class HostStub; | 41 class HostStub; |
| 41 class InputStub; | 42 class InputStub; |
| 42 class SessionConfig; | 43 class SessionConfig; |
| 43 class TransportFactory; | 44 class TransportFactory; |
| 44 class ClientVideoDispatcher; | 45 class ClientVideoDispatcher; |
| 45 class VideoStub; | 46 class VideoStub; |
| 46 | 47 |
| 47 class ConnectionToHost : public SignalStrategy::Listener, | 48 class ConnectionToHost : public SignalStrategy::Listener, |
| 48 public SessionManager::Listener, | 49 public SessionManager::Listener, |
| 49 public Session::EventHandler, | 50 public Session::EventHandler, |
| 51 public ChannelDispatcherBase::EventHandler, |
| 50 public base::NonThreadSafe { | 52 public base::NonThreadSafe { |
| 51 public: | 53 public: |
| 52 // The UI implementations maintain corresponding definitions of this | 54 // The UI implementations maintain corresponding definitions of this |
| 53 // enumeration in webapp/client_session.js and | 55 // enumeration in webapp/client_session.js and |
| 54 // android/java/src/org/chromium/chromoting/jni/JniInterface.java. Be sure to | 56 // android/java/src/org/chromium/chromoting/jni/JniInterface.java. Be sure to |
| 55 // update these locations if you make any changes to the ordering. | 57 // update these locations if you make any changes to the ordering. |
| 56 enum State { | 58 enum State { |
| 57 INITIALIZING, | 59 INITIALIZING, |
| 58 CONNECTING, | 60 CONNECTING, |
| 59 AUTHENTICATED, | 61 AUTHENTICATED, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 void OnSessionManagerReady() override; | 128 void OnSessionManagerReady() override; |
| 127 void OnIncomingSession( | 129 void OnIncomingSession( |
| 128 Session* session, | 130 Session* session, |
| 129 SessionManager::IncomingSessionResponse* response) override; | 131 SessionManager::IncomingSessionResponse* response) override; |
| 130 | 132 |
| 131 // Session::EventHandler interface. | 133 // Session::EventHandler interface. |
| 132 void OnSessionStateChange(Session::State state) override; | 134 void OnSessionStateChange(Session::State state) override; |
| 133 void OnSessionRouteChange(const std::string& channel_name, | 135 void OnSessionRouteChange(const std::string& channel_name, |
| 134 const TransportRoute& route) override; | 136 const TransportRoute& route) override; |
| 135 | 137 |
| 138 // ChannelDispatcherBase::EventHandler interface. |
| 139 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override; |
| 140 void OnChannelError(ChannelDispatcherBase* channel_dispatcher, |
| 141 ErrorCode error) override; |
| 142 |
| 136 // MonitoredVideoStub::EventHandler interface. | 143 // MonitoredVideoStub::EventHandler interface. |
| 137 virtual void OnVideoChannelStatus(bool active); | 144 virtual void OnVideoChannelStatus(bool active); |
| 138 | 145 |
| 139 // Return the current state of ConnectionToHost. | 146 // Return the current state of ConnectionToHost. |
| 140 State state() const; | 147 State state() const; |
| 141 | 148 |
| 142 private: | 149 private: |
| 143 // Callbacks for channel initialization | |
| 144 void OnChannelInitialized(bool successful); | |
| 145 | |
| 146 void NotifyIfChannelsReady(); | 150 void NotifyIfChannelsReady(); |
| 147 | 151 |
| 148 void CloseOnError(ErrorCode error); | 152 void CloseOnError(ErrorCode error); |
| 149 | 153 |
| 150 // Stops writing in the channels. | 154 // Stops writing in the channels. |
| 151 void CloseChannels(); | 155 void CloseChannels(); |
| 152 | 156 |
| 153 void SetState(State state, ErrorCode error); | 157 void SetState(State state, ErrorCode error); |
| 154 | 158 |
| 155 std::string host_jid_; | 159 std::string host_jid_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 182 ErrorCode error_; | 186 ErrorCode error_; |
| 183 | 187 |
| 184 private: | 188 private: |
| 185 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); | 189 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); |
| 186 }; | 190 }; |
| 187 | 191 |
| 188 } // namespace protocol | 192 } // namespace protocol |
| 189 } // namespace remoting | 193 } // namespace remoting |
| 190 | 194 |
| 191 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ | 195 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
| OLD | NEW |