Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: remoting/protocol/negotiating_authenticator_base.cc

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // Verify that this is a valid state transition. 120 // Verify that this is a valid state transition.
121 DCHECK(state_ == MESSAGE_READY || state_ == ACCEPTED || state_ == REJECTED) 121 DCHECK(state_ == MESSAGE_READY || state_ == ACCEPTED || state_ == REJECTED)
122 << "State: " << state_; 122 << "State: " << state_;
123 123
124 if (state_ == REJECTED) 124 if (state_ == REJECTED)
125 rejection_reason_ = current_authenticator_->rejection_reason(); 125 rejection_reason_ = current_authenticator_->rejection_reason();
126 126
127 resume_callback.Run(); 127 resume_callback.Run();
128 } 128 }
129 129
130 scoped_ptr<buzz::XmlElement> 130 std::unique_ptr<buzz::XmlElement>
131 NegotiatingAuthenticatorBase::GetNextMessageInternal() { 131 NegotiatingAuthenticatorBase::GetNextMessageInternal() {
132 DCHECK_EQ(state(), MESSAGE_READY); 132 DCHECK_EQ(state(), MESSAGE_READY);
133 DCHECK(current_method_ != Method::INVALID); 133 DCHECK(current_method_ != Method::INVALID);
134 134
135 scoped_ptr<buzz::XmlElement> result; 135 std::unique_ptr<buzz::XmlElement> result;
136 if (current_authenticator_->state() == MESSAGE_READY) { 136 if (current_authenticator_->state() == MESSAGE_READY) {
137 result = current_authenticator_->GetNextMessage(); 137 result = current_authenticator_->GetNextMessage();
138 } else { 138 } else {
139 result = CreateEmptyAuthenticatorMessage(); 139 result = CreateEmptyAuthenticatorMessage();
140 } 140 }
141 state_ = current_authenticator_->state(); 141 state_ = current_authenticator_->state();
142 DCHECK(state_ == ACCEPTED || state_ == WAITING_MESSAGE); 142 DCHECK(state_ == ACCEPTED || state_ == WAITING_MESSAGE);
143 result->AddAttr(kMethodAttributeQName, MethodToString(current_method_)); 143 result->AddAttr(kMethodAttributeQName, MethodToString(current_method_));
144 return result; 144 return result;
145 } 145 }
146 146
147 void NegotiatingAuthenticatorBase::AddMethod(Method method) { 147 void NegotiatingAuthenticatorBase::AddMethod(Method method) {
148 DCHECK(method != Method::INVALID); 148 DCHECK(method != Method::INVALID);
149 methods_.push_back(method); 149 methods_.push_back(method);
150 } 150 }
151 151
152 const std::string& NegotiatingAuthenticatorBase::GetAuthKey() const { 152 const std::string& NegotiatingAuthenticatorBase::GetAuthKey() const {
153 DCHECK_EQ(state(), ACCEPTED); 153 DCHECK_EQ(state(), ACCEPTED);
154 return current_authenticator_->GetAuthKey(); 154 return current_authenticator_->GetAuthKey();
155 } 155 }
156 156
157 scoped_ptr<ChannelAuthenticator> 157 std::unique_ptr<ChannelAuthenticator>
158 NegotiatingAuthenticatorBase::CreateChannelAuthenticator() const { 158 NegotiatingAuthenticatorBase::CreateChannelAuthenticator() const {
159 DCHECK_EQ(state(), ACCEPTED); 159 DCHECK_EQ(state(), ACCEPTED);
160 return current_authenticator_->CreateChannelAuthenticator(); 160 return current_authenticator_->CreateChannelAuthenticator();
161 } 161 }
162 162
163 } // namespace protocol 163 } // namespace protocol
164 } // namespace remoting 164 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/negotiating_authenticator_base.h ('k') | remoting/protocol/negotiating_authenticator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698