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

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

Issue 9240033: Use scoped_ptr<>.Pass() to pass ownership in the remoting protocol code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 8 years, 11 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 | Annotate | Revision Log
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_V2_AUTHENTICATOR_H_ 5 #ifndef REMOTING_PROTOCOL_V2_AUTHENTICATOR_H_
6 #define REMOTING_PROTOCOL_V2_AUTHENTICATOR_H_ 6 #define REMOTING_PROTOCOL_V2_AUTHENTICATOR_H_
7 7
8 #include <string> 8 #include <string>
9 #include <queue> 9 #include <queue>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "crypto/p224_spake.h" 14 #include "crypto/p224_spake.h"
15 #include "remoting/protocol/authenticator.h" 15 #include "remoting/protocol/authenticator.h"
16 16
17 namespace crypto { 17 namespace crypto {
18 class RSAPrivateKey; 18 class RSAPrivateKey;
19 } // namespace crypto 19 } // namespace crypto
20 20
21 namespace remoting { 21 namespace remoting {
22 namespace protocol { 22 namespace protocol {
23 23
24 class V2Authenticator : public Authenticator { 24 class V2Authenticator : public Authenticator {
25 public: 25 public:
26 static bool IsEkeMessage(const buzz::XmlElement* message); 26 static bool IsEkeMessage(const buzz::XmlElement* message);
27 27
28 static V2Authenticator* CreateForClient( 28 static scoped_ptr<Authenticator> CreateForClient(
29 const std::string& shared_secret); 29 const std::string& shared_secret);
30 30
31 static V2Authenticator* CreateForHost( 31 static scoped_ptr<Authenticator> CreateForHost(
32 const std::string& local_cert, 32 const std::string& local_cert,
33 const crypto::RSAPrivateKey& local_private_key, 33 const crypto::RSAPrivateKey& local_private_key,
34 const std::string& shared_secret); 34 const std::string& shared_secret);
35 35
36 virtual ~V2Authenticator(); 36 virtual ~V2Authenticator();
37 37
38 // Authenticator interface. 38 // Authenticator interface.
39 virtual State state() const OVERRIDE; 39 virtual State state() const OVERRIDE;
40 virtual void ProcessMessage(const buzz::XmlElement* message) OVERRIDE; 40 virtual void ProcessMessage(const buzz::XmlElement* message) OVERRIDE;
41 virtual buzz::XmlElement* GetNextMessage() OVERRIDE; 41 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE;
42 virtual ChannelAuthenticator* CreateChannelAuthenticator() const OVERRIDE; 42 virtual scoped_ptr<ChannelAuthenticator>
43 CreateChannelAuthenticator() const OVERRIDE;
43 44
44 private: 45 private:
45 FRIEND_TEST_ALL_PREFIXES(V2AuthenticatorTest, InvalidSecret); 46 FRIEND_TEST_ALL_PREFIXES(V2AuthenticatorTest, InvalidSecret);
46 47
47 V2Authenticator(crypto::P224EncryptedKeyExchange::PeerType type, 48 V2Authenticator(crypto::P224EncryptedKeyExchange::PeerType type,
48 const std::string& shared_secret); 49 const std::string& shared_secret);
49 50
50 bool is_host_side() const; 51 bool is_host_side() const;
51 52
52 // Used only for HOST authenticators. 53 // Used only for HOST authenticators.
(...skipping 10 matching lines...) Expand all
63 std::queue<std::string> pending_messages_; 64 std::queue<std::string> pending_messages_;
64 std::string auth_key_; 65 std::string auth_key_;
65 66
66 DISALLOW_COPY_AND_ASSIGN(V2Authenticator); 67 DISALLOW_COPY_AND_ASSIGN(V2Authenticator);
67 }; 68 };
68 69
69 } // namespace protocol 70 } // namespace protocol
70 } // namespace remoting 71 } // namespace remoting
71 72
72 #endif // REMOTING_PROTOCOL_V2_AUTHENTICATOR_H_ 73 #endif // REMOTING_PROTOCOL_V2_AUTHENTICATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698