OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/local_discovery/privetv3_crypto_provider.h" | 5 #include "chrome/browser/local_discovery/privetv3_crypto_provider.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace local_discovery { | 9 namespace local_discovery { |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 // A stub session type used for development/debugging. | 13 // A stub session type used for development/debugging. |
14 const char kAuthMethodEmpty[] = "empty"; | 14 const char kAuthMethodEmpty[] = "empty"; |
15 | 15 |
16 const char kHandshakeStateComplete[] = "complete"; | 16 const char kHandshakeStateComplete[] = "complete"; |
17 const char kStubVerificationCode[] = "SAMPLE"; | 17 const char kStubVerificationCode[] = "SAMPLE"; |
18 } | 18 } |
19 | 19 |
20 class PrivetV3CryptoProviderEmpty : public PrivetV3CryptoProvider { | 20 class PrivetV3CryptoProviderEmpty : public PrivetV3CryptoProvider { |
21 public: | 21 public: |
22 PrivetV3CryptoProviderEmpty(); | 22 PrivetV3CryptoProviderEmpty(); |
23 virtual ~PrivetV3CryptoProviderEmpty(); | 23 virtual ~PrivetV3CryptoProviderEmpty(); |
24 | 24 |
25 // PrivetV3CryptoProvider implementation. | 25 // PrivetV3CryptoProvider implementation. |
26 virtual HandshakeState GetState() OVERRIDE; | 26 virtual HandshakeState GetState() override; |
27 virtual std::string GetAuthMethod() OVERRIDE; | 27 virtual std::string GetAuthMethod() override; |
28 virtual HandshakeState GetNextStep(int* step, std::string* package) OVERRIDE; | 28 virtual HandshakeState GetNextStep(int* step, std::string* package) override; |
29 virtual HandshakeState SetStepResponse(int step, | 29 virtual HandshakeState SetStepResponse(int step, |
30 const std::string& state, | 30 const std::string& state, |
31 const std::string& package) OVERRIDE; | 31 const std::string& package) override; |
32 virtual std::string GetVerificationCode() OVERRIDE; | 32 virtual std::string GetVerificationCode() override; |
33 virtual HandshakeState AcceptVerificationCode() OVERRIDE; | 33 virtual HandshakeState AcceptVerificationCode() override; |
34 virtual bool EncryptData(const std::string& input, | 34 virtual bool EncryptData(const std::string& input, |
35 std::string* output) OVERRIDE; | 35 std::string* output) override; |
36 | 36 |
37 private: | 37 private: |
38 HandshakeState state_; | 38 HandshakeState state_; |
39 }; | 39 }; |
40 | 40 |
41 scoped_ptr<PrivetV3CryptoProvider> Create( | 41 scoped_ptr<PrivetV3CryptoProvider> Create( |
42 const std::vector<std::string>& available_auth_methods) { | 42 const std::vector<std::string>& available_auth_methods) { |
43 for (size_t i = 0; i < available_auth_methods.size(); i++) { | 43 for (size_t i = 0; i < available_auth_methods.size(); i++) { |
44 if (available_auth_methods[i] == kAuthMethodEmpty) { | 44 if (available_auth_methods[i] == kAuthMethodEmpty) { |
45 return scoped_ptr<PrivetV3CryptoProvider>( | 45 return scoped_ptr<PrivetV3CryptoProvider>( |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 return (state_ = HANDSHAKE_COMPLETE); | 105 return (state_ = HANDSHAKE_COMPLETE); |
106 } | 106 } |
107 | 107 |
108 bool PrivetV3CryptoProviderEmpty::EncryptData(const std::string& input, | 108 bool PrivetV3CryptoProviderEmpty::EncryptData(const std::string& input, |
109 std::string* output) { | 109 std::string* output) { |
110 *output = input; | 110 *output = input; |
111 return true; | 111 return true; |
112 } | 112 } |
113 | 113 |
114 } // namespace local_discovery | 114 } // namespace local_discovery |
OLD | NEW |