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

Unified Diff: extensions/browser/api/networking_private/networking_cast_private_delegate.h

Issue 2726223004: Introduce networking.cast API (Closed)
Patch Set: histograms Created 3 years, 9 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
Index: extensions/browser/api/networking_private/networking_cast_private_delegate.h
diff --git a/extensions/browser/api/networking_private/networking_cast_private_delegate.h b/extensions/browser/api/networking_private/networking_cast_private_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..a7704ac4e42da81291ceaa204172df5254145a5c
--- /dev/null
+++ b/extensions/browser/api/networking_private/networking_cast_private_delegate.h
@@ -0,0 +1,59 @@
+// Copyright 2017 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.
+
+#ifndef EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_CAST_PRIVATE_DELEGATE_H_
+#define EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_CAST_PRIVATE_DELEGATE_H_
+
+#include <string>
+
+#include "base/callback.h"
+#include "extensions/common/api/networking_private.h"
+
+namespace extensions {
+
+// Delegate interface that provides crypto methods needed to verify cast
+// certificates and encrypt data using public key derived from the verified
+// certificate.
+// TODO(tbarzic): This is to be used during migration of
+// networkingPrivate.verify* methods to networking.castPrivate API to share
+// verification logic shared between networkingPrivate and
+// networking.castPrivate API. When the deprecated networkingPrivate methods
+// are removed, this interface should be removed, too.
+class NetworkingCastPrivateDelegate {
+ public:
+ virtual ~NetworkingCastPrivateDelegate() {}
+
+ using FailureCallback = base::Callback<void(const std::string& error)>;
+ using VerifiedCallback = base::Callback<void(bool is_valid)>;
+ using DataCallback = base::Callback<void(const std::string& encrypted_data)>;
+
+ // Verifies that data provided in |properties| authenticates a cast device.
+ virtual void VerifyDestination(
+ const api::networking_private::VerificationProperties& properties,
+ const VerifiedCallback& success_callback,
+ const FailureCallback& failure_callback) = 0;
+
+ // Verifies that data provided in |properties| authenticates a cast device.
+ // If the device is verified as a cast device, it fetches credentials of the
+ // network identified with |network_guid| and returns the network credentials
+ // encrypted with a public key derived from |properties|.
+ virtual void VerifyAndEncryptCredentials(
+ const std::string& network_guid,
+ const api::networking_private::VerificationProperties& properties,
+ const DataCallback& encrypted_credetials_callback,
+ const FailureCallback& failure_callback) = 0;
+
+ // Verifies that data provided in |properties| authenticates a cast device.
+ // If the device is verified as a cast device, it returns |data| encrypted
+ // with a public key derived from |properties|.
+ virtual void VerifyAndEncryptData(
+ const std::string& data,
+ const api::networking_private::VerificationProperties& properties,
+ const DataCallback& enrypted_data_callback,
+ const FailureCallback& failure_callback) = 0;
+};
+
+} // namespace extensions
+
+#endif // EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_CAST_PRIVATE_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698