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

Unified Diff: chrome/browser/extensions/api/enterprise_enterprise_key_private/enterprise_enterprise_key_private_api.h

Issue 13132004: Implement Enterprise Key API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing reviewer comments. Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
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..4b2af0bbd7d8fc835dc85f4dbb254f82bd8439e2
--- /dev/null
+++ b/chrome/browser/extensions/api/enterprise_enterprise_key_private/enterprise_enterprise_key_private_api.h
@@ -0,0 +1,112 @@
+// 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;
Mattias Nissler (ping if slow) 2013/04/10 16:53:26 This should be an array.
davidyu 2013/04/11 07:04:21 Done.
+
+ EEKPChallengeKeyBase();
+ void GetDeviceAttestationEnabled(const base::Callback<void(bool)>& callback)
Matt Perry 2013/04/10 21:14:01 comment these methods
davidyu 2013/04/11 07:04:21 Done.
+ const;
Mattias Nissler (ping if slow) 2013/04/10 16:53:26 We usually break the line before the parameter in
davidyu 2013/04/11 07:04:21 Done.
+ 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 {
+ 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",
Matt Perry 2013/04/10 21:14:01 this is a mouthful. Have you considered naming the
+ 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__

Powered by Google App Engine
This is Rietveld 408576698