OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_ENTERPRISE_PLATFORM_KEYS_ENTERPRISE_PLATFO
RM_KEYS_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_PLATFORM_KEYS_ENTERPRISE_PLATFO
RM_KEYS_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_PLATFORM_KEYS_ENTERPRISE_PLATFO
RM_KEYS_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_PLATFORM_KEYS_ENTERPRISE_PLATFO
RM_KEYS_API_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "chrome/browser/extensions/api/enterprise_platform_keys_private/enterpr
ise_platform_keys_private_api.h" | 13 #include "chrome/browser/extensions/api/enterprise_platform_keys_private/enterpr
ise_platform_keys_private_api.h" |
14 #include "extensions/browser/extension_function.h" | 14 #include "extensions/browser/extension_function.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 class X509Certificate; | 17 class X509Certificate; |
18 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; | 18 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; |
19 } | 19 } |
20 | 20 |
21 namespace extensions { | 21 namespace extensions { |
22 | 22 |
(...skipping 13 matching lines...) Expand all Loading... |
36 }; | 36 }; |
37 | 37 |
38 class EnterprisePlatformKeysGetCertificatesFunction | 38 class EnterprisePlatformKeysGetCertificatesFunction |
39 : public UIThreadExtensionFunction { | 39 : public UIThreadExtensionFunction { |
40 private: | 40 private: |
41 ~EnterprisePlatformKeysGetCertificatesFunction() override; | 41 ~EnterprisePlatformKeysGetCertificatesFunction() override; |
42 ResponseAction Run() override; | 42 ResponseAction Run() override; |
43 | 43 |
44 // Called when the list of certificates was determined. If an error occurred, | 44 // Called when the list of certificates was determined. If an error occurred, |
45 // |certs| will be NULL and instead |error_message| be set. | 45 // |certs| will be NULL and instead |error_message| be set. |
46 void OnGotCertificates(scoped_ptr<net::CertificateList> certs, | 46 void OnGotCertificates(std::unique_ptr<net::CertificateList> certs, |
47 const std::string& error_message); | 47 const std::string& error_message); |
48 | 48 |
49 DECLARE_EXTENSION_FUNCTION("enterprise.platformKeys.getCertificates", | 49 DECLARE_EXTENSION_FUNCTION("enterprise.platformKeys.getCertificates", |
50 ENTERPRISE_PLATFORMKEYS_GETCERTIFICATES); | 50 ENTERPRISE_PLATFORMKEYS_GETCERTIFICATES); |
51 }; | 51 }; |
52 | 52 |
53 class EnterprisePlatformKeysImportCertificateFunction | 53 class EnterprisePlatformKeysImportCertificateFunction |
54 : public UIThreadExtensionFunction { | 54 : public UIThreadExtensionFunction { |
55 private: | 55 private: |
56 ~EnterprisePlatformKeysImportCertificateFunction() override; | 56 ~EnterprisePlatformKeysImportCertificateFunction() override; |
(...skipping 22 matching lines...) Expand all Loading... |
79 }; | 79 }; |
80 | 80 |
81 class EnterprisePlatformKeysInternalGetTokensFunction | 81 class EnterprisePlatformKeysInternalGetTokensFunction |
82 : public UIThreadExtensionFunction { | 82 : public UIThreadExtensionFunction { |
83 private: | 83 private: |
84 ~EnterprisePlatformKeysInternalGetTokensFunction() override; | 84 ~EnterprisePlatformKeysInternalGetTokensFunction() override; |
85 ResponseAction Run() override; | 85 ResponseAction Run() override; |
86 | 86 |
87 // Called when the list of tokens was determined. If an error occurred, | 87 // Called when the list of tokens was determined. If an error occurred, |
88 // |token_ids| will be NULL and instead |error_message| be set. | 88 // |token_ids| will be NULL and instead |error_message| be set. |
89 void OnGotTokens(scoped_ptr<std::vector<std::string> > token_ids, | 89 void OnGotTokens(std::unique_ptr<std::vector<std::string>> token_ids, |
90 const std::string& error_message); | 90 const std::string& error_message); |
91 | 91 |
92 DECLARE_EXTENSION_FUNCTION("enterprise.platformKeysInternal.getTokens", | 92 DECLARE_EXTENSION_FUNCTION("enterprise.platformKeysInternal.getTokens", |
93 ENTERPRISE_PLATFORMKEYSINTERNAL_GETTOKENS); | 93 ENTERPRISE_PLATFORMKEYSINTERNAL_GETTOKENS); |
94 }; | 94 }; |
95 | 95 |
96 class EnterprisePlatformKeysChallengeMachineKeyFunction | 96 class EnterprisePlatformKeysChallengeMachineKeyFunction |
97 : public UIThreadExtensionFunction { | 97 : public UIThreadExtensionFunction { |
98 public: | 98 public: |
99 EnterprisePlatformKeysChallengeMachineKeyFunction(); | 99 EnterprisePlatformKeysChallengeMachineKeyFunction(); |
100 explicit EnterprisePlatformKeysChallengeMachineKeyFunction( | 100 explicit EnterprisePlatformKeysChallengeMachineKeyFunction( |
101 EPKPChallengeMachineKey* impl_for_testing); | 101 EPKPChallengeMachineKey* impl_for_testing); |
102 | 102 |
103 private: | 103 private: |
104 ~EnterprisePlatformKeysChallengeMachineKeyFunction() override; | 104 ~EnterprisePlatformKeysChallengeMachineKeyFunction() override; |
105 ResponseAction Run() override; | 105 ResponseAction Run() override; |
106 | 106 |
107 // Called when the challenge operation is complete. If the operation succeeded | 107 // Called when the challenge operation is complete. If the operation succeeded |
108 // |success| will be true and |data| will contain the challenge response data. | 108 // |success| will be true and |data| will contain the challenge response data. |
109 // Otherwise |success| will be false and |data| is an error message. | 109 // Otherwise |success| will be false and |data| is an error message. |
110 void OnChallengedKey(bool success, const std::string& data); | 110 void OnChallengedKey(bool success, const std::string& data); |
111 | 111 |
112 scoped_ptr<EPKPChallengeMachineKey> default_impl_; | 112 std::unique_ptr<EPKPChallengeMachineKey> default_impl_; |
113 EPKPChallengeMachineKey* impl_; | 113 EPKPChallengeMachineKey* impl_; |
114 | 114 |
115 DECLARE_EXTENSION_FUNCTION("enterprise.platformKeys.challengeMachineKey", | 115 DECLARE_EXTENSION_FUNCTION("enterprise.platformKeys.challengeMachineKey", |
116 ENTERPRISE_PLATFORMKEYS_CHALLENGEMACHINEKEY); | 116 ENTERPRISE_PLATFORMKEYS_CHALLENGEMACHINEKEY); |
117 }; | 117 }; |
118 | 118 |
119 class EnterprisePlatformKeysChallengeUserKeyFunction | 119 class EnterprisePlatformKeysChallengeUserKeyFunction |
120 : public UIThreadExtensionFunction { | 120 : public UIThreadExtensionFunction { |
121 public: | 121 public: |
122 EnterprisePlatformKeysChallengeUserKeyFunction(); | 122 EnterprisePlatformKeysChallengeUserKeyFunction(); |
123 explicit EnterprisePlatformKeysChallengeUserKeyFunction( | 123 explicit EnterprisePlatformKeysChallengeUserKeyFunction( |
124 EPKPChallengeUserKey* impl_for_testing); | 124 EPKPChallengeUserKey* impl_for_testing); |
125 | 125 |
126 private: | 126 private: |
127 ~EnterprisePlatformKeysChallengeUserKeyFunction() override; | 127 ~EnterprisePlatformKeysChallengeUserKeyFunction() override; |
128 ResponseAction Run() override; | 128 ResponseAction Run() override; |
129 | 129 |
130 // Called when the challenge operation is complete. If the operation succeeded | 130 // Called when the challenge operation is complete. If the operation succeeded |
131 // |success| will be true and |data| will contain the challenge response data. | 131 // |success| will be true and |data| will contain the challenge response data. |
132 // Otherwise |success| will be false and |data| is an error message. | 132 // Otherwise |success| will be false and |data| is an error message. |
133 void OnChallengedKey(bool success, const std::string& data); | 133 void OnChallengedKey(bool success, const std::string& data); |
134 | 134 |
135 scoped_ptr<EPKPChallengeUserKey> default_impl_; | 135 std::unique_ptr<EPKPChallengeUserKey> default_impl_; |
136 EPKPChallengeUserKey* impl_; | 136 EPKPChallengeUserKey* impl_; |
137 | 137 |
138 DECLARE_EXTENSION_FUNCTION("enterprise.platformKeys.challengeUserKey", | 138 DECLARE_EXTENSION_FUNCTION("enterprise.platformKeys.challengeUserKey", |
139 ENTERPRISE_PLATFORMKEYS_CHALLENGEUSERKEY); | 139 ENTERPRISE_PLATFORMKEYS_CHALLENGEUSERKEY); |
140 }; | 140 }; |
141 | 141 |
142 } // namespace extensions | 142 } // namespace extensions |
143 | 143 |
144 #endif // CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_PLATFORM_KEYS_ENTERPRISE_PLA
TFORM_KEYS_API_H_ | 144 #endif // CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_PLATFORM_KEYS_ENTERPRISE_PLA
TFORM_KEYS_API_H_ |
OLD | NEW |