Chromium Code Reviews| Index: chrome/browser/local_discovery/privetv3_crypto_provider.cc |
| diff --git a/chrome/browser/local_discovery/privetv3_crypto_provider.cc b/chrome/browser/local_discovery/privetv3_crypto_provider.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..afcd1fea798834e8e9e3a0b417a7dcc2193bd3ff |
| --- /dev/null |
| +++ b/chrome/browser/local_discovery/privetv3_crypto_provider.cc |
| @@ -0,0 +1,63 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/local_discovery/privetv3_crypto_provider.h" |
| + |
| +namespace local_discovery { |
| + |
| +namespace { |
| + |
| +// A stub session type used for development/debugging. |
| +const char kAuthMethodEmpty[] = "empty"; |
| +} |
| + |
| +class PrivetV3CryptoProviderEmpty : public PrivetV3CryptoProvider { |
| + public: |
| + PrivetV3CryptoProviderEmpty(); |
| + virtual ~PrivetV3CryptoProviderEmpty(); |
| + |
| + // PrivetV3CryptoProvider implementation. |
| + virtual const std::string& GetAuthMethod() OVERRIDE; |
| + virtual bool GetNextStep(int* step, std::string* package) OVERRIDE; |
| + virtual bool SetStepResponse(int step, const std::string& package) OVERRIDE; |
| + virtual bool EncryptData(const std::string& input, |
| + std::string* output) OVERRIDE; |
| +}; |
| + |
| +scoped_ptr<PrivetV3CryptoProvider> Create( |
| + const std::vector<std::string>& available_auth_methods) { |
| + for (size_t i = 0; i < available_auth_methods.size(); i++) { |
| + if (available_auth_methods[i] == kAuthMethodEmpty) { |
| + return scoped_ptr<PrivetV3CryptoProvider>( |
| + new PrivetV3CryptoProviderEmpty()); |
| + } |
| + } |
| + |
| + return scoped_ptr<PrivetV3CryptoProvider>(); |
| +} |
| + |
| +PrivetV3CryptoProviderEmpty::PrivetV3CryptoProviderEmpty() { |
| +} |
| + |
| +PrivetV3CryptoProviderEmpty::~PrivetV3CryptoProviderEmpty() { |
| +} |
| + |
| +bool PrivetV3CryptoProviderEmpty::GetNextStep(int* step, std::string* package) { |
| + *step = 0; |
| + *package = std::string(); |
|
Vitaly Buka (NO REVIEWS)
2014/06/04 18:34:46
package->clear()
Noam Samuel
2014/06/04 18:44:38
Done.
|
| + return true; |
| +} |
| + |
| +bool PrivetV3CryptoProviderEmpty::SetStepResponse(int step, |
| + const std::string& package) { |
| + 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.
|
| +} |
| + |
| +bool PrivetV3CryptoProviderEmpty::EncryptData(const std::string& input, |
| + std::string* output) { |
| + *output = input; |
| + return true; |
| +} |
| + |
| +} // namespace local_discovery |