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

Side by Side Diff: chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h

Issue 212653004: Update server-backed state key generation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix re-enrollment test. Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 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_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H_ 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H_
7 7
8 #include <bitset> 8 #include <bitset>
9 #include <string> 9 #include <string>
10 #include <vector>
10 11
11 #include "base/basictypes.h" 12 #include "base/basictypes.h"
12 #include "base/callback.h" 13 #include "base/callback.h"
13 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
14 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
16 #include "chrome/browser/chromeos/policy/enrollment_status_chromeos.h" 17 #include "chrome/browser/chromeos/policy/enrollment_status_chromeos.h"
17 #include "components/policy/core/common/cloud/cloud_policy_client.h" 18 #include "components/policy/core/common/cloud/cloud_policy_client.h"
18 #include "components/policy/core/common/cloud/cloud_policy_manager.h" 19 #include "components/policy/core/common/cloud/cloud_policy_manager.h"
19 #include "components/policy/core/common/cloud/cloud_policy_store.h" 20 #include "components/policy/core/common/cloud/cloud_policy_store.h"
(...skipping 18 matching lines...) Expand all
38 class EnrollmentHandlerChromeOS; 39 class EnrollmentHandlerChromeOS;
39 class EnterpriseInstallAttributes; 40 class EnterpriseInstallAttributes;
40 41
41 // CloudPolicyManager specialization for device policy on Chrome OS. The most 42 // CloudPolicyManager specialization for device policy on Chrome OS. The most
42 // significant addition is support for device enrollment. 43 // significant addition is support for device enrollment.
43 class DeviceCloudPolicyManagerChromeOS : public CloudPolicyManager { 44 class DeviceCloudPolicyManagerChromeOS : public CloudPolicyManager {
44 public: 45 public:
45 typedef std::bitset<32> AllowedDeviceModes; 46 typedef std::bitset<32> AllowedDeviceModes;
46 typedef base::Callback<void(EnrollmentStatus)> EnrollmentCallback; 47 typedef base::Callback<void(EnrollmentStatus)> EnrollmentCallback;
47 48
49 // The power of two determining the size of the time quanta for device state
50 // keys, i.e. the quanta will be of size 2^kDeviceStateKeyTimeQuantumPower
51 // seconds. 2^23 seconds corresponds to 97.09 days.
52 static const int kDeviceStateKeyTimeQuantumPower = 23;
53
54 // The number of future time quanta to generate device state identifiers for.
55 // This determines the interval after which a device will no longer receive
56 // server-backed state information and thus corresponds to the delay until a
57 // device becomes anonymous to the server again.
58 //
59 // The goal here is to guarantee state key validity for 1 year into the
60 // future. 4 quanta are needed to cover a year, but the current quantum is
61 // clipped short in the general case. Hence, one buffer quantum is needed to
62 // make up for the clipping, yielding a total of 5 quanta.
63 static const int kDeviceStateKeyFutureQuanta = 5;
64
48 // |task_runner| is the runner for policy refresh tasks. 65 // |task_runner| is the runner for policy refresh tasks.
49 // |background_task_runner| is used to execute long-running background tasks 66 // |background_task_runner| is used to execute long-running background tasks
50 // that may involve file I/O. 67 // that may involve file I/O.
51 DeviceCloudPolicyManagerChromeOS( 68 DeviceCloudPolicyManagerChromeOS(
52 scoped_ptr<DeviceCloudPolicyStoreChromeOS> store, 69 scoped_ptr<DeviceCloudPolicyStoreChromeOS> store,
53 const scoped_refptr<base::SequencedTaskRunner>& task_runner, 70 const scoped_refptr<base::SequencedTaskRunner>& task_runner,
54 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, 71 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner,
55 EnterpriseInstallAttributes* install_attributes); 72 EnterpriseInstallAttributes* install_attributes);
56 virtual ~DeviceCloudPolicyManagerChromeOS(); 73 virtual ~DeviceCloudPolicyManagerChromeOS();
57 74
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 111
95 // Pref registration helper. 112 // Pref registration helper.
96 static void RegisterPrefs(PrefRegistrySimple* registry); 113 static void RegisterPrefs(PrefRegistrySimple* registry);
97 114
98 // Returns the device serial number, or an empty string if not available. 115 // Returns the device serial number, or an empty string if not available.
99 static std::string GetMachineID(); 116 static std::string GetMachineID();
100 117
101 // Returns the machine model, or an empty string if not available. 118 // Returns the machine model, or an empty string if not available.
102 static std::string GetMachineModel(); 119 static std::string GetMachineModel();
103 120
104 // Returns the stable device state key. 121 // Gets the device state keys for |timestamp|. These will cover a time frame
105 static std::string GetDeviceStateKey(); 122 // including |timestamp| and extending into the future as configured by the
123 // constants declared above.
124 static bool GetDeviceStateKeys(const base::Time& timestamp,
125 std::vector<std::string>* state_keys);
126
127 // Returns the currently valid device state key.
128 static std::string GetCurrentDeviceStateKey();
106 129
107 // Returns the robot 'email address' associated with the device robot 130 // Returns the robot 'email address' associated with the device robot
108 // account (sometimes called a service account) associated with this device 131 // account (sometimes called a service account) associated with this device
109 // during enterprise enrollment. 132 // during enterprise enrollment.
110 std::string GetRobotAccountId(); 133 std::string GetRobotAccountId();
111 134
112 private: 135 private:
113 // Creates a new CloudPolicyClient. 136 // Creates a new CloudPolicyClient.
114 scoped_ptr<CloudPolicyClient> CreateClient(); 137 scoped_ptr<CloudPolicyClient> CreateClient();
115 138
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 170
148 scoped_ptr<chromeos::attestation::AttestationPolicyObserver> 171 scoped_ptr<chromeos::attestation::AttestationPolicyObserver>
149 attestation_policy_observer_; 172 attestation_policy_observer_;
150 173
151 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOS); 174 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOS);
152 }; 175 };
153 176
154 } // namespace policy 177 } // namespace policy
155 178
156 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H _ 179 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698