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

Side by Side Diff: extensions/browser/api/networking_cast/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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef EXTENSIONS_BROWSER_API_NETWORKING_CAST_NETWORKING_CAST_DELEGATE_H_
6 #define EXTENSIONS_BROWSER_API_NETWORKING_CAST_NETWORKING_CAST_DELEGATE_H_
7
8 #include <string>
9
10 #include "base/callback.h"
11 #include "extensions/common/api/networking_cast.h"
12
13 namespace extensions {
14
15 // Delegate interface that provides crypto methods needed to verify cast
16 // certificates and encrypt data using public key derived from the verified
17 // certificate.
18 class NetworkingCastDelegate {
19 public:
20 virtual ~NetworkingCastDelegate() {}
21
22 using FailureCallback = base::Callback<void(const std::string& error)>;
23 using VerifiedCallback = base::Callback<void(bool is_valid)>;
24 using DataCallback = base::Callback<void(const std::string& encrypted_data)>;
25
26 // Verifies that data provided in |properties| authenticates a cast device.
27 virtual void VerifyDestination(
28 const api::networking_cast::VerificationProperties& properties,
29 const VerifiedCallback& success_callback,
30 const FailureCallback& failure_callback) = 0;
31
32 // Verifies that data provided in |properties| authenticates a cast device.
33 // If the device is verified as a cast device, it fetches credentials of the
34 // network identified with |network_guid| and returns the network credentials
35 // encrypted with a public key derived from |properties|.
36 virtual void VerifyAndEncryptCredentials(
37 const std::string& network_guid,
38 const api::networking_cast::VerificationProperties& properties,
39 const DataCallback& encrypted_credetials_callback,
40 const FailureCallback& failure_callback) = 0;
41
42 // Verifies that data provided in |properties| authenticates a cast device.
43 // If the device is verified as a cast device, it returns |data| encrypted
44 // with a public key derived from |properties|.
45 virtual void VerifyAndEncryptData(
46 const std::string& data,
47 const api::networking_cast::VerificationProperties& properties,
48 const DataCallback& enrypted_data_callback,
49 const FailureCallback& failure_callback) = 0;
50 };
51
52 } // namespace extensions
53
54 #endif // EXTENSIONS_BROWSER_API_NETWORKING_CAST_NETWORKING_CAST_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698