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

Side by Side Diff: chrome/browser/policy/enterprise_install_attributes.h

Issue 9403010: Add support for kiosk mode on the client. Make sure the settings are written in the lockbox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed nitty nit. Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_POLICY_ENTERPRISE_INSTALL_ATTRIBUTES_H_ 5 #ifndef CHROME_BROWSER_POLICY_ENTERPRISE_INSTALL_ATTRIBUTES_H_
6 #define CHROME_BROWSER_POLICY_ENTERPRISE_INSTALL_ATTRIBUTES_H_ 6 #define CHROME_BROWSER_POLICY_ENTERPRISE_INSTALL_ATTRIBUTES_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "chrome/browser/policy/cloud_policy_constants.h"
13 14
14 namespace chromeos { 15 namespace chromeos {
15 class CryptohomeLibrary; 16 class CryptohomeLibrary;
16 } 17 }
17 18
18 namespace policy { 19 namespace policy {
19 20
20 // Brokers access to the enterprise-related installation-time attributes on 21 // Brokers access to the enterprise-related installation-time attributes on
21 // ChromeOS. 22 // ChromeOS.
22 class EnterpriseInstallAttributes { 23 class EnterpriseInstallAttributes {
23 public: 24 public:
24 // Return codes for LockDevice(). 25 // Return codes for LockDevice().
25 enum LockResult { 26 enum LockResult {
26 LOCK_SUCCESS, 27 LOCK_SUCCESS,
27 LOCK_NOT_READY, 28 LOCK_NOT_READY,
28 LOCK_BACKEND_ERROR, 29 LOCK_BACKEND_ERROR,
29 LOCK_WRONG_USER, 30 LOCK_WRONG_USER,
30 }; 31 };
31 32
32 explicit EnterpriseInstallAttributes(chromeos::CryptohomeLibrary* cryptohome); 33 explicit EnterpriseInstallAttributes(chromeos::CryptohomeLibrary* cryptohome);
33 34
34 // Locks the device to be an enterprise device registered by the given user. 35 // Locks the device to be an enterprise device registered by the given user.
35 // This can also be called after the lock has already been taken, in which 36 // This can also be called after the lock has already been taken, in which
36 // case it checks that the passed user agrees with the locked attribute. 37 // case it checks that the passed user agrees with the locked attribute.
37 LockResult LockDevice(const std::string& user) WARN_UNUSED_RESULT; 38 LockResult LockDevice(const std::string& user,
39 DeviceMode device_mode,
40 const std::string& device_id) WARN_UNUSED_RESULT;
38 41
39 // Checks whether this is an enterprise device. 42 // Checks whether this is an enterprise device.
40 bool IsEnterpriseDevice(); 43 bool IsEnterpriseDevice();
41 44
42 // Gets the domain this device belongs to or an empty string if the device is 45 // Gets the domain this device belongs to or an empty string if the device is
43 // not an enterprise device. 46 // not an enterprise device.
44 std::string GetDomain(); 47 std::string GetDomain();
45 48
46 // Gets the user that registered the device. Returns an empty string if the 49 // Gets the user that registered the device. Returns an empty string if the
47 // device is not an enterprise device. 50 // device is not an enterprise device.
48 std::string GetRegistrationUser(); 51 std::string GetRegistrationUser();
49 52
53 // Gets the device id that was generated when the device was registered.
54 // Returns an empty string if the device is not an enterprise device or the
55 // device id was not stored in the lockbox (prior to R19).
56 std::string GetDeviceId();
57
58 // Gets the mode the device was enrolled to. The return value for devices that
59 // are not locked yet will be DEVICE_MODE_UNKNOWN.
60 DeviceMode GetMode();
61
50 private: 62 private:
51 // Makes sure the local caches for enterprise-related install attributes are 63 // Makes sure the local caches for enterprise-related install attributes are
52 // up-to-date with what cryptohome has. 64 // up-to-date with what cryptohome has.
53 void ReadImmutableAttributes(); 65 void ReadImmutableAttributes();
54 66
55 chromeos::CryptohomeLibrary* cryptohome_; 67 chromeos::CryptohomeLibrary* cryptohome_;
56 68
57 bool device_locked_; 69 bool device_locked_;
58 std::string registration_user_; 70 std::string registration_user_;
71 std::string registration_domain_;
72 std::string registration_device_id_;
73 DeviceMode registration_mode_;
59 74
60 DISALLOW_COPY_AND_ASSIGN(EnterpriseInstallAttributes); 75 DISALLOW_COPY_AND_ASSIGN(EnterpriseInstallAttributes);
61 }; 76 };
62 77
63 } // namespace policy 78 } // namespace policy
64 79
65 #endif // CHROME_BROWSER_POLICY_ENTERPRISE_INSTALL_ATTRIBUTES_H_ 80 #endif // CHROME_BROWSER_POLICY_ENTERPRISE_INSTALL_ATTRIBUTES_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/device_token_fetcher_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