Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / extensions / api / networking_private / crypto_verify_impl.h
blob799be28a275fdec7059f3d99ccbfa5caeaa1e6e8
1 // Copyright 2014 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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_CRYPTO_VERIFY_IMPL_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_CRYPTO_VERIFY_IMPL_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "extensions/browser/api/networking_private/networking_private_delegate.h"
12 namespace base {
13 class SequencedTaskRunner;
16 namespace extensions {
18 // Implementation of NetworkingPrivateDelegate::VerifyDelegate using
19 // networking_private_crypto.
20 class CryptoVerifyImpl : public NetworkingPrivateDelegate::VerifyDelegate {
21 public:
22 CryptoVerifyImpl();
23 ~CryptoVerifyImpl() override;
25 struct Credentials {
26 // VerificationProperties are not copyable so define a struct that can be
27 // passed to tasks on the worker thread.
28 explicit Credentials(const VerificationProperties& properties);
29 ~Credentials();
31 std::string certificate;
32 std::vector<std::string> intermediate_certificates;
33 std::string signed_data;
34 std::string unsigned_data;
35 std::string device_bssid;
36 std::string public_key;
39 // NetworkingPrivateDelegate::VerifyDelegate
40 void VerifyDestination(const VerificationProperties& verification_properties,
41 const BoolCallback& success_callback,
42 const FailureCallback& failure_callback) override;
43 void VerifyAndEncryptCredentials(
44 const std::string& guid,
45 const VerificationProperties& verification_properties,
46 const StringCallback& success_callback,
47 const FailureCallback& failure_callback) override;
48 void VerifyAndEncryptData(
49 const VerificationProperties& verification_properties,
50 const std::string& data,
51 const StringCallback& success_callback,
52 const FailureCallback& failure_callback) override;
54 private:
55 // Task runner for blocking tasks.
56 scoped_refptr<base::SequencedTaskRunner> blocking_pool_task_runner_;
58 DISALLOW_COPY_AND_ASSIGN(CryptoVerifyImpl);
61 } // namespace extensions
63 #endif // CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_CRYPTO_VERIFY_IMPL_H_