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

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

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.h
diff --git a/chrome/browser/extensions/api/networking_cast/chrome_networking_cast_delegate.h b/chrome/browser/extensions/api/networking_cast/chrome_networking_cast_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..ae4acda2e73e6506da9722f1758514e6110e8779
--- /dev/null
+++ b/chrome/browser/extensions/api/networking_cast/chrome_networking_cast_delegate.h
@@ -0,0 +1,64 @@
+// 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 CHROME_BROWSER_EXTENSIONS_API_NETWORKING_CAST_CHROME_NETWORKING_CAST_DELEGATE_H_
+#define CHROME_BROWSER_EXTENSIONS_API_NETWORKING_CAST_CHROME_NETWORKING_CAST_DELEGATE_H_
+
+#include <memory>
+#include <string>
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "extensions/browser/api/networking_cast/networking_cast_delegate.h"
+#include "extensions/browser/api/networking_private/networking_private_delegate.h"
+
+namespace extensions {
+
+// Chrome implementation of extensions::NetworkingCastDelegate.
+class ChromeNetworkingCastDelegate : public NetworkingCastDelegate {
+ public:
+ using FactoryCallback =
+ base::Callback<std::unique_ptr<ChromeNetworkingCastDelegate>()>;
+ static void SetFactoryCallbackForTest(FactoryCallback* factory_callback);
+
+ static std::unique_ptr<ChromeNetworkingCastDelegate> Create();
+
+ ~ChromeNetworkingCastDelegate() override;
+
+ // NetworkingCastDelegate overrides:
+ void VerifyDestination(
+ const api::networking_cast::VerificationProperties& properties,
+ const VerifiedCallback& success_callback,
+ const FailureCallback& failure_callback) override;
+ void VerifyAndEncryptCredentials(
+ const std::string& guid,
+ const api::networking_cast::VerificationProperties& properties,
+ const DataCallback& success_callback,
+ const FailureCallback& failure_callback) override;
+ void VerifyAndEncryptData(
+ const std::string& data,
+ const api::networking_cast::VerificationProperties& properties,
+ const DataCallback& success_callback,
+ const FailureCallback& failure_callback) override;
+
+ private:
+ // Friend the test so it can inject stub VerifyDelegate implementation.
+ // TODO(tbarzic): Remove this when NetworkingCastDelegate stops depending on
+ // NetworkingPrivateDelegate:VerifyDelegate.
Devlin 2017/03/13 05:21:49 nit: NetworkingPrivateDelegate::VerifyDelegate (tw
tbarzic 2017/03/13 22:35:01 Done.
+ friend class NetworkingCastApiTest;
+
+ explicit ChromeNetworkingCastDelegate(
+ std::unique_ptr<NetworkingPrivateDelegate::VerifyDelegate>
+ verify_delegate);
+
+ // NetworkingPrivates API's crypto utility to which verification requests
+ // will be routed.
+ std::unique_ptr<NetworkingPrivateDelegate::VerifyDelegate> crypto_verify_;
+
+ DISALLOW_COPY_AND_ASSIGN(ChromeNetworkingCastDelegate);
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_API_NETWORKING_CAST_CHROME_NETWORKING_CAST_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698