Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/local_discovery/privetv3_crypto_provider.h" | |
| 6 | |
| 7 namespace local_discovery { | |
| 8 | |
| 9 namespace { | |
| 10 | |
| 11 // A stub session type used for development/debugging. | |
| 12 const char kAuthMethodEmpty[] = "empty"; | |
| 13 } | |
| 14 | |
| 15 class PrivetV3CryptoProviderEmpty : public PrivetV3CryptoProvider { | |
| 16 public: | |
| 17 PrivetV3CryptoProviderEmpty(); | |
| 18 virtual ~PrivetV3CryptoProviderEmpty(); | |
| 19 | |
| 20 // PrivetV3CryptoProvider implementation. | |
| 21 virtual const std::string& GetAuthMethod() OVERRIDE; | |
| 22 virtual bool GetNextStep(int* step, std::string* package) OVERRIDE; | |
| 23 virtual bool SetStepResponse(int step, const std::string& package) OVERRIDE; | |
| 24 virtual bool EncryptData(const std::string& input, | |
| 25 std::string* output) OVERRIDE; | |
| 26 }; | |
| 27 | |
| 28 scoped_ptr<PrivetV3CryptoProvider> Create( | |
| 29 const std::vector<std::string>& available_auth_methods) { | |
| 30 for (size_t i = 0; i < available_auth_methods.size(); i++) { | |
| 31 if (available_auth_methods[i] == kAuthMethodEmpty) { | |
| 32 return scoped_ptr<PrivetV3CryptoProvider>( | |
| 33 new PrivetV3CryptoProviderEmpty()); | |
| 34 } | |
| 35 } | |
| 36 | |
| 37 return scoped_ptr<PrivetV3CryptoProvider>(); | |
| 38 } | |
| 39 | |
| 40 PrivetV3CryptoProviderEmpty::PrivetV3CryptoProviderEmpty() { | |
| 41 } | |
| 42 | |
| 43 PrivetV3CryptoProviderEmpty::~PrivetV3CryptoProviderEmpty() { | |
| 44 } | |
| 45 | |
| 46 bool PrivetV3CryptoProviderEmpty::GetNextStep(int* step, std::string* package) { | |
| 47 *step = 0; | |
| 48 *package = std::string(); | |
|
Vitaly Buka (NO REVIEWS)
2014/06/04 18:34:46
package->clear()
Noam Samuel
2014/06/04 18:44:38
Done.
| |
| 49 return true; | |
| 50 } | |
| 51 | |
| 52 bool PrivetV3CryptoProviderEmpty::SetStepResponse(int step, | |
| 53 const std::string& package) { | |
| 54 return step == 0 && package == std::string(); | |
|
Vitaly Buka (NO REVIEWS)
2014/06/04 18:34:46
package.empty()
Noam Samuel
2014/06/04 18:44:38
Done.
| |
| 55 } | |
| 56 | |
| 57 bool PrivetV3CryptoProviderEmpty::EncryptData(const std::string& input, | |
| 58 std::string* output) { | |
| 59 *output = input; | |
| 60 return true; | |
| 61 } | |
| 62 | |
| 63 } // namespace local_discovery | |
| OLD | NEW |