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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; |
281 std::unique_ptr<base::ListValue> new_value( | 281 std::unique_ptr<base::ListValue> new_value( |
282 old_value ? static_cast<const base::ListValue*>(old_value)->DeepCopy() | 282 old_value ? static_cast<const base::ListValue*>(old_value)->DeepCopy() |
283 : new base::ListValue()); | 283 : new base::ListValue()); |
284 new_value->Append(value.DeepCopy()); | 284 new_value->Append(value.CreateDeepCopy()); |
285 return Set(setting, *new_value); | 285 return Set(setting, *new_value); |
286 } | 286 } |
287 | 287 |
288 bool OwnerSettingsServiceChromeOS::RemoveFromList(const std::string& setting, | 288 bool OwnerSettingsServiceChromeOS::RemoveFromList(const std::string& setting, |
289 const base::Value& value) { | 289 const base::Value& value) { |
290 DCHECK(thread_checker_.CalledOnValidThread()); | 290 DCHECK(thread_checker_.CalledOnValidThread()); |
291 const base::Value* old_value = CrosSettings::Get()->GetPref(setting); | 291 const base::Value* old_value = CrosSettings::Get()->GetPref(setting); |
292 if (old_value && !old_value->IsType(base::Value::TYPE_LIST)) | 292 if (old_value && !old_value->IsType(base::Value::TYPE_LIST)) |
293 return false; | 293 return false; |
294 std::unique_ptr<base::ListValue> new_value( | 294 std::unique_ptr<base::ListValue> new_value( |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_EACH_OBSERVER(OwnerSettingsService::Observer, observers_, |
734 OnSignedPolicyStored(success)); | 734 OnSignedPolicyStored(success)); |
735 StorePendingChanges(); | 735 StorePendingChanges(); |
736 } | 736 } |
737 | 737 |
738 } // namespace chromeos | 738 } // namespace chromeos |
OLD | NEW |