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/third_party_authenticator_base.h" | 5 #include "remoting/protocol/third_party_authenticator_base.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/callback.h" | 9 #include "base/callback.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 if (token_state_ == WAITING_MESSAGE) { | 61 if (token_state_ == WAITING_MESSAGE) { |
62 ProcessTokenMessage(message, resume_callback); | 62 ProcessTokenMessage(message, resume_callback); |
63 } else { | 63 } else { |
64 DCHECK_EQ(token_state_, ACCEPTED); | 64 DCHECK_EQ(token_state_, ACCEPTED); |
65 DCHECK(underlying_); | 65 DCHECK(underlying_); |
66 DCHECK_EQ(underlying_->state(), WAITING_MESSAGE); | 66 DCHECK_EQ(underlying_->state(), WAITING_MESSAGE); |
67 underlying_->ProcessMessage(message, resume_callback); | 67 underlying_->ProcessMessage(message, resume_callback); |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 scoped_ptr<buzz::XmlElement> ThirdPartyAuthenticatorBase::GetNextMessage() { | 71 std::unique_ptr<buzz::XmlElement> |
| 72 ThirdPartyAuthenticatorBase::GetNextMessage() { |
72 DCHECK_EQ(state(), MESSAGE_READY); | 73 DCHECK_EQ(state(), MESSAGE_READY); |
73 | 74 |
74 scoped_ptr<buzz::XmlElement> message; | 75 std::unique_ptr<buzz::XmlElement> message; |
75 if (underlying_ && underlying_->state() == MESSAGE_READY) { | 76 if (underlying_ && underlying_->state() == MESSAGE_READY) { |
76 message = underlying_->GetNextMessage(); | 77 message = underlying_->GetNextMessage(); |
77 } else { | 78 } else { |
78 message = CreateEmptyAuthenticatorMessage(); | 79 message = CreateEmptyAuthenticatorMessage(); |
79 } | 80 } |
80 | 81 |
81 if (token_state_ == MESSAGE_READY) { | 82 if (token_state_ == MESSAGE_READY) { |
82 AddTokenElements(message.get()); | 83 AddTokenElements(message.get()); |
83 started_ = true; | 84 started_ = true; |
84 } | 85 } |
85 return message; | 86 return message; |
86 } | 87 } |
87 | 88 |
88 const std::string& ThirdPartyAuthenticatorBase::GetAuthKey() const { | 89 const std::string& ThirdPartyAuthenticatorBase::GetAuthKey() const { |
89 DCHECK_EQ(state(), ACCEPTED); | 90 DCHECK_EQ(state(), ACCEPTED); |
90 | 91 |
91 return underlying_->GetAuthKey(); | 92 return underlying_->GetAuthKey(); |
92 } | 93 } |
93 | 94 |
94 scoped_ptr<ChannelAuthenticator> | 95 std::unique_ptr<ChannelAuthenticator> |
95 ThirdPartyAuthenticatorBase::CreateChannelAuthenticator() const { | 96 ThirdPartyAuthenticatorBase::CreateChannelAuthenticator() const { |
96 DCHECK_EQ(state(), ACCEPTED); | 97 DCHECK_EQ(state(), ACCEPTED); |
97 | 98 |
98 return underlying_->CreateChannelAuthenticator(); | 99 return underlying_->CreateChannelAuthenticator(); |
99 } | 100 } |
100 | 101 |
101 } // namespace protocol | 102 } // namespace protocol |
102 } // namespace remoting | 103 } // namespace remoting |
OLD | NEW |