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

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

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 #ifndef REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_BASE_H_ 5 #ifndef REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_BASE_H_
6 #define REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_BASE_H_ 6 #define REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_BASE_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "remoting/protocol/authenticator.h" 15 #include "remoting/protocol/authenticator.h"
16 16
17 namespace buzz { 17 namespace buzz {
18 struct StaticQName; 18 struct StaticQName;
19 } // namespace buzz 19 } // namespace buzz
20 20
21 namespace remoting { 21 namespace remoting {
22 namespace protocol { 22 namespace protocol {
23 23
24 // This class provides the common base for a meta-authenticator that allows 24 // This class provides the common base for a meta-authenticator that allows
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 THIRD_PARTY_SPAKE2_CURVE25519, 83 THIRD_PARTY_SPAKE2_CURVE25519,
84 }; 84 };
85 85
86 ~NegotiatingAuthenticatorBase() override; 86 ~NegotiatingAuthenticatorBase() override;
87 87
88 // Authenticator interface. 88 // Authenticator interface.
89 State state() const override; 89 State state() const override;
90 bool started() const override; 90 bool started() const override;
91 RejectionReason rejection_reason() const override; 91 RejectionReason rejection_reason() const override;
92 const std::string& GetAuthKey() const override; 92 const std::string& GetAuthKey() const override;
93 scoped_ptr<ChannelAuthenticator> CreateChannelAuthenticator() const override; 93 std::unique_ptr<ChannelAuthenticator> CreateChannelAuthenticator()
94 const override;
94 95
95 // Calls |current_authenticator_| to process |message|, passing the supplied 96 // Calls |current_authenticator_| to process |message|, passing the supplied
96 // |resume_callback|. 97 // |resume_callback|.
97 void ProcessMessageInternal(const buzz::XmlElement* message, 98 void ProcessMessageInternal(const buzz::XmlElement* message,
98 const base::Closure& resume_callback); 99 const base::Closure& resume_callback);
99 100
100 protected: 101 protected:
101 friend class NegotiatingAuthenticatorTest; 102 friend class NegotiatingAuthenticatorTest;
102 103
103 static const buzz::StaticQName kMethodAttributeQName; 104 static const buzz::StaticQName kMethodAttributeQName;
(...skipping 13 matching lines...) Expand all
117 explicit NegotiatingAuthenticatorBase(Authenticator::State initial_state); 118 explicit NegotiatingAuthenticatorBase(Authenticator::State initial_state);
118 119
119 void AddMethod(Method method); 120 void AddMethod(Method method);
120 121
121 // Updates |state_| to reflect the current underlying authenticator state. 122 // Updates |state_| to reflect the current underlying authenticator state.
122 // |resume_callback| is called after the state is updated. 123 // |resume_callback| is called after the state is updated.
123 void UpdateState(const base::Closure& resume_callback); 124 void UpdateState(const base::Closure& resume_callback);
124 125
125 // Gets the next message from |current_authenticator_|, if any, and fills in 126 // Gets the next message from |current_authenticator_|, if any, and fills in
126 // the 'method' tag with |current_method_|. 127 // the 'method' tag with |current_method_|.
127 virtual scoped_ptr<buzz::XmlElement> GetNextMessageInternal(); 128 virtual std::unique_ptr<buzz::XmlElement> GetNextMessageInternal();
128 129
129 std::vector<Method> methods_; 130 std::vector<Method> methods_;
130 Method current_method_ = Method::INVALID; 131 Method current_method_ = Method::INVALID;
131 scoped_ptr<Authenticator> current_authenticator_; 132 std::unique_ptr<Authenticator> current_authenticator_;
132 State state_; 133 State state_;
133 RejectionReason rejection_reason_ = INVALID_CREDENTIALS; 134 RejectionReason rejection_reason_ = INVALID_CREDENTIALS;
134 135
135 private: 136 private:
136 DISALLOW_COPY_AND_ASSIGN(NegotiatingAuthenticatorBase); 137 DISALLOW_COPY_AND_ASSIGN(NegotiatingAuthenticatorBase);
137 }; 138 };
138 139
139 } // namespace protocol 140 } // namespace protocol
140 } // namespace remoting 141 } // namespace remoting
141 142
142 #endif // REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_BASE_H_ 143 #endif // REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_BASE_H_
OLDNEW
« no previous file with comments | « remoting/protocol/monitored_video_stub_unittest.cc ('k') | remoting/protocol/negotiating_authenticator_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698