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

Unified Diff: chrome/browser/extensions/api/networking_cast/chrome_networking_cast_delegate.cc

Issue 2726223004: Introduce networking.cast API (Closed)
Patch Set: . 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: chrome/browser/extensions/api/networking_cast/chrome_networking_cast_delegate.cc
diff --git a/chrome/browser/extensions/api/networking_cast/chrome_networking_cast_delegate.cc b/chrome/browser/extensions/api/networking_cast/chrome_networking_cast_delegate.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e9b050712e4c1e3b64134b0fad5b4ac2f16b5e01
--- /dev/null
+++ b/chrome/browser/extensions/api/networking_cast/chrome_networking_cast_delegate.cc
@@ -0,0 +1,65 @@
+// 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.
+
+#include "chrome/browser/extensions/api/networking_cast/chrome_networking_cast_delegate.h"
+
+#include "base/callback.h"
+#include "chrome/browser/extensions/api/networking_private/networking_private_verify_delegate_factory_impl.h"
+#include "extensions/common/api/networking_private.h"
+
+namespace extensions {
+
+namespace {
+
+ChromeNetworkingCastDelegate::FactoryCallback* g_factory_callback = nullptr;
+
+} // namespace
+
+std::unique_ptr<ChromeNetworkingCastDelegate>
+ChromeNetworkingCastDelegate::Create() {
+ if (g_factory_callback)
+ return g_factory_callback->Run();
+ return std::unique_ptr<ChromeNetworkingCastDelegate>(
+ new ChromeNetworkingCastDelegate(
+ NetworkingPrivateVerifyDelegateFactoryImpl().CreateDelegate()));
+}
+
+void ChromeNetworkingCastDelegate::SetFactoryCallbackForTest(
+ FactoryCallback* factory_callback) {
+ g_factory_callback = factory_callback;
+}
+
+ChromeNetworkingCastDelegate::ChromeNetworkingCastDelegate(
+ std::unique_ptr<NetworkingPrivateDelegate::VerifyDelegate> crypto_verify)
+ : crypto_verify_(std::move(crypto_verify)) {}
+
+ChromeNetworkingCastDelegate::~ChromeNetworkingCastDelegate() {}
+
+void ChromeNetworkingCastDelegate::VerifyDestination(
+ const api::networking_private::VerificationProperties& properties,
+ const VerifiedCallback& success_callback,
+ const FailureCallback& failure_callback) {
+ crypto_verify_->VerifyDestination(properties, success_callback,
+ failure_callback);
+}
+
+void ChromeNetworkingCastDelegate::VerifyAndEncryptCredentials(
+ const std::string& guid,
+ const api::networking_private::VerificationProperties& properties,
+ const DataCallback& success_callback,
+ const FailureCallback& failure_callback) {
+ crypto_verify_->VerifyAndEncryptCredentials(
+ guid, properties, success_callback, failure_callback);
+}
+
+void ChromeNetworkingCastDelegate::VerifyAndEncryptData(
+ const std::string& data,
+ const api::networking_private::VerificationProperties& properties,
+ const DataCallback& success_callback,
+ const FailureCallback& failure_callback) {
+ crypto_verify_->VerifyAndEncryptData(properties, data, success_callback,
+ failure_callback);
+}
+
+} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698