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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 return rejection_reason_; | 45 return rejection_reason_; |
46 } | 46 } |
47 | 47 |
48 void NegotiatingAuthenticatorBase::ProcessMessageInternal( | 48 void NegotiatingAuthenticatorBase::ProcessMessageInternal( |
49 const buzz::XmlElement* message, | 49 const buzz::XmlElement* message, |
50 const base::Closure& resume_callback) { | 50 const base::Closure& resume_callback) { |
51 if (current_authenticator_->state() == WAITING_MESSAGE) { | 51 if (current_authenticator_->state() == WAITING_MESSAGE) { |
52 // If the message was not discarded and the authenticator is waiting for it, | 52 // If the message was not discarded and the authenticator is waiting for it, |
53 // give it to the underlying authenticator to process. | 53 // give it to the underlying authenticator to process. |
54 // |current_authenticator_| is owned, so Unretained() is safe here. | 54 // |current_authenticator_| is owned, so Unretained() is safe here. |
| 55 state_ = PROCESSING_MESSAGE; |
55 current_authenticator_->ProcessMessage(message, base::Bind( | 56 current_authenticator_->ProcessMessage(message, base::Bind( |
56 &NegotiatingAuthenticatorBase::UpdateState, | 57 &NegotiatingAuthenticatorBase::UpdateState, |
57 base::Unretained(this), resume_callback)); | 58 base::Unretained(this), resume_callback)); |
58 } else { | 59 } else { |
59 // Otherwise, just discard the message and run the callback. | 60 // Otherwise, just discard the message and run the callback. |
60 resume_callback.Run(); | 61 resume_callback.Run(); |
61 } | 62 } |
62 } | 63 } |
63 | 64 |
64 void NegotiatingAuthenticatorBase::UpdateState( | 65 void NegotiatingAuthenticatorBase::UpdateState( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 97 } |
97 | 98 |
98 scoped_ptr<ChannelAuthenticator> | 99 scoped_ptr<ChannelAuthenticator> |
99 NegotiatingAuthenticatorBase::CreateChannelAuthenticator() const { | 100 NegotiatingAuthenticatorBase::CreateChannelAuthenticator() const { |
100 DCHECK_EQ(state(), ACCEPTED); | 101 DCHECK_EQ(state(), ACCEPTED); |
101 return current_authenticator_->CreateChannelAuthenticator(); | 102 return current_authenticator_->CreateChannelAuthenticator(); |
102 } | 103 } |
103 | 104 |
104 } // namespace protocol | 105 } // namespace protocol |
105 } // namespace remoting | 106 } // namespace remoting |
OLD | NEW |