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

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

Issue 2486813002: Add DeviceADPolicyManager to provide AD policy. (Closed)
Patch Set: Created 4 years, 1 month 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
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_store_chromeos.h" 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 14 matching lines...) Expand all
25 DeviceCloudPolicyStoreChromeOS::DeviceCloudPolicyStoreChromeOS( 25 DeviceCloudPolicyStoreChromeOS::DeviceCloudPolicyStoreChromeOS(
26 chromeos::DeviceSettingsService* device_settings_service, 26 chromeos::DeviceSettingsService* device_settings_service,
27 chromeos::InstallAttributes* install_attributes, 27 chromeos::InstallAttributes* install_attributes,
28 scoped_refptr<base::SequencedTaskRunner> background_task_runner) 28 scoped_refptr<base::SequencedTaskRunner> background_task_runner)
29 : device_settings_service_(device_settings_service), 29 : device_settings_service_(device_settings_service),
30 install_attributes_(install_attributes), 30 install_attributes_(install_attributes),
31 background_task_runner_(background_task_runner), 31 background_task_runner_(background_task_runner),
32 enrollment_validation_done_(false), 32 enrollment_validation_done_(false),
33 weak_factory_(this) { 33 weak_factory_(this) {
34 device_settings_service_->AddObserver(this); 34 device_settings_service_->AddObserver(this);
35 device_settings_service_->SetDeviceMode(install_attributes_->GetMode());
35 } 36 }
36 37
37 DeviceCloudPolicyStoreChromeOS::~DeviceCloudPolicyStoreChromeOS() { 38 DeviceCloudPolicyStoreChromeOS::~DeviceCloudPolicyStoreChromeOS() {
38 device_settings_service_->RemoveObserver(this); 39 device_settings_service_->RemoveObserver(this);
39 } 40 }
40 41
41 void DeviceCloudPolicyStoreChromeOS::Store( 42 void DeviceCloudPolicyStoreChromeOS::Store(
42 const em::PolicyFetchResponse& policy) { 43 const em::PolicyFetchResponse& policy) {
43 // Cancel all pending requests. 44 // Cancel all pending requests.
44 weak_factory_.InvalidateWeakPtrs(); 45 weak_factory_.InvalidateWeakPtrs();
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 149
149 // For enterprise devices, once per session, validate internal consistency of 150 // For enterprise devices, once per session, validate internal consistency of
150 // enrollment state (DM token must be present on enrolled devices) and in case 151 // enrollment state (DM token must be present on enrolled devices) and in case
151 // of failure set flag to indicate that recovery is required. 152 // of failure set flag to indicate that recovery is required.
152 switch (status) { 153 switch (status) {
153 case chromeos::DeviceSettingsService::STORE_SUCCESS: 154 case chromeos::DeviceSettingsService::STORE_SUCCESS:
154 case chromeos::DeviceSettingsService::STORE_KEY_UNAVAILABLE: 155 case chromeos::DeviceSettingsService::STORE_KEY_UNAVAILABLE:
155 case chromeos::DeviceSettingsService::STORE_NO_POLICY: 156 case chromeos::DeviceSettingsService::STORE_NO_POLICY:
156 case chromeos::DeviceSettingsService::STORE_INVALID_POLICY: 157 case chromeos::DeviceSettingsService::STORE_INVALID_POLICY:
157 case chromeos::DeviceSettingsService::STORE_VALIDATION_ERROR: { 158 case chromeos::DeviceSettingsService::STORE_VALIDATION_ERROR: {
158 if (!enrollment_validation_done_) { 159 if (!enrollment_validation_done_ &&
160 install_attributes_->GetMode() != DEVICE_MODE_ENTERPRISE_AD) {
159 enrollment_validation_done_ = true; 161 enrollment_validation_done_ = true;
160 const bool has_dm_token = 162 const bool has_dm_token =
161 status == chromeos::DeviceSettingsService::STORE_SUCCESS && 163 status == chromeos::DeviceSettingsService::STORE_SUCCESS &&
162 policy_data && 164 policy_data &&
163 policy_data->has_request_token(); 165 policy_data->has_request_token();
164 166
165 // At the time LoginDisplayHostImpl decides whether enrollment flow is 167 // At the time LoginDisplayHostImpl decides whether enrollment flow is
166 // to be started, policy hasn't been read yet. To work around this, 168 // to be started, policy hasn't been read yet. To work around this,
167 // once the need for recovery is detected upon policy load, a flag is 169 // once the need for recovery is detected upon policy load, a flag is
168 // stored in prefs which is accessed by LoginDisplayHostImpl early 170 // stored in prefs which is accessed by LoginDisplayHostImpl early
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 case chromeos::DeviceSettingsService::STORE_VALIDATION_ERROR: 215 case chromeos::DeviceSettingsService::STORE_VALIDATION_ERROR:
214 case chromeos::DeviceSettingsService::STORE_TEMP_VALIDATION_ERROR: 216 case chromeos::DeviceSettingsService::STORE_TEMP_VALIDATION_ERROR:
215 status_ = STATUS_LOAD_ERROR; 217 status_ = STATUS_LOAD_ERROR;
216 break; 218 break;
217 } 219 }
218 220
219 NotifyStoreError(); 221 NotifyStoreError();
220 } 222 }
221 223
222 } // namespace policy 224 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698