Commit 054a1b3b authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Remove deprecated versions of base::Value::RemovePath().

Bug: 646113
Change-Id: Ie687bd9a3930d2cf5edbf39a019df717d93263a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2436384Reviewed-by: default avatarJan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: default avatarKaran Bhatia <karandeepb@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811858}
parent 45e6b373
......@@ -717,29 +717,6 @@ Value* Value::SetPath(span<const StringPiece> path, Value&& value) {
return cur->SetKey(*cur_path, std::move(value));
}
bool Value::RemovePath(std::initializer_list<StringPiece> path) {
DCHECK_GE(path.size(), 2u) << "Use RemoveKey() for a path of length 1.";
return RemovePath(make_span(path.begin(), path.size()));
}
bool Value::RemovePath(span<const StringPiece> path) {
if (!is_dict() || path.empty())
return false;
if (path.size() == 1)
return RemoveKey(path[0]);
auto found = dict().find(path[0]);
if (found == dict().end() || !found->second->is_dict())
return false;
bool removed = found->second->RemovePath(path.subspan(1));
if (removed && found->second->dict().empty())
dict().erase(found);
return removed;
}
Value::dict_iterator_proxy Value::DictItems() {
return dict_iterator_proxy(&dict());
}
......
......@@ -430,10 +430,6 @@ class BASE_EXPORT Value {
// bool success = value.RemovePath("foo.bar");
bool RemovePath(StringPiece path);
// Deprecated versions
bool RemovePath(std::initializer_list<StringPiece> path);
bool RemovePath(span<const StringPiece> path);
// Tries to extract a Value at the given path.
//
// If the current value is not a dictionary or any path component does not
......
......@@ -122,10 +122,10 @@ std::unique_ptr<base::Value> ParseReportUpload(const std::string& payload) {
// Clear out any non-reproducible fields.
for (auto& report : parsed_payload->GetList()) {
report.RemoveKey("age");
report.RemovePath({"body", "elapsed_time"});
report.RemovePath("body.elapsed_time");
auto* user_agent =
report.FindKeyOfType("user_agent", base::Value::Type::STRING);
if (user_agent != nullptr)
if (user_agent)
*user_agent = base::Value("Mozilla/1.0");
}
return parsed_payload;
......
......@@ -10,6 +10,7 @@
#include "base/bind.h"
#include "base/guid.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/strcat.h"
#include "base/time/default_tick_clock.h"
#include "base/values.h"
#include "components/prefs/pref_registry_simple.h"
......@@ -668,7 +669,7 @@ void LockScreenItemStorage::RemoveExtensionFromLocalState(
const std::string& id) {
{
DictionaryPrefUpdate update(local_state_, kLockScreenDataPrefKey);
update->RemovePath({user_id_, id});
update->RemovePath(base::StrCat({user_id_, ".", id}));
}
data_item_cache_[id].state = CachedExtensionData::State::kLoaded;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment