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

Side by Side Diff: chrome/browser/extensions/api/platform_keys/platform_keys_api.h

Issue 875373002: First implementation of chrome.platformKeys. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cert_idl
Patch Set: Fix .gn file. Created 5 years, 10 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PLATFORM_KEYS_PLATFORM_KEYS_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PLATFORM_KEYS_PLATFORM_KEYS_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_PLATFORM_KEYS_PLATFORM_KEYS_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_PLATFORM_KEYS_PLATFORM_KEYS_API_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector>
9 10
10 #include "chrome/browser/extensions/chrome_extension_function.h" 11 #include "chrome/browser/extensions/chrome_extension_function.h"
11 12
13 namespace net {
14 class X509Certificate;
15 typedef std::vector<scoped_refptr<X509Certificate>> CertificateList;
16 }
17
12 namespace extensions { 18 namespace extensions {
13 namespace platform_keys { 19 namespace platform_keys {
14 20
15 extern const char kErrorInvalidToken[]; 21 extern const char kErrorInvalidToken[];
16 22
17 // Returns whether |token_id| references a known Token. 23 // Returns whether |token_id| references a known Token.
18 bool ValidateToken(const std::string& token_id, 24 bool ValidateToken(const std::string& token_id,
19 std::string* platform_keys_token_id); 25 std::string* platform_keys_token_id);
20 26
21 // Converts a token id from ::chromeos::platform_keys to the platformKeys API 27 // Converts a token id from ::chromeos::platform_keys to the platformKeys API
22 // token id. 28 // token id.
23 std::string PlatformKeysTokenIdToApiId( 29 std::string PlatformKeysTokenIdToApiId(
24 const std::string& platform_keys_token_id); 30 const std::string& platform_keys_token_id);
25 31
26 } // namespace platform_keys 32 } // namespace platform_keys
27 33
34 class PlatformKeysInternalSelectClientCertificatesFunction
35 : public ChromeUIThreadExtensionFunction {
36 private:
37 ~PlatformKeysInternalSelectClientCertificatesFunction() override;
38 ResponseAction Run() override;
39
40 // Called when the certificates were selected. If an error occurred, |certs|
41 // will be null and instead |error_message| be set.
42 void OnSelectedCertificates(scoped_ptr<net::CertificateList> matches,
43 const std::string& error_message);
44
45 DECLARE_EXTENSION_FUNCTION("platformKeysInternal.selectClientCertificates",
46 PLATFORMKEYSINTERNAL_SELECTCLIENTCERTIFICATES);
47 };
48
28 class PlatformKeysInternalSignFunction 49 class PlatformKeysInternalSignFunction
29 : public ChromeUIThreadExtensionFunction { 50 : public ChromeUIThreadExtensionFunction {
30 private: 51 private:
31 ~PlatformKeysInternalSignFunction() override; 52 ~PlatformKeysInternalSignFunction() override;
32 ResponseAction Run() override; 53 ResponseAction Run() override;
33 54
34 // Called when the signature was generated. If an error occurred, 55 // Called when the signature was generated. If an error occurred,
35 // |signature| will be empty and instead |error_message| be set. 56 // |signature| will be empty and instead |error_message| be set.
36 void OnSigned(const std::string& signature, const std::string& error_message); 57 void OnSigned(const std::string& signature, const std::string& error_message);
37 58
38 DECLARE_EXTENSION_FUNCTION("platformKeysInternal.sign", 59 DECLARE_EXTENSION_FUNCTION("platformKeysInternal.sign",
39 PLATFORMKEYSINTERNAL_SIGN); 60 PLATFORMKEYSINTERNAL_SIGN);
40 }; 61 };
41 62
42 } // namespace extensions 63 } // namespace extensions
43 64
44 #endif // CHROME_BROWSER_EXTENSIONS_API_PLATFORM_KEYS_PLATFORM_KEYS_API_H_ 65 #endif // CHROME_BROWSER_EXTENSIONS_API_PLATFORM_KEYS_PLATFORM_KEYS_API_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/platform_keys/OWNERS ('k') | chrome/browser/extensions/api/platform_keys/platform_keys_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698