Index: chrome/browser/extensions/api/enterprise_enterprise_key_private/enterprise_enterprise_key_private_api.h |
diff --git a/chrome/browser/extensions/api/enterprise_enterprise_key_private/enterprise_enterprise_key_private_api.h b/chrome/browser/extensions/api/enterprise_enterprise_key_private/enterprise_enterprise_key_private_api.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c45440b285ad289a385423c4f92ca09d9e42016b |
--- /dev/null |
+++ b/chrome/browser/extensions/api/enterprise_enterprise_key_private/enterprise_enterprise_key_private_api.h |
@@ -0,0 +1,116 @@ |
+// Copyright (c) 2013 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_ENTERPRISE_KEY_PRIVATE_ENTERPRISE_ENTERPRISE_KEY_PRIVATE_API_H__ |
+#define CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_ENTERPRISE_KEY_PRIVATE_ENTERPRISE_ENTERPRISE_KEY_PRIVATE_API_H__ |
+ |
+#include <string> |
Mattias Nissler (ping if slow)
2013/04/04 12:51:34
newline
davidyu
2013/04/09 09:30:08
Done.
|
+#include "base/callback.h" |
+#include "base/compiler_specific.h" |
+#include "base/memory/weak_ptr.h" |
+#include "chrome/browser/extensions/extension_function.h" |
+#include "chrome/common/extensions/api/enterprise_enterprise_key_private.h" |
+#include "chromeos/dbus/dbus_method_call_status.h" |
+#include "third_party/cros_system_api/dbus/service_constants.h" |
+ |
+class PrefRegistrySyncable; |
+class PrefService; |
+ |
+namespace chromeos { |
+class CryptohomeClient; |
+} // namespace chromeos |
+ |
+namespace cryptohome { |
+class AsyncMethodCaller; |
+} // namespace cryptohome |
+ |
+namespace policy { |
+class EnterpriseInstallAttributes; |
+} // namespace policy |
+ |
+namespace extensions { |
+ |
+class EEKPChallengeKeyBase : public AsyncExtensionFunction { |
+ protected: |
+ static const char* kKeyName; |
+ |
+ EEKPChallengeKeyBase(); |
+ ~EEKPChallengeKeyBase(); |
Mattias Nissler (ping if slow)
2013/04/04 12:51:34
should have a virtual dtor
davidyu
2013/04/09 09:30:08
Nice catch. Done.
|
+ bool IsRemoteAttestationEnabledForDevice() const; |
+ bool IsEnterpriseDevice() const; |
+ std::string GetEnterpriseDomain() const; |
+ std::string GetDeviceId() const; |
+ |
+ chromeos::CryptohomeClient* cryptohome_client_; |
+ cryptohome::AsyncMethodCaller* async_caller_; |
+ |
+ private: |
+ policy::EnterpriseInstallAttributes* install_attributes_; |
+}; |
+ |
+class EEKPChallengeMachineKey : public EEKPChallengeKeyBase { |
+ public: |
+ EEKPChallengeMachineKey(); |
+ |
+ protected: |
+ virtual ~EEKPChallengeMachineKey(); |
+ virtual bool RunImpl() OVERRIDE; |
+ |
+ private: |
+ void SignChallengeCallback(bool success, const std::string& response); |
+ |
+ base::WeakPtrFactory<EEKPChallengeMachineKey> weak_factory_; |
+ |
+ DECLARE_EXTENSION_FUNCTION( |
+ "enterprise.enterpriseKeyPrivate.challengeMachineKey", |
+ ENTERPRISE_ENTERPRISEKEYPRIVATE_CHALLENGEMACHINEKEY); |
+}; |
+ |
+typedef EEKPChallengeMachineKey |
+EnterpriseEnterpriseKeyPrivateChallengeMachineKeyFunction; |
Mattias Nissler (ping if slow)
2013/04/04 12:51:34
indentation
davidyu
2013/04/09 09:30:08
Done.
|
+ |
+class EEKPChallengeUserKey : public EEKPChallengeKeyBase { |
+ public: |
+ EEKPChallengeUserKey(); |
+ static void RegisterUserPrefs(PrefRegistrySyncable* registry); |
+ |
+ protected: |
+ virtual ~EEKPChallengeUserKey(); |
+ virtual bool RunImpl() OVERRIDE; |
+ |
+ private: |
+ void UserConsentCallback(const std::string& challenge, |
+ bool register_key, |
+ const std::string& domain, |
+ bool action); |
+ void SignChallengeCallback(bool register_key, |
+ bool success, |
+ const std::string& response); |
+ void GetPublicKeyCallback(const std::string& response, |
+ chromeos::DBusMethodCallStatus call_status, |
+ bool result, |
+ const std::string& public_key); |
+ void RegisterKeyCallback(const std::string& response, |
+ const std::string& public_key, |
+ bool success, |
+ cryptohome::MountError return_code); |
+ |
+ void AskForUserConsent(const base::Callback<void(bool)>& callback); |
+ bool IsExtensionWhitelisted() const; |
+ bool IsRemoteAttestationEnabledForUser() const; |
+ std::string GetUserDomain() const; |
+ |
+ base::WeakPtrFactory<EEKPChallengeUserKey> weak_factory_; |
+ |
+ DECLARE_EXTENSION_FUNCTION( |
+ "enterprise.enterpriseKeyPrivate.challengeUserKey", |
+ ENTERPRISE_ENTERPRISEKEYPRIVATE_CHALLENGEUSERKEY); |
+}; |
+ |
+typedef EEKPChallengeUserKey |
+EnterpriseEnterpriseKeyPrivateChallengeUserKeyFunction; |
Mattias Nissler (ping if slow)
2013/04/04 12:51:34
indentation
0
davidyu
2013/04/09 09:30:08
Done.
|
+ |
+} // namespace extensions |
+ |
+#endif // CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_ENTERPRISE_KEY_PRIVATE_ENTERPRISE_ENTERPRISE_KEY_PRIVATE_API_H__ |