OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "remoting/protocol/connection_to_host_impl.h" | 5 #include "remoting/protocol/connection_to_host_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "remoting/base/constants.h" | 10 #include "remoting/base/constants.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 if (session_.get()) | 41 if (session_.get()) |
42 session_.reset(); | 42 session_.reset(); |
43 | 43 |
44 if (session_manager_.get()) | 44 if (session_manager_.get()) |
45 session_manager_.reset(); | 45 session_manager_.reset(); |
46 | 46 |
47 if (signal_strategy_) | 47 if (signal_strategy_) |
48 signal_strategy_->RemoveListener(this); | 48 signal_strategy_->RemoveListener(this); |
49 } | 49 } |
50 | 50 |
| 51 #define RETURN_STRING_LITERAL(x) \ |
| 52 case x: \ |
| 53 return #x; |
| 54 |
| 55 const char* ConnectionToHost::StateToString(State state) { |
| 56 switch (state) { |
| 57 RETURN_STRING_LITERAL(INITIALIZING); |
| 58 RETURN_STRING_LITERAL(CONNECTING); |
| 59 RETURN_STRING_LITERAL(AUTHENTICATED); |
| 60 RETURN_STRING_LITERAL(CONNECTED); |
| 61 RETURN_STRING_LITERAL(CLOSED); |
| 62 RETURN_STRING_LITERAL(FAILED); |
| 63 } |
| 64 NOTREACHED(); |
| 65 return nullptr; |
| 66 } |
| 67 |
51 void ConnectionToHostImpl::Connect( | 68 void ConnectionToHostImpl::Connect( |
52 SignalStrategy* signal_strategy, | 69 SignalStrategy* signal_strategy, |
53 scoped_ptr<TransportFactory> transport_factory, | 70 scoped_ptr<TransportFactory> transport_factory, |
54 scoped_ptr<Authenticator> authenticator, | 71 scoped_ptr<Authenticator> authenticator, |
55 const std::string& host_jid, | 72 const std::string& host_jid, |
56 HostEventCallback* event_callback) { | 73 HostEventCallback* event_callback) { |
57 DCHECK(client_stub_); | 74 DCHECK(client_stub_); |
58 DCHECK(clipboard_stub_); | 75 DCHECK(clipboard_stub_); |
59 DCHECK(monitored_video_stub_); | 76 DCHECK(monitored_video_stub_); |
60 | 77 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 311 |
295 if (state != state_) { | 312 if (state != state_) { |
296 state_ = state; | 313 state_ = state; |
297 error_ = error; | 314 error_ = error; |
298 event_callback_->OnConnectionState(state_, error_); | 315 event_callback_->OnConnectionState(state_, error_); |
299 } | 316 } |
300 } | 317 } |
301 | 318 |
302 } // namespace protocol | 319 } // namespace protocol |
303 } // namespace remoting | 320 } // namespace remoting |
OLD | NEW |