OLD | NEW |
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 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 using content::BrowserThread; | 41 using content::BrowserThread; |
42 | 42 |
43 namespace em = enterprise_management; | 43 namespace em = enterprise_management; |
44 | 44 |
45 namespace policy { | 45 namespace policy { |
46 | 46 |
47 namespace { | 47 namespace { |
48 | 48 |
49 const char kNoRequisition[] = "none"; | 49 const char kNoRequisition[] = "none"; |
50 const char kRemoraRequisition[] = "remora"; | 50 const char kRemoraRequisition[] = "remora"; |
51 const char kSharkRequisition[] = "shark"; | |
52 | 51 |
53 // These are the machine serial number keys that we check in order until we | 52 // These are the machine serial number keys that we check in order until we |
54 // find a non-empty serial number. The VPD spec says the serial number should be | 53 // find a non-empty serial number. The VPD spec says the serial number should be |
55 // in the "serial_number" key for v2+ VPDs. However, legacy devices used a | 54 // in the "serial_number" key for v2+ VPDs. However, legacy devices used a |
56 // different key to report their serial number, which we fall back to if | 55 // different key to report their serial number, which we fall back to if |
57 // "serial_number" is not present. | 56 // "serial_number" is not present. |
58 // | 57 // |
59 // Product_S/N is still special-cased due to inconsistencies with serial | 58 // Product_S/N is still special-cased due to inconsistencies with serial |
60 // numbers on Lumpy devices: On these devices, serial_number is identical to | 59 // numbers on Lumpy devices: On these devices, serial_number is identical to |
61 // Product_S/N with an appended checksum. Unfortunately, the sticker on the | 60 // Product_S/N with an appended checksum. Unfortunately, the sticker on the |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 local_state_->SetBoolean(prefs::kDeviceEnrollmentCanExit, false); | 173 local_state_->SetBoolean(prefs::kDeviceEnrollmentCanExit, false); |
175 } | 174 } |
176 } | 175 } |
177 } | 176 } |
178 } | 177 } |
179 | 178 |
180 bool DeviceCloudPolicyManagerChromeOS::IsRemoraRequisition() const { | 179 bool DeviceCloudPolicyManagerChromeOS::IsRemoraRequisition() const { |
181 return GetDeviceRequisition() == kRemoraRequisition; | 180 return GetDeviceRequisition() == kRemoraRequisition; |
182 } | 181 } |
183 | 182 |
184 bool DeviceCloudPolicyManagerChromeOS::IsSharkRequisition() const { | |
185 return GetDeviceRequisition() == kSharkRequisition; | |
186 } | |
187 | |
188 void DeviceCloudPolicyManagerChromeOS::Shutdown() { | 183 void DeviceCloudPolicyManagerChromeOS::Shutdown() { |
189 status_uploader_.reset(); | 184 status_uploader_.reset(); |
190 syslog_uploader_.reset(); | 185 syslog_uploader_.reset(); |
191 heartbeat_scheduler_.reset(); | 186 heartbeat_scheduler_.reset(); |
192 state_keys_update_subscription_.reset(); | 187 state_keys_update_subscription_.reset(); |
193 CloudPolicyManager::Shutdown(); | 188 CloudPolicyManager::Shutdown(); |
194 } | 189 } |
195 | 190 |
196 // static | 191 // static |
197 void DeviceCloudPolicyManagerChromeOS::RegisterPrefs( | 192 void DeviceCloudPolicyManagerChromeOS::RegisterPrefs( |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 | 294 |
300 const PrefService::Preference* pref = local_state_->FindPreference( | 295 const PrefService::Preference* pref = local_state_->FindPreference( |
301 prefs::kDeviceEnrollmentRequisition); | 296 prefs::kDeviceEnrollmentRequisition); |
302 if (pref->IsDefaultValue()) { | 297 if (pref->IsDefaultValue()) { |
303 std::string requisition = | 298 std::string requisition = |
304 GetMachineStatistic(chromeos::system::kOemDeviceRequisitionKey); | 299 GetMachineStatistic(chromeos::system::kOemDeviceRequisitionKey); |
305 | 300 |
306 if (!requisition.empty()) { | 301 if (!requisition.empty()) { |
307 local_state_->SetString(prefs::kDeviceEnrollmentRequisition, | 302 local_state_->SetString(prefs::kDeviceEnrollmentRequisition, |
308 requisition); | 303 requisition); |
309 if (requisition == kRemoraRequisition || | 304 if (requisition == kRemoraRequisition) { |
310 requisition == kSharkRequisition) { | |
311 local_state_->SetBoolean(prefs::kDeviceEnrollmentAutoStart, true); | 305 local_state_->SetBoolean(prefs::kDeviceEnrollmentAutoStart, true); |
312 local_state_->SetBoolean(prefs::kDeviceEnrollmentCanExit, false); | 306 local_state_->SetBoolean(prefs::kDeviceEnrollmentCanExit, false); |
313 } else { | 307 } else { |
314 local_state_->SetBoolean( | 308 local_state_->SetBoolean( |
315 prefs::kDeviceEnrollmentAutoStart, | 309 prefs::kDeviceEnrollmentAutoStart, |
316 GetMachineFlag(chromeos::system::kOemIsEnterpriseManagedKey, | 310 GetMachineFlag(chromeos::system::kOemIsEnterpriseManagedKey, |
317 false)); | 311 false)); |
318 local_state_->SetBoolean( | 312 local_state_->SetBoolean( |
319 prefs::kDeviceEnrollmentCanExit, | 313 prefs::kDeviceEnrollmentCanExit, |
320 GetMachineFlag(chromeos::system::kOemCanExitEnterpriseEnrollmentKey, | 314 GetMachineFlag(chromeos::system::kOemCanExitEnterpriseEnrollmentKey, |
(...skipping 19 matching lines...) Expand all Loading... |
340 make_scoped_ptr(new DeviceStatusCollector( | 334 make_scoped_ptr(new DeviceStatusCollector( |
341 local_state_, chromeos::system::StatisticsProvider::GetInstance(), | 335 local_state_, chromeos::system::StatisticsProvider::GetInstance(), |
342 DeviceStatusCollector::LocationUpdateRequester(), | 336 DeviceStatusCollector::LocationUpdateRequester(), |
343 DeviceStatusCollector::VolumeInfoFetcher(), | 337 DeviceStatusCollector::VolumeInfoFetcher(), |
344 DeviceStatusCollector::CPUStatisticsFetcher(), | 338 DeviceStatusCollector::CPUStatisticsFetcher(), |
345 DeviceStatusCollector::CPUTempFetcher())), | 339 DeviceStatusCollector::CPUTempFetcher())), |
346 task_runner_)); | 340 task_runner_)); |
347 } | 341 } |
348 | 342 |
349 } // namespace policy | 343 } // namespace policy |
OLD | NEW |