OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/crnet/sdch_owner_pref_storage.h" | 5 #include "ios/crnet/sdch_owner_pref_storage.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "components/prefs/persistent_pref_store.h" | 8 #include "components/prefs/persistent_pref_store.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 return result_value->GetAsDictionary(result); | 65 return result_value->GetAsDictionary(result); |
66 } | 66 } |
67 | 67 |
68 bool SdchOwnerPrefStorage::GetMutableValue(base::DictionaryValue** result) { | 68 bool SdchOwnerPrefStorage::GetMutableValue(base::DictionaryValue** result) { |
69 base::Value* result_value = nullptr; | 69 base::Value* result_value = nullptr; |
70 if (!storage_->GetMutableValue(storage_key_, &result_value)) | 70 if (!storage_->GetMutableValue(storage_key_, &result_value)) |
71 return false; | 71 return false; |
72 return result_value->GetAsDictionary(result); | 72 return result_value->GetAsDictionary(result); |
73 } | 73 } |
74 | 74 |
75 void SdchOwnerPrefStorage::SetValue(scoped_ptr<base::DictionaryValue> value) { | 75 void SdchOwnerPrefStorage::SetValue( |
| 76 std::unique_ptr<base::DictionaryValue> value) { |
76 storage_->SetValue(storage_key_, std::move(value), | 77 storage_->SetValue(storage_key_, std::move(value), |
77 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); | 78 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); |
78 } | 79 } |
79 | 80 |
80 void SdchOwnerPrefStorage::ReportValueChanged() { | 81 void SdchOwnerPrefStorage::ReportValueChanged() { |
81 storage_->ReportValueChanged(storage_key_, | 82 storage_->ReportValueChanged(storage_key_, |
82 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); | 83 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); |
83 } | 84 } |
84 | 85 |
85 bool SdchOwnerPrefStorage::IsInitializationComplete() { | 86 bool SdchOwnerPrefStorage::IsInitializationComplete() { |
(...skipping 12 matching lines...) Expand all Loading... |
98 storage_->RemoveObserver(this); | 99 storage_->RemoveObserver(this); |
99 } | 100 } |
100 | 101 |
101 void SdchOwnerPrefStorage::OnPrefValueChanged(const std::string& key) { | 102 void SdchOwnerPrefStorage::OnPrefValueChanged(const std::string& key) { |
102 } | 103 } |
103 | 104 |
104 void SdchOwnerPrefStorage::OnInitializationCompleted(bool succeeded) { | 105 void SdchOwnerPrefStorage::OnInitializationCompleted(bool succeeded) { |
105 DCHECK(init_observer_); | 106 DCHECK(init_observer_); |
106 init_observer_->OnPrefStorageInitializationComplete(succeeded); | 107 init_observer_->OnPrefStorageInitializationComplete(succeeded); |
107 } | 108 } |
OLD | NEW |