OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/negotiating_authenticator_base.h" | 5 #include "remoting/protocol/negotiating_authenticator_base.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 scoped_ptr<buzz::XmlElement> result; | 88 scoped_ptr<buzz::XmlElement> result; |
89 if (current_authenticator_->state() == MESSAGE_READY) { | 89 if (current_authenticator_->state() == MESSAGE_READY) { |
90 result = current_authenticator_->GetNextMessage(); | 90 result = current_authenticator_->GetNextMessage(); |
91 } else { | 91 } else { |
92 result = CreateEmptyAuthenticatorMessage(); | 92 result = CreateEmptyAuthenticatorMessage(); |
93 } | 93 } |
94 state_ = current_authenticator_->state(); | 94 state_ = current_authenticator_->state(); |
95 DCHECK(state_ == ACCEPTED || state_ == WAITING_MESSAGE); | 95 DCHECK(state_ == ACCEPTED || state_ == WAITING_MESSAGE); |
96 result->AddAttr(kMethodAttributeQName, current_method_.ToString()); | 96 result->AddAttr(kMethodAttributeQName, current_method_.ToString()); |
97 return result.Pass(); | 97 return result; |
98 } | 98 } |
99 | 99 |
100 void NegotiatingAuthenticatorBase::AddMethod( | 100 void NegotiatingAuthenticatorBase::AddMethod( |
101 const AuthenticationMethod& method) { | 101 const AuthenticationMethod& method) { |
102 DCHECK(method.is_valid()); | 102 DCHECK(method.is_valid()); |
103 methods_.push_back(method); | 103 methods_.push_back(method); |
104 } | 104 } |
105 | 105 |
106 const std::string& NegotiatingAuthenticatorBase::GetAuthKey() const { | 106 const std::string& NegotiatingAuthenticatorBase::GetAuthKey() const { |
107 DCHECK_EQ(state(), ACCEPTED); | 107 DCHECK_EQ(state(), ACCEPTED); |
108 return current_authenticator_->GetAuthKey(); | 108 return current_authenticator_->GetAuthKey(); |
109 } | 109 } |
110 | 110 |
111 scoped_ptr<ChannelAuthenticator> | 111 scoped_ptr<ChannelAuthenticator> |
112 NegotiatingAuthenticatorBase::CreateChannelAuthenticator() const { | 112 NegotiatingAuthenticatorBase::CreateChannelAuthenticator() const { |
113 DCHECK_EQ(state(), ACCEPTED); | 113 DCHECK_EQ(state(), ACCEPTED); |
114 return current_authenticator_->CreateChannelAuthenticator(); | 114 return current_authenticator_->CreateChannelAuthenticator(); |
115 } | 115 } |
116 | 116 |
117 } // namespace protocol | 117 } // namespace protocol |
118 } // namespace remoting | 118 } // namespace remoting |
OLD | NEW |