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

Side by Side Diff: chrome/browser/chromeos/policy/device_cloud_policy_initializer.cc

Issue 386643003: Enrollment recovery: Fix check for presence of machine id. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_initializer.h" 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.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/logging.h" 9 #include "base/logging.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 if (local_state_->HasPrefPath(prefs::kDeviceEnrollmentAutoStart)) 126 if (local_state_->HasPrefPath(prefs::kDeviceEnrollmentAutoStart))
127 return local_state_->GetBoolean(prefs::kDeviceEnrollmentAutoStart); 127 return local_state_->GetBoolean(prefs::kDeviceEnrollmentAutoStart);
128 128
129 return GetMachineFlag(chromeos::system::kOemIsEnterpriseManagedKey, false); 129 return GetMachineFlag(chromeos::system::kOemIsEnterpriseManagedKey, false);
130 } 130 }
131 131
132 bool DeviceCloudPolicyInitializer::ShouldRecoverEnrollment() const { 132 bool DeviceCloudPolicyInitializer::ShouldRecoverEnrollment() const {
133 if (install_attributes_->IsEnterpriseDevice() && 133 if (install_attributes_->IsEnterpriseDevice() &&
134 chromeos::StartupUtils::IsEnrollmentRecoveryRequired()) { 134 chromeos::StartupUtils::IsEnrollmentRecoveryRequired()) {
135 LOG(WARNING) << "Enrollment recovery required according to pref."; 135 LOG(WARNING) << "Enrollment recovery required according to pref.";
136 std::string machine_id; 136 if (!DeviceCloudPolicyManagerChromeOS::GetMachineID().empty())
137 bool machine_id_success =
138 chromeos::system::StatisticsProvider::GetInstance()
139 ->GetMachineStatistic(chromeos::system::kHardwareClassKey,
140 &machine_id);
141 if (machine_id_success && machine_id != "")
142 return true; 137 return true;
143 LOG(WARNING) << "Postponing recovery because machine id is missing."; 138 LOG(WARNING) << "Postponing recovery because machine id is missing.";
144 } 139 }
145 return false; 140 return false;
146 } 141 }
147 142
148 bool DeviceCloudPolicyInitializer::CanExitEnrollment() const { 143 bool DeviceCloudPolicyInitializer::CanExitEnrollment() const {
149 if (GetRestoreMode() == kDeviceStateRestoreModeReEnrollmentEnforced) 144 if (GetRestoreMode() == kDeviceStateRestoreModeReEnrollmentEnforced)
150 return false; 145 return false;
151 146
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 233
239 std::string DeviceCloudPolicyInitializer::GetRestoreMode() const { 234 std::string DeviceCloudPolicyInitializer::GetRestoreMode() const {
240 const base::DictionaryValue* device_state_dict = 235 const base::DictionaryValue* device_state_dict =
241 local_state_->GetDictionary(prefs::kServerBackedDeviceState); 236 local_state_->GetDictionary(prefs::kServerBackedDeviceState);
242 std::string restore_mode; 237 std::string restore_mode;
243 device_state_dict->GetString(kDeviceStateRestoreMode, &restore_mode); 238 device_state_dict->GetString(kDeviceStateRestoreMode, &restore_mode);
244 return restore_mode; 239 return restore_mode;
245 } 240 }
246 241
247 } // namespace policy 242 } // namespace policy
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698