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

Unified Diff: chrome/browser/policy/enterprise_install_attributes.h

Issue 6869042: Add immutable settings checks when handling policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, address comments Created 9 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/policy/enterprise_install_attributes.h
diff --git a/chrome/browser/policy/enterprise_install_attributes.h b/chrome/browser/policy/enterprise_install_attributes.h
new file mode 100644
index 0000000000000000000000000000000000000000..90d728a277d48dbabe7c64f767c1ae40dc5ca84e
--- /dev/null
+++ b/chrome/browser/policy/enterprise_install_attributes.h
@@ -0,0 +1,65 @@
+// Copyright (c) 2011 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_POLICY_ENTERPRISE_INSTALL_ATTRIBUTES_H_
+#define CHROME_BROWSER_POLICY_ENTERPRISE_INSTALL_ATTRIBUTES_H_
+#pragma once
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+
+namespace chromeos {
+class CryptohomeLibrary;
+}
+
+namespace policy {
+
+// Brokers access to the enterprise-related installation-time attributes on
+// ChromeOS.
+class EnterpriseInstallAttributes {
+ public:
+ // Return codes for LockDevice().
+ enum LockResult {
+ LOCK_SUCCESS,
+ LOCK_NOT_READY,
+ LOCK_BACKEND_ERROR,
+ LOCK_WRONG_USER,
+ };
+
+ explicit EnterpriseInstallAttributes(chromeos::CryptohomeLibrary* cryptohome);
+
+ // Locks the device to be an enterprise device registered by the given user.
+ // This can also be called after the lock has already been taken, in which
+ // case it checks that the passed user agrees with the locked attribute.
+ LockResult LockDevice(const std::string& user) WARN_UNUSED_RESULT;
+
+ // Checks whether this is an enterprise device.
+ bool IsEnterpriseDevice();
+
+ // Gets the domain this device belongs to or an empty string if the device is
+ // not an enterprise device.
+ std::string GetDomain();
+
+ // Gets the user that registered the device. Returns an empty string if the
+ // device is not an enterprise device.
+ std::string GetRegistrationUser();
+
+ private:
+ // Makes sure the local caches for enterprise-related install attributes are
+ // up-to-date with what cryptohome has.
+ void ReadImmutableAttributes();
+
+ chromeos::CryptohomeLibrary* cryptohome_;
+
+ bool device_locked_;
+ std::string registration_user_;
+
+ DISALLOW_COPY_AND_ASSIGN(EnterpriseInstallAttributes);
+};
+
+} // namespace policy
+
+#endif // CHROME_BROWSER_POLICY_ENTERPRISE_INSTALL_ATTRIBUTES_H_
« no previous file with comments | « chrome/browser/policy/device_policy_cache_unittest.cc ('k') | chrome/browser/policy/enterprise_install_attributes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698