Lines Matching refs:key
57 bool PrefsBase::GetString(const std::string_view key, string* value) const { in GetString() argument
58 return storage_->GetKey(key, value); in GetString()
61 bool PrefsBase::SetString(std::string_view key, std::string_view value) { in SetString() argument
62 TEST_AND_RETURN_FALSE(storage_->SetKey(key, value)); in SetString()
63 const auto observers_for_key = observers_.find(key); in SetString()
67 observer->OnPrefSet(key); in SetString()
72 bool PrefsBase::GetInt64(const std::string_view key, int64_t* value) const { in GetInt64() argument
74 if (!GetString(key, &str_value)) in GetInt64()
78 LOG(ERROR) << "When reading pref " << key in GetInt64()
83 LOG(ERROR) << "When reading pref " << key << ", failed to convert value " in GetInt64()
90 bool PrefsBase::SetInt64(std::string_view key, const int64_t value) { in SetInt64() argument
91 return SetString(key, base::NumberToString(value)); in SetInt64()
94 bool PrefsBase::GetBoolean(std::string_view key, bool* value) const { in GetBoolean() argument
96 if (!GetString(key, &str_value)) in GetBoolean()
110 bool PrefsBase::SetBoolean(std::string_view key, const bool value) { in SetBoolean() argument
111 return SetString(key, value ? "true" : "false"); in SetBoolean()
114 bool PrefsBase::Exists(std::string_view key) const { in Exists()
115 return storage_->KeyExists(key); in Exists()
118 bool PrefsBase::Delete(std::string_view key) { in Delete() argument
119 TEST_AND_RETURN_FALSE(storage_->DeleteKey(key)); in Delete()
120 const auto observers_for_key = observers_.find(key); in Delete()
124 observer->OnPrefDeleted(key); in Delete()
136 for (const auto& key : namespace_keys) { in Delete() local
137 auto last_key_seperator = key.find_last_of(kKeySeparator); in Delete()
139 pref_key == key.substr(last_key_seperator + 1)) { in Delete()
140 success = Delete(key) && success; in Delete()
151 void PrefsBase::AddObserver(std::string_view key, ObserverInterface* observer) { in AddObserver() argument
152 observers_[std::string{key}].push_back(observer); in AddObserver()
155 void PrefsBase::RemoveObserver(std::string_view key, in RemoveObserver() argument
158 observers_[std::string{key}]; in RemoveObserver()
257 bool Prefs::FileStorage::GetKey(std::string_view key, string* value) const { in GetKey() argument
259 TEST_AND_RETURN_FALSE(GetFileNameForKey(key, &filename)); in GetKey()
284 bool Prefs::FileStorage::SetKey(std::string_view key, std::string_view value) { in SetKey() argument
286 TEST_AND_RETURN_FALSE(GetFileNameForKey(key, &filename)); in SetKey()
297 bool Prefs::FileStorage::KeyExists(std::string_view key) const { in KeyExists()
299 TEST_AND_RETURN_FALSE(GetFileNameForKey(key, &filename)); in KeyExists()
303 bool Prefs::FileStorage::DeleteKey(std::string_view key) { in DeleteKey() argument
305 TEST_AND_RETURN_FALSE(GetFileNameForKey(key, &filename)); in DeleteKey()
314 bool Prefs::FileStorage::GetFileNameForKey(std::string_view key, in GetFileNameForKey() argument
317 TEST_AND_RETURN_FALSE(!key.empty()); in GetFileNameForKey()
318 for (char c : key) in GetFileNameForKey()
324 .Append(base::FilePath::StringPieceType(key.data(), key.size())); in GetFileNameForKey()
327 base::FilePath::StringPieceType(key.data(), key.size())); in GetFileNameForKey()
334 bool MemoryPrefs::MemoryStorage::GetKey(std::string_view key, in GetKey() argument
336 auto it = values_.find(key); in GetKey()
359 bool MemoryPrefs::MemoryStorage::SetKey(std::string_view key, in SetKey() argument
361 values_[std::string{key}] = value; in SetKey()
365 bool MemoryPrefs::MemoryStorage::KeyExists(std::string_view key) const { in KeyExists()
366 return values_.find(key) != values_.end(); in KeyExists()
369 bool MemoryPrefs::MemoryStorage::DeleteKey(std::string_view key) { in DeleteKey() argument
370 auto it = values_.find(key); in DeleteKey()