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 "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "remoting/signaling/xmpp_stream_parser.h" | 10 #include "remoting/signaling/xmpp_stream_parser.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 "xmlns:auth=\"http://www.google.com/talk/protocol/auth\">" + | 214 "xmlns:auth=\"http://www.google.com/talk/protocol/auth\">" + |
215 cookie + | 215 cookie + |
216 "</auth>"); | 216 "</auth>"); |
217 }; | 217 }; |
218 | 218 |
219 void XmppLoginHandler::OnParserError() { | 219 void XmppLoginHandler::OnParserError() { |
220 OnError(SignalStrategy::PROTOCOL_ERROR); | 220 OnError(SignalStrategy::PROTOCOL_ERROR); |
221 } | 221 } |
222 | 222 |
223 void XmppLoginHandler::StartStream(const std::string& first_message) { | 223 void XmppLoginHandler::StartStream(const std::string& first_message) { |
| 224 stream_parser_.reset(new XmppStreamParser()); |
| 225 stream_parser_->SetCallbacks( |
| 226 base::Bind(&XmppLoginHandler::OnStanza, base::Unretained(this)), |
| 227 base::Bind(&XmppLoginHandler::OnParserError, base::Unretained(this))); |
224 delegate_->SendMessage("<stream:stream to=\"" + server_ + | 228 delegate_->SendMessage("<stream:stream to=\"" + server_ + |
225 "\" version=\"1.0\" xmlns=\"jabber:client\" " | 229 "\" version=\"1.0\" xmlns=\"jabber:client\" " |
226 "xmlns:stream=\"http://etherx.jabber.org/streams\">" + | 230 "xmlns:stream=\"http://etherx.jabber.org/streams\">" + |
227 first_message); | 231 first_message); |
228 stream_parser_.reset(new XmppStreamParser()); | |
229 stream_parser_->SetCallbacks( | |
230 base::Bind(&XmppLoginHandler::OnStanza, base::Unretained(this)), | |
231 base::Bind(&XmppLoginHandler::OnParserError, base::Unretained(this))); | |
232 } | 232 } |
233 | 233 |
234 void XmppLoginHandler::OnError(SignalStrategy::Error error) { | 234 void XmppLoginHandler::OnError(SignalStrategy::Error error) { |
235 if (state_ != State::ERROR) { | 235 if (state_ != State::ERROR) { |
236 state_ = State::ERROR; | 236 state_ = State::ERROR; |
237 delegate_->OnLoginHandlerError(error); | 237 delegate_->OnLoginHandlerError(error); |
238 } | 238 } |
239 } | 239 } |
240 | 240 |
241 } // namespace remoting | 241 } // namespace remoting |
OLD | NEW |