| 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..99ee7c0a5c6e6bf08a6827af73a01a135997402b
|
| --- /dev/null
|
| +++ b/chrome/browser/extensions/api/enterprise_enterprise_key_private/enterprise_enterprise_key_private_api.h
|
| @@ -0,0 +1,121 @@
|
| +// 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>
|
| +
|
| +#include "base/callback.h"
|
| +#include "base/compiler_specific.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();
|
| +
|
| + // Returns a trusted value from CroSettings indicating if the device
|
| + // attestation is enabled.
|
| + void GetDeviceAttestationEnabled(
|
| + const base::Callback<void(bool)>& callback) const;
|
| +
|
| + // Returns true if the device is enterprise managed.
|
| + bool IsEnterpriseDevice() const;
|
| +
|
| + // Returns the enrolled enterprise domain.
|
| + std::string GetEnterpriseDomain() const;
|
| +
|
| + // Returns the enterprise virtual device ID.
|
| + std::string GetDeviceId() const;
|
| +
|
| + chromeos::CryptohomeClient* cryptohome_client_;
|
| + cryptohome::AsyncMethodCaller* async_caller_;
|
| +
|
| + private:
|
| + policy::EnterpriseInstallAttributes* install_attributes_;
|
| +};
|
| +
|
| +class EEKPChallengeMachineKey : public EEKPChallengeKeyBase {
|
| + protected:
|
| + virtual bool RunImpl() OVERRIDE;
|
| +
|
| + private:
|
| + void GetDeviceAttestationEnabledCallback(const std::string& challenge,
|
| + bool enabled);
|
| + void SignChallengeCallback(bool success, const std::string& response);
|
| +
|
| + DECLARE_EXTENSION_FUNCTION(
|
| + "enterprise.enterpriseKeyPrivate.challengeMachineKey",
|
| + ENTERPRISE_ENTERPRISEKEYPRIVATE_CHALLENGEMACHINEKEY);
|
| +};
|
| +
|
| +typedef EEKPChallengeMachineKey
|
| + EnterpriseEnterpriseKeyPrivateChallengeMachineKeyFunction;
|
| +
|
| +class EEKPChallengeUserKey : public EEKPChallengeKeyBase {
|
| + public:
|
| + static void RegisterUserPrefs(PrefRegistrySyncable* registry);
|
| +
|
| + protected:
|
| + virtual bool RunImpl() OVERRIDE;
|
| +
|
| + private:
|
| + void GetDeviceAttestationEnabledCallback(const std::string& challenge,
|
| + bool register_key,
|
| + const std::string& domain,
|
| + bool enabled);
|
| + 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;
|
| +
|
| + DECLARE_EXTENSION_FUNCTION(
|
| + "enterprise.enterpriseKeyPrivate.challengeUserKey",
|
| + ENTERPRISE_ENTERPRISEKEYPRIVATE_CHALLENGEUSERKEY);
|
| +};
|
| +
|
| +typedef EEKPChallengeUserKey
|
| + EnterpriseEnterpriseKeyPrivateChallengeUserKeyFunction;
|
| +
|
| +} // namespace extensions
|
| +
|
| +#endif // CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_ENTERPRISE_KEY_PRIVATE_ENTERPRISE_ENTERPRISE_KEY_PRIVATE_API_H__
|
|
|