OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/pairing_authenticator_base.h" | 5 #include "remoting/protocol/pairing_authenticator_base.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "remoting/base/constants.h" | 8 #include "remoting/base/constants.h" |
9 #include "remoting/protocol/channel_authenticator.h" | 9 #include "remoting/protocol/channel_authenticator.h" |
10 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 message, | 84 message, |
85 base::Bind(&PairingAuthenticatorBase::CheckForFailedSpakeExchange, | 85 base::Bind(&PairingAuthenticatorBase::CheckForFailedSpakeExchange, |
86 weak_factory_.GetWeakPtr(), resume_callback)); | 86 weak_factory_.GetWeakPtr(), resume_callback)); |
87 } | 87 } |
88 | 88 |
89 scoped_ptr<buzz::XmlElement> PairingAuthenticatorBase::GetNextMessage() { | 89 scoped_ptr<buzz::XmlElement> PairingAuthenticatorBase::GetNextMessage() { |
90 DCHECK_EQ(state(), MESSAGE_READY); | 90 DCHECK_EQ(state(), MESSAGE_READY); |
91 scoped_ptr<buzz::XmlElement> result = v2_authenticator_->GetNextMessage(); | 91 scoped_ptr<buzz::XmlElement> result = v2_authenticator_->GetNextMessage(); |
92 AddPairingElements(result.get()); | 92 AddPairingElements(result.get()); |
93 MaybeAddErrorMessage(result.get()); | 93 MaybeAddErrorMessage(result.get()); |
94 return result.Pass(); | 94 return result; |
95 } | 95 } |
96 | 96 |
97 const std::string& PairingAuthenticatorBase::GetAuthKey() const { | 97 const std::string& PairingAuthenticatorBase::GetAuthKey() const { |
98 return v2_authenticator_->GetAuthKey(); | 98 return v2_authenticator_->GetAuthKey(); |
99 } | 99 } |
100 | 100 |
101 scoped_ptr<ChannelAuthenticator> | 101 scoped_ptr<ChannelAuthenticator> |
102 PairingAuthenticatorBase::CreateChannelAuthenticator() const { | 102 PairingAuthenticatorBase::CreateChannelAuthenticator() const { |
103 return v2_authenticator_->CreateChannelAuthenticator(); | 103 return v2_authenticator_->CreateChannelAuthenticator(); |
104 } | 104 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 resume_callback.Run(); | 146 resume_callback.Run(); |
147 } | 147 } |
148 | 148 |
149 void PairingAuthenticatorBase::SetAuthenticatorAndProcessMessage( | 149 void PairingAuthenticatorBase::SetAuthenticatorAndProcessMessage( |
150 const buzz::XmlElement* message, | 150 const buzz::XmlElement* message, |
151 const base::Closure& resume_callback, | 151 const base::Closure& resume_callback, |
152 scoped_ptr<Authenticator> authenticator) { | 152 scoped_ptr<Authenticator> authenticator) { |
153 DCHECK(!v2_authenticator_); | 153 DCHECK(!v2_authenticator_); |
154 DCHECK(authenticator); | 154 DCHECK(authenticator); |
155 waiting_for_authenticator_ = false; | 155 waiting_for_authenticator_ = false; |
156 v2_authenticator_ = authenticator.Pass(); | 156 v2_authenticator_ = std::move(authenticator); |
157 if (message) { | 157 if (message) { |
158 ProcessMessage(message, resume_callback); | 158 ProcessMessage(message, resume_callback); |
159 } else { | 159 } else { |
160 resume_callback.Run(); | 160 resume_callback.Run(); |
161 } | 161 } |
162 } | 162 } |
163 | 163 |
164 } // namespace protocol | 164 } // namespace protocol |
165 } // namespace remoting | 165 } // namespace remoting |
OLD | NEW |