CodeHealth: Remove use of DictionaryValue::empty in /extensions/browser
This change removes the use of DictionaryValue::empty() and replaces with Value::DictEmpty() This CL was uploaded by git cl split. R=rdevlin.cronin@chromium.org Bug: 1187020 Change-Id: Ibb421248869e7d3d4e20b18a759d4ceeab9e15d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2880268 Commit-Queue: Devlin <rdevlin.cronin@chromium.org> Auto-Submit: Fangzhen Song <songfangzhen@bytedance.com> Reviewed-by: Devlin <rdevlin.cronin@chromium.org> Cr-Commit-Position: refs/heads/master@{#881246}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
ce7ff831fa
commit
da4fc3db1b
extensions/browser
@ -443,7 +443,7 @@ static std::string MakePathRelative(const base::FilePath& parent,
|
||||
void ExtensionPrefs::MakePathsRelative() {
|
||||
const base::DictionaryValue* dict =
|
||||
prefs_->GetDictionary(pref_names::kExtensions);
|
||||
if (!dict || dict->empty())
|
||||
if (!dict || dict->DictEmpty())
|
||||
return;
|
||||
|
||||
// Collect all extensions ids with absolute paths in |absolute_keys|.
|
||||
@ -1460,7 +1460,7 @@ void ExtensionPrefs::SetExtensionBlocklistState(const std::string& extension_id,
|
||||
} else {
|
||||
UpdateExtensionPref(extension_id, kPrefBlocklist, nullptr);
|
||||
const base::DictionaryValue* dict = GetExtensionPref(extension_id);
|
||||
if (dict && dict->empty())
|
||||
if (dict && dict->DictEmpty())
|
||||
DeleteExtensionPrefs(extension_id);
|
||||
}
|
||||
}
|
||||
@ -1853,7 +1853,7 @@ void ExtensionPrefs::SetLastLaunchTime(const std::string& extension_id,
|
||||
void ExtensionPrefs::ClearLastLaunchTimes() {
|
||||
const base::DictionaryValue* dict =
|
||||
prefs_->GetDictionary(pref_names::kExtensions);
|
||||
if (!dict || dict->empty())
|
||||
if (!dict || dict->DictEmpty())
|
||||
return;
|
||||
|
||||
// Collect all the keys to remove the last launched preference from.
|
||||
|
@ -202,5 +202,5 @@ TEST_F(LeveldbScopedDatabaseUnitTest, TestDeleteValues) {
|
||||
|
||||
base::DictionaryValue read_s2_vals;
|
||||
EXPECT_TRUE(db_->Read("scope2", &read_s2_vals).ok());
|
||||
EXPECT_TRUE(read_s2_vals.empty());
|
||||
EXPECT_TRUE(read_s2_vals.DictEmpty());
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ ValueStore::WriteResult LeveldbValueStore::Clear() {
|
||||
return WriteResult(read_result.PassStatus());
|
||||
|
||||
base::DictionaryValue& whole_db = read_result.settings();
|
||||
while (!whole_db.empty()) {
|
||||
while (!whole_db.DictEmpty()) {
|
||||
std::string next_key = base::DictionaryValue::Iterator(whole_db).key();
|
||||
std::unique_ptr<base::Value> next_value;
|
||||
whole_db.RemoveWithoutPathExpansion(next_key, &next_value);
|
||||
|
@ -94,7 +94,7 @@ TEST_F(LeveldbValueStoreUnitTest, RestoreKeyTest) {
|
||||
result = store()->Get(kCorruptKey);
|
||||
EXPECT_TRUE(result.status().ok())
|
||||
<< "Get result not OK: " << result.status().message;
|
||||
EXPECT_TRUE(result.settings().empty());
|
||||
EXPECT_TRUE(result.settings().DictEmpty());
|
||||
|
||||
// Verify that the valid pair is still present.
|
||||
result = store()->Get(kNotCorruptKey);
|
||||
|
Reference in New Issue
Block a user