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

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: " 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/proto/device_management_backend.pb.h"
Mattias Nissler (ping if slow) 2012/02/15 15:32:03 We shouldn't depend on the proto file here. I feel
pastarmovj 2012/02/15 17:40:14 Done.
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
21 extern const char kEnterpiseDeviceMode[];
22 extern const char kKioskDeviceMode[];
23
20 // Brokers access to the enterprise-related installation-time attributes on 24 // Brokers access to the enterprise-related installation-time attributes on
21 // ChromeOS. 25 // ChromeOS.
22 class EnterpriseInstallAttributes { 26 class EnterpriseInstallAttributes {
23 public: 27 public:
24 // Return codes for LockDevice(). 28 // Return codes for LockDevice().
25 enum LockResult { 29 enum LockResult {
26 LOCK_SUCCESS, 30 LOCK_SUCCESS,
27 LOCK_NOT_READY, 31 LOCK_NOT_READY,
28 LOCK_BACKEND_ERROR, 32 LOCK_BACKEND_ERROR,
29 LOCK_WRONG_USER, 33 LOCK_WRONG_USER,
30 }; 34 };
31 35
32 explicit EnterpriseInstallAttributes(chromeos::CryptohomeLibrary* cryptohome); 36 explicit EnterpriseInstallAttributes(chromeos::CryptohomeLibrary* cryptohome);
33 37
34 // Locks the device to be an enterprise device registered by the given user. 38 // 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 39 // 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. 40 // case it checks that the passed user agrees with the locked attribute.
37 LockResult LockDevice(const std::string& user) WARN_UNUSED_RESULT; 41 LockResult LockDevice(
42 const std::string& user,
43 enterprise_management::DeviceRegisterResponse_DeviceMode device_mode,
44 const std::string& device_id) WARN_UNUSED_RESULT;
38 45
39 // Checks whether this is an enterprise device. 46 // Checks whether this is an enterprise device.
40 bool IsEnterpriseDevice(); 47 bool IsEnterpriseDevice();
41 48
42 // Gets the domain this device belongs to or an empty string if the device is 49 // Gets the domain this device belongs to or an empty string if the device is
43 // not an enterprise device. 50 // not an enterprise device.
44 std::string GetDomain(); 51 std::string GetDomain();
45 52
46 // Gets the user that registered the device. Returns an empty string if the 53 // Gets the user that registered the device. Returns an empty string if the
47 // device is not an enterprise device. 54 // device is not an enterprise device.
48 std::string GetRegistrationUser(); 55 std::string GetRegistrationUser();
49 56
57 // Gets the device id that was generated when the device was registered.
58 // Returns an empty string if the device is not an enterprise device or the
59 // device id was not stored in the lockbox (prior to R19).
60 std::string GetDeviceId();
61
62 // Gets the mode the device was enrolled to. The return value only makes sense
63 // for enrolled devices. Always verify with |IsEnrolledDevice| before trusting
64 // the output of this function!
Mattias Nissler (ping if slow) 2012/02/15 15:32:03 Maybe bool GetMode(DeviceMode* mode) would be a be
pastarmovj 2012/02/15 17:40:14 Using the local enum I can have a UNKNOWN_DEVICE v
65 enterprise_management::DeviceRegisterResponse_DeviceMode GetMode();
66
50 private: 67 private:
51 // Makes sure the local caches for enterprise-related install attributes are 68 // Makes sure the local caches for enterprise-related install attributes are
52 // up-to-date with what cryptohome has. 69 // up-to-date with what cryptohome has.
53 void ReadImmutableAttributes(); 70 void ReadImmutableAttributes();
54 71
55 chromeos::CryptohomeLibrary* cryptohome_; 72 chromeos::CryptohomeLibrary* cryptohome_;
56 73
57 bool device_locked_; 74 bool device_locked_;
58 std::string registration_user_; 75 std::string registration_user_;
76 std::string registration_domain_;
77 std::string registration_device_id_;
78 enterprise_management::DeviceRegisterResponse_DeviceMode registration_mode_;
59 79
60 DISALLOW_COPY_AND_ASSIGN(EnterpriseInstallAttributes); 80 DISALLOW_COPY_AND_ASSIGN(EnterpriseInstallAttributes);
61 }; 81 };
62 82
63 } // namespace policy 83 } // namespace policy
64 84
65 #endif // CHROME_BROWSER_POLICY_ENTERPRISE_INSTALL_ATTRIBUTES_H_ 85 #endif // CHROME_BROWSER_POLICY_ENTERPRISE_INSTALL_ATTRIBUTES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698