Index: chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.h |
diff --git a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.h b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..68849463258f91422f2a4ca7c36bc53349daa587 |
--- /dev/null |
+++ b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.h |
@@ -0,0 +1,127 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_PLATFORM_KEYS_ENTERPRISE_PLATFORM_KEYS_API_H_ |
+#define CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_PLATFORM_KEYS_ENTERPRISE_PLATFORM_KEYS_API_H_ |
+ |
+#include "base/compiler_specific.h" |
+#include "chrome/browser/extensions/chrome_extension_function.h" |
+ |
+namespace extensions { |
+ |
+namespace enterprise_platform_keys { |
+ |
+class TokenMethodExtensionFunction : public ChromeUIThreadExtensionFunction { |
+ public: |
+ void RespondWithoutResult(); |
+ void RespondWithResults(scoped_ptr<base::ListValue> results); |
+ void RespondWithError(const std::string& error_message); |
+ |
+ protected: |
+ TokenMethodExtensionFunction(); |
+ virtual ~TokenMethodExtensionFunction(); |
+ |
+ bool ValidateToken(const std::string& token_id); |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(TokenMethodExtensionFunction); |
+}; |
+ |
+// Because the function names expected by the generated code are extremely long |
+// and unreadable, the API functions are defined in a namespace and the expected |
+// types are typedef'ed at the end of this file. |
+class Generate : public TokenMethodExtensionFunction { |
+ public: |
+ Generate(); |
+ |
+ protected: |
+ virtual ~Generate(); |
+ virtual ResponseAction Run() OVERRIDE; |
+ |
+ private: |
+ DECLARE_EXTENSION_FUNCTION("enterprise.platformKeysInternal.generateKey", |
+ ENTERPRISE_PLATFORMKEYSINTERNAL_GENERATEKEY); |
+}; |
+ |
+class Sign : public TokenMethodExtensionFunction { |
+ public: |
+ Sign(); |
+ |
+ protected: |
+ virtual ~Sign(); |
+ virtual ResponseAction Run() OVERRIDE; |
+ |
+ private: |
+ DECLARE_EXTENSION_FUNCTION("enterprise.platformKeysInternal.sign", |
+ ENTERPRISE_PLATFORMKEYSINTERNAL_SIGN); |
+}; |
+ |
+class GetCerts : public TokenMethodExtensionFunction { |
+ public: |
+ GetCerts(); |
+ |
+ protected: |
+ virtual ~GetCerts(); |
+ virtual ResponseAction Run() OVERRIDE; |
+ |
+ private: |
+ DECLARE_EXTENSION_FUNCTION("enterprise.platformKeys.getCertificates", |
+ ENTERPRISE_PLATFORMKEYS_GETCERTIFICATES); |
+}; |
+ |
+class ImportCert : public TokenMethodExtensionFunction { |
+ public: |
+ ImportCert(); |
+ |
+ protected: |
+ virtual ~ImportCert(); |
+ virtual ResponseAction Run() OVERRIDE; |
+ |
+ private: |
+ DECLARE_EXTENSION_FUNCTION("enterprise.platformKeys.importCertificate", |
+ ENTERPRISE_PLATFORMKEYS_IMPORTCERTIFICATE); |
+}; |
+ |
+class RemoveCert : public TokenMethodExtensionFunction { |
+ public: |
+ RemoveCert(); |
+ |
+ protected: |
+ virtual ~RemoveCert(); |
+ virtual ResponseAction Run() OVERRIDE; |
+ |
+ private: |
+ DECLARE_EXTENSION_FUNCTION("enterprise.platformKeys.removeCertificate", |
+ ENTERPRISE_PLATFORMKEYS_REMOVECERTIFICATE); |
+}; |
+ |
+class GetTokens : public ChromeUIThreadExtensionFunction { |
+ protected: |
+ virtual ~GetTokens(); |
+ virtual ResponseAction Run() OVERRIDE; |
+ |
+ private: |
+ DECLARE_EXTENSION_FUNCTION("enterprise.platformKeysInternal.getTokens", |
+ ENTERPRISE_PLATFORMKEYSINTERNAL_GETTOKENS); |
+}; |
+ |
+} // namespace enterprise_platform_keys |
+ |
+typedef enterprise_platform_keys::Generate |
+ EnterprisePlatformKeysInternalGenerateKeyFunction; |
+typedef enterprise_platform_keys::Sign |
+ EnterprisePlatformKeysInternalSignFunction; |
+typedef enterprise_platform_keys::GetTokens |
+ EnterprisePlatformKeysInternalGetTokensFunction; |
+ |
+typedef enterprise_platform_keys::GetCerts |
+ EnterprisePlatformKeysGetCertificatesFunction; |
+typedef enterprise_platform_keys::ImportCert |
+ EnterprisePlatformKeysImportCertificateFunction; |
+typedef enterprise_platform_keys::RemoveCert |
+ EnterprisePlatformKeysRemoveCertificateFunction; |
+ |
+} // namespace extensions |
+ |
+#endif // CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_PLATFORM_KEYS_ENTERPRISE_PLATFORM_KEYS_API_H_ |