Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / extensions / api / platform_keys / platform_keys_api.h
blob7f6a99cab66d08d68f34c78687583771585872ba
1 // Copyright 2015 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_PLATFORM_KEYS_PLATFORM_KEYS_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_PLATFORM_KEYS_PLATFORM_KEYS_API_H_
8 #include <string>
9 #include <vector>
11 #include "chrome/browser/extensions/chrome_extension_function.h"
13 namespace net {
14 class X509Certificate;
15 typedef std::vector<scoped_refptr<X509Certificate>> CertificateList;
16 } // net
18 namespace extensions {
19 namespace platform_keys {
21 extern const char kErrorInvalidToken[];
22 extern const char kErrorInvalidX509Cert[];
24 // Returns whether |token_id| references a known Token.
25 bool ValidateToken(const std::string& token_id,
26 std::string* platform_keys_token_id);
28 // Converts a token id from ::chromeos::platform_keys to the platformKeys API
29 // token id.
30 std::string PlatformKeysTokenIdToApiId(
31 const std::string& platform_keys_token_id);
33 } // namespace platform_keys
35 class PlatformKeysInternalSelectClientCertificatesFunction
36 : public ChromeUIThreadExtensionFunction {
37 private:
38 ~PlatformKeysInternalSelectClientCertificatesFunction() override;
39 ResponseAction Run() override;
41 // Called when the certificates were selected. If an error occurred, |certs|
42 // will be null and instead |error_message| be set.
43 void OnSelectedCertificates(scoped_ptr<net::CertificateList> matches,
44 const std::string& error_message);
46 DECLARE_EXTENSION_FUNCTION("platformKeysInternal.selectClientCertificates",
47 PLATFORMKEYSINTERNAL_SELECTCLIENTCERTIFICATES);
50 class PlatformKeysInternalGetPublicKeyFunction
51 : public ChromeUIThreadExtensionFunction {
52 private:
53 ~PlatformKeysInternalGetPublicKeyFunction() override;
54 ResponseAction Run() override;
56 DECLARE_EXTENSION_FUNCTION("platformKeysInternal.getPublicKey",
57 PLATFORMKEYSINTERNAL_GETPUBLICKEY);
60 class PlatformKeysInternalSignFunction
61 : public ChromeUIThreadExtensionFunction {
62 private:
63 ~PlatformKeysInternalSignFunction() override;
64 ResponseAction Run() override;
66 // Called when the signature was generated. If an error occurred,
67 // |signature| will be empty and instead |error_message| be set.
68 void OnSigned(const std::string& signature, const std::string& error_message);
70 DECLARE_EXTENSION_FUNCTION("platformKeysInternal.sign",
71 PLATFORMKEYSINTERNAL_SIGN);
74 class PlatformKeysVerifyTLSServerCertificateFunction
75 : public UIThreadExtensionFunction {
76 private:
77 ~PlatformKeysVerifyTLSServerCertificateFunction() override;
78 ResponseAction Run() override;
80 void FinishedVerification(const std::string& error,
81 int verify_result,
82 int cert_status);
84 DECLARE_EXTENSION_FUNCTION("platformKeys.verifyTLSServerCertificate",
85 PLATFORMKEYS_VERIFYTLSSERVERCERTIFICATE);
88 } // namespace extensions
90 #endif // CHROME_BROWSER_EXTENSIONS_API_PLATFORM_KEYS_PLATFORM_KEYS_API_H_