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

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 comments and added more tests. 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"
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
Mattias Nissler (ping if slow) 2012/02/16 10:36:27 comment
pastarmovj 2012/02/17 13:59:47 Done.
33 enum DeviceMode {
34 END_USER_DEVICE,
Mattias Nissler (ping if slow) 2012/02/16 10:36:27 Put a common prefix, e.g. DEVICE_MODE_ENTERPRISE e
Mattias Nissler (ping if slow) 2012/02/16 10:36:27 s/END_USER/CONSUMER/, since enterprise users are a
pastarmovj 2012/02/17 13:59:47 Done.
pastarmovj 2012/02/17 13:59:47 Done.
35 ENTERPRISE_DEVICE,
36 KIOSK_DEVICE,
37 UNKNOWN_DEVICE
38 };
39
32 explicit EnterpriseInstallAttributes(chromeos::CryptohomeLibrary* cryptohome); 40 explicit EnterpriseInstallAttributes(chromeos::CryptohomeLibrary* cryptohome);
33 41
34 // Locks the device to be an enterprise device registered by the given user. 42 // 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 43 // 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. 44 // case it checks that the passed user agrees with the locked attribute.
37 LockResult LockDevice(const std::string& user) WARN_UNUSED_RESULT; 45 LockResult LockDevice(
Mattias Nissler (ping if slow) 2012/02/16 10:36:27 this line break should no longer be necessary
pastarmovj 2012/02/17 13:59:47 Done.
46 const std::string& user,
47 DeviceMode device_mode,
48 const std::string& device_id) WARN_UNUSED_RESULT;
38 49
39 // Checks whether this is an enterprise device. 50 // Checks whether this is an enterprise device.
40 bool IsEnterpriseDevice(); 51 bool IsEnterpriseDevice();
41 52
42 // Gets the domain this device belongs to or an empty string if the device is 53 // Gets the domain this device belongs to or an empty string if the device is
43 // not an enterprise device. 54 // not an enterprise device.
44 std::string GetDomain(); 55 std::string GetDomain();
45 56
46 // Gets the user that registered the device. Returns an empty string if the 57 // Gets the user that registered the device. Returns an empty string if the
47 // device is not an enterprise device. 58 // device is not an enterprise device.
48 std::string GetRegistrationUser(); 59 std::string GetRegistrationUser();
49 60
61 // Gets the device id that was generated when the device was registered.
62 // Returns an empty string if the device is not an enterprise device or the
63 // device id was not stored in the lockbox (prior to R19).
64 std::string GetDeviceId();
65
66 // Gets the mode the device was enrolled to. The return value only makes sense
67 // for enrolled devices. Always verify with |IsEnrolledDevice| before trusting
68 // the output of this function!
Mattias Nissler (ping if slow) 2012/02/16 10:36:27 This comment is outdated, you may want to change i
pastarmovj 2012/02/17 13:59:47 Done. Actually for non-enterprise devices it will
69 DeviceMode GetMode();
70
50 private: 71 private:
51 // Makes sure the local caches for enterprise-related install attributes are 72 // Makes sure the local caches for enterprise-related install attributes are
52 // up-to-date with what cryptohome has. 73 // up-to-date with what cryptohome has.
53 void ReadImmutableAttributes(); 74 void ReadImmutableAttributes();
54 75
55 chromeos::CryptohomeLibrary* cryptohome_; 76 chromeos::CryptohomeLibrary* cryptohome_;
56 77
57 bool device_locked_; 78 bool device_locked_;
58 std::string registration_user_; 79 std::string registration_user_;
80 std::string registration_domain_;
81 std::string registration_device_id_;
82 DeviceMode registration_mode_;
59 83
60 DISALLOW_COPY_AND_ASSIGN(EnterpriseInstallAttributes); 84 DISALLOW_COPY_AND_ASSIGN(EnterpriseInstallAttributes);
61 }; 85 };
62 86
63 } // namespace policy 87 } // namespace policy
64 88
65 #endif // CHROME_BROWSER_POLICY_ENTERPRISE_INSTALL_ATTRIBUTES_H_ 89 #endif // CHROME_BROWSER_POLICY_ENTERPRISE_INSTALL_ATTRIBUTES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698