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> | 7 #include <utility> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 break; | 76 break; |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 void XmppLoginHandler::OnDataReceived(const std::string& data) { | 80 void XmppLoginHandler::OnDataReceived(const std::string& data) { |
81 DCHECK(state_ != State::INIT && state_ != State::DONE && | 81 DCHECK(state_ != State::INIT && state_ != State::DONE && |
82 state_ != State::ERROR); | 82 state_ != State::ERROR); |
83 stream_parser_->AppendData(data); | 83 stream_parser_->AppendData(data); |
84 } | 84 } |
85 | 85 |
86 void XmppLoginHandler::OnStanza(scoped_ptr<buzz::XmlElement> stanza) { | 86 void XmppLoginHandler::OnStanza(std::unique_ptr<buzz::XmlElement> stanza) { |
87 switch (state_) { | 87 switch (state_) { |
88 case State::WAIT_STREAM_HEADER: { | 88 case State::WAIT_STREAM_HEADER: { |
89 if (stanza->Name() == kJabberFeaturesName && | 89 if (stanza->Name() == kJabberFeaturesName && |
90 stanza->FirstNamed(kStartTlsName) != nullptr) { | 90 stanza->FirstNamed(kStartTlsName) != nullptr) { |
91 state_ = State::WAIT_STARTTLS_RESPONSE; | 91 state_ = State::WAIT_STARTTLS_RESPONSE; |
92 } else { | 92 } else { |
93 LOG(ERROR) << "Server doesn't support TLS."; | 93 LOG(ERROR) << "Server doesn't support TLS."; |
94 OnError(SignalStrategy::PROTOCOL_ERROR); | 94 OnError(SignalStrategy::PROTOCOL_ERROR); |
95 } | 95 } |
96 break; | 96 break; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 } | 234 } |
235 | 235 |
236 void XmppLoginHandler::OnError(SignalStrategy::Error error) { | 236 void XmppLoginHandler::OnError(SignalStrategy::Error error) { |
237 if (state_ != State::ERROR) { | 237 if (state_ != State::ERROR) { |
238 state_ = State::ERROR; | 238 state_ = State::ERROR; |
239 delegate_->OnLoginHandlerError(error); | 239 delegate_->OnLoginHandlerError(error); |
240 } | 240 } |
241 } | 241 } |
242 | 242 |
243 } // namespace remoting | 243 } // namespace remoting |
OLD | NEW |