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

Side by Side Diff: chrome/browser/chromeos/settings/device_settings_service.cc

Issue 2544773002: Fetch policy from Active Directory at the end of enrollment (Closed)
Patch Set: Convert CHECK_EQ(true, ...) to CHECK(...) Created 4 years 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/settings/device_settings_service.h" 5 #include "chrome/browser/chromeos/settings/device_settings_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 return public_key_; 125 return public_key_;
126 } 126 }
127 127
128 void DeviceSettingsService::Load() { 128 void DeviceSettingsService::Load() {
129 EnqueueLoad(false); 129 EnqueueLoad(false);
130 } 130 }
131 131
132 void DeviceSettingsService::Store( 132 void DeviceSettingsService::Store(
133 std::unique_ptr<em::PolicyFetchResponse> policy, 133 std::unique_ptr<em::PolicyFetchResponse> policy,
134 const base::Closure& callback) { 134 const base::Closure& callback) {
135 // On Active Directory managed devices policy is written only by authpolicyd.
136 CHECK(device_mode_ != policy::DEVICE_MODE_ENTERPRISE_AD);
135 Enqueue(linked_ptr<SessionManagerOperation>(new StoreSettingsOperation( 137 Enqueue(linked_ptr<SessionManagerOperation>(new StoreSettingsOperation(
136 base::Bind(&DeviceSettingsService::HandleCompletedOperation, 138 base::Bind(&DeviceSettingsService::HandleCompletedOperation,
137 weak_factory_.GetWeakPtr(), callback), 139 weak_factory_.GetWeakPtr(), callback),
138 std::move(policy)))); 140 std::move(policy))));
139 } 141 }
140 142
141 DeviceSettingsService::OwnershipStatus 143 DeviceSettingsService::OwnershipStatus
142 DeviceSettingsService::GetOwnershipStatus() { 144 DeviceSettingsService::GetOwnershipStatus() {
143 if (public_key_.get()) 145 if (public_key_.get())
144 return public_key_->is_loaded() ? OWNERSHIP_TAKEN : OWNERSHIP_NONE; 146 return public_key_->is_loaded() ? OWNERSHIP_TAKEN : OWNERSHIP_NONE;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 owner_key_util_.get()) { 251 owner_key_util_.get()) {
250 pending_operations_.front()->Start( 252 pending_operations_.front()->Start(
251 session_manager_client_, owner_key_util_, public_key_); 253 session_manager_client_, owner_key_util_, public_key_);
252 } 254 }
253 } 255 }
254 256
255 void DeviceSettingsService::HandleCompletedOperation( 257 void DeviceSettingsService::HandleCompletedOperation(
256 const base::Closure& callback, 258 const base::Closure& callback,
257 SessionManagerOperation* operation, 259 SessionManagerOperation* operation,
258 Status status) { 260 Status status) {
259 // Exactly one must be true: Active Directory management or existence of key.
260 DCHECK((device_mode_ == policy::DEVICE_MODE_ENTERPRISE_AD) !=
261 (operation->public_key() != nullptr));
262 DCHECK_EQ(operation, pending_operations_.front().get()); 261 DCHECK_EQ(operation, pending_operations_.front().get());
263 262
264 store_status_ = status; 263 store_status_ = status;
265 if (status == STORE_SUCCESS) { 264 if (status == STORE_SUCCESS) {
266 policy_data_ = std::move(operation->policy_data()); 265 policy_data_ = std::move(operation->policy_data());
267 device_settings_ = std::move(operation->device_settings()); 266 device_settings_ = std::move(operation->device_settings());
268 load_retries_left_ = kMaxLoadRetries; 267 load_retries_left_ = kMaxLoadRetries;
269 } else if (status != STORE_KEY_UNAVAILABLE) { 268 } else if (status != STORE_KEY_UNAVAILABLE) {
270 LOG(ERROR) << "Session manager operation failed: " << status; 269 LOG(ERROR) << "Session manager operation failed: " << status;
271 // Validation errors can be temporary if the rtc has gone on holiday for a 270 // Validation errors can be temporary if the rtc has gone on holiday for a
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 DeviceSettingsService::Initialize(); 345 DeviceSettingsService::Initialize();
347 } 346 }
348 347
349 ScopedTestDeviceSettingsService::~ScopedTestDeviceSettingsService() { 348 ScopedTestDeviceSettingsService::~ScopedTestDeviceSettingsService() {
350 // Clean pending operations. 349 // Clean pending operations.
351 DeviceSettingsService::Get()->UnsetSessionManager(); 350 DeviceSettingsService::Get()->UnsetSessionManager();
352 DeviceSettingsService::Shutdown(); 351 DeviceSettingsService::Shutdown();
353 } 352 }
354 353
355 } // namespace chromeos 354 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698