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

Unified Diff: chrome/browser/local_discovery/privetv3_crypto_provider.cc

Issue 316873004: Interface plus stub implementation for PrivetV3CryptoProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/local_discovery/privetv3_crypto_provider.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chrome/browser/local_discovery/privetv3_crypto_provider.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698