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/signaling/xmpp_login_handler.h" | 5 #include "remoting/signaling/xmpp_login_handler.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/base64.h" | 9 #include "base/base64.h" |
8 #include "base/bind.h" | 10 #include "base/bind.h" |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
10 #include "remoting/signaling/xmpp_stream_parser.h" | 12 #include "remoting/signaling/xmpp_stream_parser.h" |
11 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" | 13 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" |
12 | 14 |
13 // Undefine SendMessage and ERROR defined in Windows headers. | 15 // Undefine SendMessage and ERROR defined in Windows headers. |
14 #ifdef SendMessage | 16 #ifdef SendMessage |
15 #undef SendMessage | 17 #undef SendMessage |
16 #endif | 18 #endif |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 177 |
176 case State::WAIT_SESSION_IQ_RESULT: | 178 case State::WAIT_SESSION_IQ_RESULT: |
177 if (stanza->Name() != kXmppIqName || | 179 if (stanza->Name() != kXmppIqName || |
178 stanza->Attr(buzz::QName("", "id")) != "1" || | 180 stanza->Attr(buzz::QName("", "id")) != "1" || |
179 stanza->Attr(buzz::QName("", "type")) != "result") { | 181 stanza->Attr(buzz::QName("", "type")) != "result") { |
180 LOG(ERROR) << "Failed to start session: " << stanza->Str(); | 182 LOG(ERROR) << "Failed to start session: " << stanza->Str(); |
181 OnError(SignalStrategy::PROTOCOL_ERROR); | 183 OnError(SignalStrategy::PROTOCOL_ERROR); |
182 return; | 184 return; |
183 } | 185 } |
184 state_ = State::DONE; | 186 state_ = State::DONE; |
185 delegate_->OnHandshakeDone(jid_, stream_parser_.Pass()); | 187 delegate_->OnHandshakeDone(jid_, std::move(stream_parser_)); |
186 break; | 188 break; |
187 | 189 |
188 default: | 190 default: |
189 NOTREACHED(); | 191 NOTREACHED(); |
190 break; | 192 break; |
191 } | 193 } |
192 } | 194 } |
193 | 195 |
194 void XmppLoginHandler::OnTlsStarted() { | 196 void XmppLoginHandler::OnTlsStarted() { |
195 DCHECK(state_ == State::STARTING_TLS); | 197 DCHECK(state_ == State::STARTING_TLS); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } | 234 } |
233 | 235 |
234 void XmppLoginHandler::OnError(SignalStrategy::Error error) { | 236 void XmppLoginHandler::OnError(SignalStrategy::Error error) { |
235 if (state_ != State::ERROR) { | 237 if (state_ != State::ERROR) { |
236 state_ = State::ERROR; | 238 state_ = State::ERROR; |
237 delegate_->OnLoginHandlerError(error); | 239 delegate_->OnLoginHandlerError(error); |
238 } | 240 } |
239 } | 241 } |
240 | 242 |
241 } // namespace remoting | 243 } // namespace remoting |
OLD | NEW |