| OLD | NEW |
| 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/ownership/owner_settings_service_chromeos.h" | 5 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" |
| 6 | 6 |
| 7 #include <keyhi.h> | 7 #include <keyhi.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 settings = *tentative_settings_; | 259 settings = *tentative_settings_; |
| 260 } else if (device_settings_service_->status() == | 260 } else if (device_settings_service_->status() == |
| 261 DeviceSettingsService::STORE_SUCCESS && | 261 DeviceSettingsService::STORE_SUCCESS && |
| 262 device_settings_service_->device_settings()) { | 262 device_settings_service_->device_settings()) { |
| 263 settings = *device_settings_service_->device_settings(); | 263 settings = *device_settings_service_->device_settings(); |
| 264 } | 264 } |
| 265 UpdateDeviceSettings(setting, value, settings); | 265 UpdateDeviceSettings(setting, value, settings); |
| 266 em::PolicyData policy_data; | 266 em::PolicyData policy_data; |
| 267 policy_data.set_username(user_id_); | 267 policy_data.set_username(user_id_); |
| 268 CHECK(settings.SerializeToString(policy_data.mutable_policy_value())); | 268 CHECK(settings.SerializeToString(policy_data.mutable_policy_value())); |
| 269 FOR_EACH_OBSERVER(OwnerSettingsService::Observer, observers_, | 269 for (auto& observer : observers_) |
| 270 OnTentativeChangesInPolicy(policy_data)); | 270 observer.OnTentativeChangesInPolicy(policy_data); |
| 271 StorePendingChanges(); | 271 StorePendingChanges(); |
| 272 return true; | 272 return true; |
| 273 } | 273 } |
| 274 | 274 |
| 275 bool OwnerSettingsServiceChromeOS::AppendToList(const std::string& setting, | 275 bool OwnerSettingsServiceChromeOS::AppendToList(const std::string& setting, |
| 276 const base::Value& value) { | 276 const base::Value& value) { |
| 277 DCHECK(thread_checker_.CalledOnValidThread()); | 277 DCHECK(thread_checker_.CalledOnValidThread()); |
| 278 const base::Value* old_value = CrosSettings::Get()->GetPref(setting); | 278 const base::Value* old_value = CrosSettings::Get()->GetPref(setting); |
| 279 if (old_value && !old_value->IsType(base::Value::TYPE_LIST)) | 279 if (old_value && !old_value->IsType(base::Value::TYPE_LIST)) |
| 280 return false; | 280 return false; |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 void OwnerSettingsServiceChromeOS::OnSignedPolicyStored(bool success) { | 723 void OwnerSettingsServiceChromeOS::OnSignedPolicyStored(bool success) { |
| 724 CHECK(device_settings_service_); | 724 CHECK(device_settings_service_); |
| 725 ReportStatusAndContinueStoring(success && | 725 ReportStatusAndContinueStoring(success && |
| 726 device_settings_service_->status() == | 726 device_settings_service_->status() == |
| 727 DeviceSettingsService::STORE_SUCCESS); | 727 DeviceSettingsService::STORE_SUCCESS); |
| 728 } | 728 } |
| 729 | 729 |
| 730 void OwnerSettingsServiceChromeOS::ReportStatusAndContinueStoring( | 730 void OwnerSettingsServiceChromeOS::ReportStatusAndContinueStoring( |
| 731 bool success) { | 731 bool success) { |
| 732 store_settings_factory_.InvalidateWeakPtrs(); | 732 store_settings_factory_.InvalidateWeakPtrs(); |
| 733 FOR_EACH_OBSERVER(OwnerSettingsService::Observer, observers_, | 733 for (auto& observer : observers_) |
| 734 OnSignedPolicyStored(success)); | 734 observer.OnSignedPolicyStored(success); |
| 735 StorePendingChanges(); | 735 StorePendingChanges(); |
| 736 } | 736 } |
| 737 | 737 |
| 738 } // namespace chromeos | 738 } // namespace chromeos |
| OLD | NEW |