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

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

Issue 17010003: Cleanup of system settings constants (ab)use. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 #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/prefs/pref_registry_simple.h" 9 #include "base/prefs/pref_registry_simple.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if (enrollment_handler_.get()) { 131 if (enrollment_handler_.get()) {
132 enrollment_handler_.reset(); 132 enrollment_handler_.reset();
133 StartIfManaged(); 133 StartIfManaged();
134 } 134 }
135 } 135 }
136 136
137 std::string DeviceCloudPolicyManagerChromeOS::GetDeviceRequisition() const { 137 std::string DeviceCloudPolicyManagerChromeOS::GetDeviceRequisition() const {
138 std::string requisition; 138 std::string requisition;
139 const PrefService::Preference* pref = local_state_->FindPreference( 139 const PrefService::Preference* pref = local_state_->FindPreference(
140 prefs::kDeviceEnrollmentRequisition); 140 prefs::kDeviceEnrollmentRequisition);
141 if (pref->IsDefaultValue()) 141 if (pref->IsDefaultValue()) {
142 requisition = GetMachineStatistic(chromeos::kOemDeviceRequisitionKey); 142 requisition =
143 else 143 GetMachineStatistic(chromeos::system::kOemDeviceRequisitionKey);
144 } else {
144 pref->GetValue()->GetAsString(&requisition); 145 pref->GetValue()->GetAsString(&requisition);
146 }
145 147
146 return requisition; 148 return requisition;
147 } 149 }
148 150
149 void DeviceCloudPolicyManagerChromeOS::SetDeviceRequisition( 151 void DeviceCloudPolicyManagerChromeOS::SetDeviceRequisition(
150 const std::string& requisition) { 152 const std::string& requisition) {
151 if (local_state_) { 153 if (local_state_) {
152 if (requisition.empty()) { 154 if (requisition.empty()) {
153 local_state_->ClearPref(prefs::kDeviceEnrollmentRequisition); 155 local_state_->ClearPref(prefs::kDeviceEnrollmentRequisition);
154 local_state_->ClearPref(prefs::kDeviceEnrollmentAutoStart); 156 local_state_->ClearPref(prefs::kDeviceEnrollmentAutoStart);
155 local_state_->ClearPref(prefs::kDeviceEnrollmentCanExit); 157 local_state_->ClearPref(prefs::kDeviceEnrollmentCanExit);
156 } else { 158 } else {
157 local_state_->SetString(prefs::kDeviceEnrollmentRequisition, requisition); 159 local_state_->SetString(prefs::kDeviceEnrollmentRequisition, requisition);
158 local_state_->SetBoolean(prefs::kDeviceEnrollmentAutoStart, true); 160 local_state_->SetBoolean(prefs::kDeviceEnrollmentAutoStart, true);
159 local_state_->SetBoolean(prefs::kDeviceEnrollmentCanExit, false); 161 local_state_->SetBoolean(prefs::kDeviceEnrollmentCanExit, false);
160 } 162 }
161 } 163 }
162 } 164 }
163 165
164 bool DeviceCloudPolicyManagerChromeOS::ShouldAutoStartEnrollment() const { 166 bool DeviceCloudPolicyManagerChromeOS::ShouldAutoStartEnrollment() const {
165 if (local_state_->HasPrefPath(prefs::kDeviceEnrollmentAutoStart)) 167 if (local_state_->HasPrefPath(prefs::kDeviceEnrollmentAutoStart))
166 return local_state_->GetBoolean(prefs::kDeviceEnrollmentAutoStart); 168 return local_state_->GetBoolean(prefs::kDeviceEnrollmentAutoStart);
167 169
168 return GetMachineFlag(chromeos::kOemIsEnterpriseManagedKey, false); 170 return GetMachineFlag(chromeos::system::kOemIsEnterpriseManagedKey, false);
169 } 171 }
170 172
171 bool DeviceCloudPolicyManagerChromeOS::CanExitEnrollment() const { 173 bool DeviceCloudPolicyManagerChromeOS::CanExitEnrollment() const {
172 if (local_state_->HasPrefPath(prefs::kDeviceEnrollmentCanExit)) 174 if (local_state_->HasPrefPath(prefs::kDeviceEnrollmentCanExit))
173 return local_state_->GetBoolean(prefs::kDeviceEnrollmentCanExit); 175 return local_state_->GetBoolean(prefs::kDeviceEnrollmentCanExit);
174 176
175 return GetMachineFlag(chromeos::kOemCanExitEnterpriseEnrollmentKey, true); 177 return GetMachineFlag(chromeos::system::kOemCanExitEnterpriseEnrollmentKey,
178 true);
176 } 179 }
177 180
178 void DeviceCloudPolicyManagerChromeOS::Shutdown() { 181 void DeviceCloudPolicyManagerChromeOS::Shutdown() {
179 CloudPolicyManager::Shutdown(); 182 CloudPolicyManager::Shutdown();
180 device_status_provider_.reset(); 183 device_status_provider_.reset();
181 } 184 }
182 185
183 void DeviceCloudPolicyManagerChromeOS::OnStoreLoaded(CloudPolicyStore* store) { 186 void DeviceCloudPolicyManagerChromeOS::OnStoreLoaded(CloudPolicyStore* store) {
184 CloudPolicyManager::OnStoreLoaded(store); 187 CloudPolicyManager::OnStoreLoaded(store);
185 188
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 core()->Connect(CreateClient()); 259 core()->Connect(CreateClient());
257 core()->StartRefreshScheduler(); 260 core()->StartRefreshScheduler();
258 core()->TrackRefreshDelayPref(local_state_, 261 core()->TrackRefreshDelayPref(local_state_,
259 prefs::kDevicePolicyRefreshRate); 262 prefs::kDevicePolicyRefreshRate);
260 attestation_policy_observer_.reset( 263 attestation_policy_observer_.reset(
261 new chromeos::attestation::AttestationPolicyObserver(client())); 264 new chromeos::attestation::AttestationPolicyObserver(client()));
262 } 265 }
263 } 266 }
264 267
265 } // namespace policy 268 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/wizard_controller.cc ('k') | chrome/browser/chromeos/policy/device_status_collector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698