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

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

Issue 751703003: Implemented consumer management unenrollment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dcpm
Patch Set: Created 6 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 scoped_ptr<em::PolicyData> policy = 163 scoped_ptr<em::PolicyData> policy =
164 OwnerSettingsServiceChromeOS::AssemblePolicy( 164 OwnerSettingsServiceChromeOS::AssemblePolicy(
165 GetUsername(), policy_data(), device_settings()); 165 GetUsername(), policy_data(), device_settings());
166 if (!policy) { 166 if (!policy) {
167 HandleError(DeviceSettingsService::STORE_POLICY_ERROR, callback); 167 HandleError(DeviceSettingsService::STORE_POLICY_ERROR, callback);
168 return; 168 return;
169 } 169 }
170 170
171 policy->set_management_mode(management_mode); 171 policy->set_management_mode(management_mode);
172 policy->set_request_token(request_token); 172 if (request_token.empty())
173 policy->set_device_id(device_id); 173 policy->clear_request_token();
174 else
175 policy->set_request_token(request_token);
176 if (device_id.empty())
bartfab (slow) 2014/11/28 13:25:18 Nit: I think it would be more readable if you adde
davidyu 2014/12/01 17:05:23 Done.
177 policy->clear_device_id();
178 else
179 policy->set_device_id(device_id);
174 180
175 EnqueueSignAndStore(policy.Pass(), callback); 181 EnqueueSignAndStore(policy.Pass(), callback);
176 } 182 }
177 183
178 void DeviceSettingsService::Store(scoped_ptr<em::PolicyFetchResponse> policy, 184 void DeviceSettingsService::Store(scoped_ptr<em::PolicyFetchResponse> policy,
179 const base::Closure& callback) { 185 const base::Closure& callback) {
180 Enqueue(linked_ptr<SessionManagerOperation>(new StoreSettingsOperation( 186 Enqueue(linked_ptr<SessionManagerOperation>(new StoreSettingsOperation(
181 base::Bind(&DeviceSettingsService::HandleCompletedOperation, 187 base::Bind(&DeviceSettingsService::HandleCompletedOperation,
182 weak_factory_.GetWeakPtr(), 188 weak_factory_.GetWeakPtr(),
183 callback), 189 callback),
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 DeviceSettingsService::Initialize(); 410 DeviceSettingsService::Initialize();
405 } 411 }
406 412
407 ScopedTestDeviceSettingsService::~ScopedTestDeviceSettingsService() { 413 ScopedTestDeviceSettingsService::~ScopedTestDeviceSettingsService() {
408 // Clean pending operations. 414 // Clean pending operations.
409 DeviceSettingsService::Get()->UnsetSessionManager(); 415 DeviceSettingsService::Get()->UnsetSessionManager();
410 DeviceSettingsService::Shutdown(); 416 DeviceSettingsService::Shutdown();
411 } 417 }
412 418
413 } // namespace chromeos 419 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698